three-good-godrays
three-good-godrays copied to clipboard
'LinearTosRGB' : no matching overloaded function found
Hey!
On the latest three.js version (0.167.1) I'm getting the following error:
three.module.js:20198 THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
Material Name: GodraysCompositorMaterial
Material Type: ShaderMaterial
Program Info Log: Fragment shader is not compiled.
FRAGMENT
ERROR: 0:158: 'LinearTosRGB' : no matching overloaded function found
ERROR: 0:158: '=' : dimension mismatch
ERROR: 0:158: 'assign' : cannot convert from 'const mediump float' to 'out highp 4-component vector of float'
153: #endif
154: float linearize_depth(float d,float zNear,float zFar){return zNear*zFar/(zFar+d*(zNear-zFar));}void main(){float rawDepth=texture2D(sceneDepth,vUv).x;float correctDepth=linearize_depth(rawDepth,near,far);vec2 pushDir=vec2(0.0);float count=0.0;for(float x=-edgeRadius;x<=edgeRadius;x++){for(float y=-edgeRadius;y<=edgeRadius;y++){vec2 sampleUv=(vUv*resolution+vec2(x,y))/resolution;float sampleDepth=texelFetch(sceneDepth,ivec2(sampleUv*resolution),0).x;sampleDepth=linearize_depth(sampleDepth,near,far);if(abs(sampleDepth-correctDepth)<0.05*correctDepth){pushDir+=vec2(x,y);count+=1.0;}}}if(count==0.0){count=1.0;}pushDir/=count;pushDir=normalize(pushDir);vec2 sampleUv=length(pushDir)>0.0?vUv+edgeStrength*(pushDir/resolution):vUv;float bestChoice=texture2D(godrays,sampleUv).x;vec3 diffuse=texture2D(sceneDiffuse,vUv).rgb;gl_FragColor=vec4(mix(diffuse,color,bestChoice),1.0);
155: #ifdef DITHERING
156: gl_FragColor.rgb = dithering( gl_FragColor.rgb );
157: #endif
> 158: if(gammaCorrection){gl_FragColor=LinearTosRGB(gl_FragColor);}}
Doesn't matter if I set the gammaCorrection
param to true
or false
.