You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to achieve a specific effect on my mesh, where objects beyond a certain distance have full opacity, and those nearer to the viewer than the threshold have reduced opacity. So far, it seems like a straightforward task. I've created a new CustomShaderMaterial, based on the existing material of the mesh:
const material = new CustomShaderMaterial({
baseMaterial: child.material,
fragmentShader: `
void main() {
if (csm_FragColor[0] > 0.0) {
// Some operation
}
}
});
The issue arises when I try to access the csm_FragColor values (even without writing to them). Strangely, the mesh renders fully white. However, if I comment out or remove the if statement (or any other statement that accesses csm_FragColor), the rendering appears correct. Is this a bug, or am I overlooking something simple?
Thanks!
The text was updated successfully, but these errors were encountered:
This is a limitation of the library. Since we use simple string compare to determine if a keyword is used within a shader. If said keyword is used, it’s particular patch is injected
we make no distinction between assigning or accessing. We can’t without more complicated processing of the shader which would cause a performance hit
I’m working on a new version of the library where I may address it. But until then your best bet is to not use csm_FragColor but some other internal shader value
we are already tracking this issue on #48 so I will close this one. Feel free to leave more comments regardless
Hi!
I'm attempting to achieve a specific effect on my mesh, where objects beyond a certain distance have full opacity, and those nearer to the viewer than the threshold have reduced opacity. So far, it seems like a straightforward task. I've created a new
CustomShaderMaterial
, based on the existing material of the mesh:The issue arises when I try to access the
csm_FragColor
values (even without writing to them). Strangely, the mesh renders fully white. However, if I comment out or remove the if statement (or any other statement that accessescsm_FragColor
), the rendering appears correct. Is this a bug, or am I overlooking something simple?Thanks!
The text was updated successfully, but these errors were encountered: