UV Data Lost on Global Replace

Node-based Shader Editor

UV Data Lost on Global Replace

Postby bbickle » Fri Nov 16, 2018 5:05 pm

I'm trying to write a shader that will be used in tandem with Shader.SetReplacementShader. The only piece that I'm having trouble with is getting the UV data to maintain when I swap through code. If I change the shader of a material in Editor, it works fine. It also works if I global replace through code a legacy shader or non amplify one. When I swap to an Amplify made shader through code, however, the UV data seems to be null every time, even when I use different types of Textures (global, default). The target objects for the swap generally use a Standard shader for reference. Is there a method to preserve the uv data I should be using?
bbickle
 
Posts: 4
Joined: Fri Nov 16, 2018 4:47 pm

Re: UV Data Lost on Global Replace

Postby Amplify_Borba » Mon Nov 19, 2018 4:46 pm

Hello, thank you for getting in touch and for your support!

We're going to need some additional information in order to help you debug this situation, could you provide a simple sample with the issue present so that we can examine it using the same data as you?

It might be a simple matter of mismatched property names on the shader in regards to what Unity uses/expects, but we can't be entirely sure without first examining a sample.

Also, can you confirm if you meant Camera.SetReplacementShader, rather than Shader.SetReplacementShader?
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: UV Data Lost on Global Replace

Postby bbickle » Mon Nov 19, 2018 6:32 pm

Yes, confirmed to be using Camera.SetReplaceShader. I've cut out all of the extra pieces from the shader I'm trying to get to work, and attached a picture. I've also confirmed that I'm getting the same behavior with the trimmed version as the regular. The only component that isn't working seems to be the uvs when the shader tries to access a texture from the previous material. The exact code to replace is is 'SetReplaceShader(shader, "RenderType")'.

EDIT: I've also tried using textures that were not '_MainTex' that had default values with the same effect

repl.PNG
repl.PNG (132.66 KiB) Viewed 1767 times


Thanks for the help!
bbickle
 
Posts: 4
Joined: Fri Nov 16, 2018 4:47 pm

Re: UV Data Lost on Global Replace

Postby Amplify_Borba » Tue Nov 20, 2018 3:38 pm

We've ran some tests in Unity 5.5 with the latest ASE version and everything seems to work as expected, are you using the same property names in both the replacement and original shaders?

In order to provide further assistance, we'll need a sample with the issue present to debug on our side, since we were unable to replicate the issue. Also, please share Unity and ASE versions being used as well.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: UV Data Lost on Global Replace

Postby bbickle » Tue Nov 20, 2018 5:53 pm

The Unity version I'm using is 2018.2.14f1 and the Amplify version I'm using is 1.5.9. I can confirm both that the variable names are the same, and through RenderDoc can confirm that the correct Texture data is being passed through, it's the UV data that isn't.

I was just able to get an ASE shader to work on swap by hand editing the shader and changing the Input structure to take 'uv_MainTex' instead of the generated 'uv_texcoord' and the texture sample accordingly. This of course gets overwritten when I re-compile the shader.
bbickle
 
Posts: 4
Joined: Fri Nov 16, 2018 4:47 pm

Re: UV Data Lost on Global Replace

Postby Amplify_Borba » Wed Nov 21, 2018 12:16 pm

We ran our tests with two shaders authored in ASE, so the UV nomenclature was identical in this case, did you also use two ASE shaders?

In any case, we're unable to change the way we create UVs on our side, since it was developed in order to optimize the number of generated interpolators.

Apologies for insisting, but it would be really helpful to run some tests on a sample project with the issue present, as it would likely save time for both sides.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: UV Data Lost on Global Replace

Postby bbickle » Mon Nov 26, 2018 11:17 pm

The workflow we were trying to accomplish was Standard Shader (Not generated in ASE) => Global Replace with ASE Shader. I tried to attached a zipped, bare-bones project, but the upload repeatedly fails without message. Regardless, it's sounding like the UV issue will be an impassable one, and we'll need to find another solution. Thank you for the assistance.
bbickle
 
Posts: 4
Joined: Fri Nov 16, 2018 4:47 pm

Re: UV Data Lost on Global Replace

Postby Amplify_Borba » Tue Nov 27, 2018 2:31 pm

Would it be possible for you to convert and use that Standard Shader to an ASE authored shader?

I believe this would be the best solution since we've confirmed that it's working as expected, and also due to the unfortunate fact that we can't do any changes on our side regarding the nomenclature being used to try and support replacing standard or custom shaders with ASE ones.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 33 guests