In Working with Geometry Attributes section it is written that vertex shader attributes such as uv (texture coordinate layers) will always be declared for you. I cannot find information on what these layers are exactly or where they are defined. What’s the difference between writing uv.xy or uv.xy in a vertex shader?
If you middle mouse click on a sop, you’ll “usually” see that uv0 is defined. when I say uv0 I mean the first set of 3 uv coordinates (u,v, and w). See the screenshot below of a standard box SOP:
It’s possible to lay out multiple versions of a SOP’s uv’s and assign them to different uv “layers”. If you drop a texture SOP down, you can set the Texture Layer parameter at the top, and any changes you make will write those uv’s to that texture layer. If you set texture layer to 1, you’ll see that middle mouse clicking on the sop shows uv instead indicating there are 2 sets of uvs:
You can then access this in the vertex shader slightly differently. uv is your uvw coordinates from layer 0, and uv will give you your uvw coordinates from layer 1, and so forth.
One point to be clear on, if in the above example you create a new uv set on texture layer 2, but nothing on texture layer 1, middle mouse clicking will show you uv because of how the reporting works. technically though what’s in uv will just be a bunch of zero’s since you never explicitly wrote anything to them, and skipped over them to uv.
So just be sure you’re not fooled by what the sop info tells you, and be wary of setting and retrieving from consistent uv layers and you’ll be good
Thanks, Lucas! Super clear explanation