THREE-CustomShaderMaterial icon indicating copy to clipboard operation
THREE-CustomShaderMaterial copied to clipboard

Cannot use both csm_DiffuseColor and csm_FragColor in if/else

Open tresabhi opened this issue 1 year ago • 3 comments

When in opaque mode, my shader uses diffuse color to allow there to be lighting on the mesh. When not in opaque mode, my shader forms a neon overlay. But using both, even in an exclusive if/else statement, doesn't work. Heck, even commenting "// csm_FragColor" anywhere breaks the code.

uniform bool opaque;

void main() {
  if (opaque) {
    csm_DiffuseColor = vec4(1.0);
  else {
    csm_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
  }
}

tresabhi avatar Jan 10 '24 23:01 tresabhi