drei-vanilla icon indicating copy to clipboard operation
drei-vanilla copied to clipboard

Shader error after initialisation

Open 1337jick opened this issue 1 year ago • 2 comments

Hi! First of all, thank you for such a contribution to vanilla users :)

After basic implementation, I hope that I did it right:

       const lensGeometry = new THREE.SphereGeometry( 2, 128, 128 );

        const lensMaterial = new MeshTransmissionMaterial({
          buffer: renderTarget.texture,
          ior: 1.025,
          thickness: 0.5,
          chromaticAberration: 0.05,
          backside: true,
        })
        const lens = new THREE.Mesh(lensGeometry, lensMaterial);

I get an error:

       three.module.js?39ea:18765 THREE.WebGLProgram: Shader Error 1282 - VALIDATE_STATUS false

Program Info Log: Fragment shader is not compiled.
�

FRAGMENT

ERROR: 0:1563: '[' : syntax error
�

  1558:         vec3 distortionNormal = vec3(0.0);
  1559:         vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion;
  1560:         if (distortion > 0.0) {
  1561:           distortionNormal = distortion * vec3(snoiseFractal(vec3((pos * distortionScale + temporalOffset))), snoiseFractal(vec3(pos.zxy * distortionScale - temporalOffset)), snoiseFractal(vec3(pos.yxz * distortionScale + temporalOffset)));
  1562:         }
> 1563:         for (float i = 0.0; i < [object Object].0; i ++) {
  1564:           vec3 sampleNorm = normalize(n + roughnessFactor * roughnessFactor * 2.0 * normalize(vec3(rand() - 0.5, rand() - 0.5, rand() - 0.5)) * pow(rand(), 0.33) + distortionNormal);
  1565:           transmissionR = getIBLVolumeRefraction(
  1566:             sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  1567:             pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness  + thickness_smear * (i + randomCoords) / float([object Object]),
  1568:             material.attenuationColor, material.attenuationDistance
  1569:           ).r;

I tried to solve this in the source code by changing all ${sample} to "6" but it did nothing, basically no error but mesh became black

1337jick avatar Mar 15 '23 18:03 1337jick