When UV1 is undefined in mesh, what is the expected value in shader graph?

I created a flat shaded castle kit in blender where all the meshes have UV0. Some meshes have features where there should be emission and for these, I create UV1 in blender and map the UV1 to the same color atlas texture.

When I render them in Unity, I want to use a single URP Lit Shader Graph and a single color atlas. In the shader, I sample the texture using UV0 and output to base color; I also sample the same texture using UV1 and output to emission.

My expectation is that for those meshes with UV1, emission will apply; whereas for those meshes without UV1, emission is black (0, 0, 0, 0). However, it appears that for those without UV1, the result is white.

Is this the expected behaviour? How to I detect whether UV1 exists and if not, skip the emission output?

When UV0 is missing from a model, the U,V coordinates are 0,0 for that vertex and all map to that same pixel in the texture. I expect UV1 should work the same, so I expect that the emission would be whatever value is at the 0,0 corner of texture.

1 Like

Thanks… I was expecting undefined UV will cause the chain to nodes to result in output zero.

Looks like I need to use a different approach.

How about vertex color? It seems when undefined, vertex color is one? Is that the case? I am using vertex color black and white to indicate which vertex can be displaced. But turns out when undefined, the vertex is also displacing.

After messing around for some more, I gave up and do it the “regular” way with an emission texture that uses UV0. I think it is the most straight forward thing to do, and keeps way of doing things aligned with the rest of the assets, especially third party assets.