Hi, guys.
I’m trying to port clouds shader to Unity
this is the original effect: Shader - Shadertoy BETA
However there are some problems when porting the noise function
float noise( in vec3 x )
{
vec3 p = floor(x);
vec3 f = fract(x);
f = ff(3.0-2.0*f);
vec2 uv = (p.xy+vec2(37.0,17.0)p.z) + f.xy;
vec2 rg = texture2D( iChannel0, (uv+ 0.5)/256.0, -100.0 ).yx;
return -1.0+2.0mix( rg.x, rg.y, f.z );
}
I tried to visualize the noise value using the following code
vec4 debugNoise(in vec3 ro, in vec3 rd)
{
vec3 testpos = ro + rd * 10.0;
float debugval = noise(testpos);
return vec4(debugval,debugval,debugval,1);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 p = (fragCoord.xy/ iResolution.xy - 0.5)*2.0;
// camera
vec3 ro = 4.0*normalize(vec3(0,0,1));
vec3 ta = vec3(0.0, 0.0, 0.0);
mat3 ca = setCamera( ro, ta, 0.0 );
// ray
vec3 rd = ca * normalize( vec3(p.xy,1.5));
fragColor = debugNoise( ro, rd );
}
everything works well in the website, you can try it youself. Below is the result.
However when i tried it in Unity, it shows the following result, there are 3 big weird circles
and the noise look up image was downloaded from shadertoy website
following is the import settings

my unity shader file was attached as well.
I guess there might be some render states difference that cause the problem.
Can anybody help me?
2301344–154926–ScreenSpaceCloud.shader (1.88 KB)

