Cannot use multiple Texture Coordinates nodes with same Tex

Node-based Shader Editor

Cannot use multiple Texture Coordinates nodes with same Tex

Postby Linear » Sun Feb 10, 2019 10:52 pm

Hey, so I just started using Amplify Shader Editor today, and I noticed something conspicuously lacking. There's no way to create a UV set switch property. As in, I need my Material to have a dropdown for which UV set a particular sampler should pull from. I need this to be exposed in the inspector, and I need it to adhere to the tiling/offset of the sampler.

So I did a bit of research, and come up with this solution:

figure1.png
figure1.png (124.54 KiB) Viewed 135408 times


The orange node is my custom "UV-Set Selector" function, which looks like this:

figure2.png
figure2.png (240.24 KiB) Viewed 135408 times


This exposes a nice enum dropdown in my shader where I can choose UV0, UV1, UV2, or UV3. However, when I use this function, the shader does not compile, and Unity presents this error:

Shader error in 'Tesselated 2-Detail': redefinition of 'uv_Diffuse' at line 62 (on d3d11)

The surface shader ends up compiling like this:

figure3.png
figure3.png (48.64 KiB) Viewed 135408 times


As you can see, somewhere in the code generation step for a Texture Coordinates node, it attempts to define a local float2 named "uv" + samplerName. When you have multiple of these nodes connecting to the same Tex input, as I do, they all want to define the exact same local variable. Is there any workaround to this?

I've tried everything I could think of from the node graph, but stopped short of changing how TextureCoordinatesNode works internally. Even if I wanted to go that route, there's problems there. Changing the built-in node itself would mean having to maintain my changes across upgrades of Amplify Shader Editor, and cloning the node would be tricky. The source is 559 lines long with hardcoded GUIDs and references to shader versions. I'm not sure if there a guide to custom nodes somewhere that will explain how best to duplicate a node (what do I need to change in my copy of the node so that it's unique?).

Has anyone encountered this issue? I feel like a UV selector property should already be a built-in node, as it's a very common operation. I'm coming from UBER shader, and all of their shaders have UV set selectors. Even the Standard Unity shader has a UV selector for the secondary maps. Maybe there's a node I should be using?
Linear
 
Posts: 4
Joined: Sun Feb 10, 2019 10:34 pm

Re: Cannot use multiple Texture Coordinates nodes with same

Postby Amplify_Borba » Thu Feb 14, 2019 2:25 pm

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

Are you using the latest ASE version from our website?

If so, can you send us a sample with the issue present as we haven't been able to replicate it on our side?

Regarding your request for a UV Selector, I believe that the workaround you've come up with is the only viable way of achieving what you pretend, as it's not possible to switch UV channels via inspector.
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: Cannot use multiple Texture Coordinates nodes with same

Postby Linear » Sun Feb 24, 2019 6:02 pm

Hey guys, thanks for the quick response.

I am using release version 1.6.2 from the Asset Store.

I have zipped up the version and I will PM you the sharable link shortly (I've included Amplify Shader Editor v1.6.2 in the zip so I don't want to just post it here).
Linear
 
Posts: 4
Joined: Sun Feb 10, 2019 10:34 pm

Re: Cannot use multiple Texture Coordinates nodes with same

Postby Linear » Sat Mar 23, 2019 2:25 am

Bumping this in case you guys haven't seen my PM yet.
Linear
 
Posts: 4
Joined: Sun Feb 10, 2019 10:34 pm

Re: Cannot use multiple Texture Coordinates nodes with same

Postby Amplify_Borba » Tue Mar 26, 2019 7:14 pm

Hey there, apologies for not reaching out sooner, this issue should already be fixed in the latest version available through our website, please let us know if you come across any further issues, thank you!
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: Cannot use multiple Texture Coordinates nodes with same

Postby Linear » Wed Apr 10, 2019 7:50 pm

Gotcha, I'll give it a try. Thanks!
Linear
 
Posts: 4
Joined: Sun Feb 10, 2019 10:34 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 3 guests