I have a surface shader that adds a bit of positional noise, using the following code:
float2 uv_main = IN.uv_MainTex +
float2(
tex2D(_PosNoise, IN.uv_MainTex).r - 0.5,
tex2D(_PosNoise, IN.uv_MainTex).r - 0.5
) / float2(_Width, _Height) * _MovementOffset;
o.Albedo = tex2D(_MainTex, uv_main);
_MovementOffset is a float, the _Width and _Height are the size of the map in world coordinates. _PosNoise is a texture that is the same for both versions.
The problem I'm seeing is that the effective noise changes between how the image looks in the Unity Editor vs when it is compiled. The effect is such that I need to multiply the MovementOffset by a factor of 2-3 to have the same effect in the compiled version.
Unity:
Compiled:
I don't understand what could be causing this, and am having some real difficulties figuring it out. Any suggestions on where to look? Thanks!


float2(_Width, _Height)is causing scaling difference when your window size is bigger? \$\endgroup\$