diff --git a/CHANGELOG.md b/CHANGELOG.md index dca28e0e6cd3133f9c6b8e38c89e7191bc995dc3..7ee24ef461f109d21b536ae66c26a0ae5768b03d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Note that since we don't clearly distinguish between a public and private interf - Fix ``allowTransparentBackfaces`` for per-group transparency - Fix ``FormatRegistry.isApplicable`` returning true for unregistered formats - Fix: handle building of ``GridLookup3D`` with zero cell size +- Fix ``ignoreLight`` for direct-volume rendering with webgl1 ## [v3.7.0] - 2022-04-13 diff --git a/src/mol-gl/shader/direct-volume.frag.ts b/src/mol-gl/shader/direct-volume.frag.ts index 02c5ba5a670f3003add96b6032b1cef58b7305e1..01e4039b3b0078abeb3c056283b5f2d8d5abe070 100644 --- a/src/mol-gl/shader/direct-volume.frag.ts +++ b/src/mol-gl/shader/direct-volume.frag.ts @@ -289,20 +289,24 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) { material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a); #endif - if (material.a >= 0.01) { - #ifdef dPackedGroup - // compute gradient by central differences - gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a; - gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a; - gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a; - #else - gradient = cell.xyz * 2.0 - 1.0; - #endif - vec3 normal = -normalize(normalMatrix * normalize(gradient)); - #include apply_light_color - } else { + #ifdef dIgnoreLight gl_FragColor.rgb = material.rgb; - } + #else + if (material.a >= 0.01) { + #ifdef dPackedGroup + // compute gradient by central differences + gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a; + gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a; + gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a; + #else + gradient = cell.xyz * 2.0 - 1.0; + #endif + vec3 normal = -normalize(normalMatrix * normalize(gradient)); + #include apply_light_color + } else { + gl_FragColor.rgb = material.rgb; + } + #endif gl_FragColor.a = material.a * uAlpha * uTransferScale;