When working on a custom ShaderMaterial, it happens that I need to have lights but no shadow-related uniforms. It's actually not possible because of this part of the code.
It's actually common (for me at least) to use lights without shadow maps / shadow related uniforms. As an example, I work on a medical framework that include pathtracing and I often mix rasterization / pathtracing together and both rasterization / pathtracing can just use the light path code as-is.
This was perfectly working before the addition of things like directionalLightShadows, because now if the shader doesn't use those uniforms, the uniform setter will crash here. But in general, I guess separting shadow related stuff could be great?
Did I miss something here, or could we consider a change to make using lights in custom shader easier?
Thanks!
Temporary Fix
In the meantime, an easy fix is to simply add the appropriate chunk in shaders and expose the shadow-related uniforms, even if unused.
Description of the problem
When working on a custom ShaderMaterial, it happens that I need to have lights but no shadow-related uniforms. It's actually not possible because of this part of the code.
It's actually common (for me at least) to use lights without shadow maps / shadow related uniforms. As an example, I work on a medical framework that include pathtracing and I often mix rasterization / pathtracing together and both rasterization / pathtracing can just use the light path code as-is.
This was perfectly working before the addition of things like
directionalLightShadows
, because now if the shader doesn't use those uniforms, the uniform setter will crash here. But in general, I guess separting shadow related stuff could be great?Did I miss something here, or could we consider a change to make using lights in custom shader easier?
Thanks!
Temporary Fix
In the meantime, an
easy
fix is to simply add the appropriate chunk in shaders and expose the shadow-related uniforms, even if unused.OS
Hardware Requirements (graphics card, VR Device, ...)
No requirement.