p3d_LightSourceParameters has no member that indicates light type, and also none to indicate whether it throws shadows
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Panda3D |
New
|
Undecided
|
Unassigned |
Bug Description
(Disclaimer: I'm not very good with shaders, so maybe I just missed an obvious way to do this)
p3d_LightSource
I tried to create shadowless point lights first and then shadow-throwing spot lights, but as soon as I use setShadowCaster
Therefore, it would be neat if the struct had a type member and a shadow casting enabled/disabled member.
FWIW, the following can be used to check light type:
* position.w will be 0 for directional lights.
* spotCosCutoff will be -1 for non-spotlights.
* spotExponent will be 0 for non-spotlights.
Please note that if you have a custom configuration of lights, you can always use those explicitly using setShaderInput( "mylight" , light) and then access those via a p3d_LightSource Parameters input called "mylight" rather than p3d_LightSource[n].
In the future, rather than add a light type checker, we need to separate out p3d_LightSource into separate arrays for point, directional and spot lights. At very least point lights need to be separate, since they use a different type of shadow sampler.
I'm not sure how useful it would be to check whether a light has shadows enabled in the shader. It wouldn't solve any problems for you since you would still get an error and I doubt it would save you much performance. I would rather let Panda automatically bind a 1x1 pixel dummy shadow map for lights that cast no shadows.