I’m not really sure what you’re trying to do here.
But to use TRANSFORM_TEX, you feed in the UV and then _TexturePropertyName_ST.
The errir is because you aren’t referencing your struct when you reference uv_DistortionMap.xy.
You need to use **v.**uv_DistortionMap.xy - because you’re passing your a2v struct into the vertex shader as a variable called v.
Thanks Farfarer, what if I have more than 1 texture in the shader, how will Unity understand that " float2 uv : TEXCOORD0; " in a2v is the uv from the distortion map and not the one from the main texture for example?
(I would like to use a simple distortion map to create small waves on a toon shader, I have got the toon shader, written as a frag/vert shader, and I would like to add the distortion map to it. So I would like to use only the uv from the distortion map, and apply it on the main texture and the bump image)
OK thanks, but if I have got “main tex” and a “distortion map” declared in the shader, which one would be (and how to separate them) in the a2v struct?
I will have to check more examples, because the waves on a custom mesh is not as simple as I thought!
There isn’t a way to distinguish them - they use the same UV map as far as the a2v struct is concerned.
However, the tiling/offset values of the textures are available to you in the vertex shader. So you apply them to that UV map in the vertex shader and pass those to the fragment shader - via v2f - for sampling the texture in the fragment shader.