I’m working on a shader that applies a detail texture over the top of an existing mesh and then pans the detail texture. A problem I ran into is that since the detail texture is using the mesh’s UVs, the detail texture doesn’t look quite right. Also, if two meshes next to each other are using the same material, it would be cool if the detail texture appeared to be seamless.
I’m currently doing this to calculate the UVs of both textures, but I guess I’m looking for a different calculation for the DetailTex UVs:
output.uv.xy = TRANSFORM_TEX(input.texcoord.xy, _MainTex);
output.uv.zw = TRANSFORM_TEX(input.texcoord.xy, _DetailTex);
Because of this, I was looking for a way to mimik Shaderlab’s TexGen EyeLinear in CG, but I’m a bit confused by the math. Is it just converting the UV coordinates to world space? Are there any samples of how to do this in shader code? Any sample code or pointers to an explanation of the math would be much appreciated!