Recently I’ve been working a little more on lights, and I have a problem with shadow casting. I know that I can get shadows working with the models I’m using, because this works:
But for reasons unknown to me, this does not:
These are the settings I’m using for the second light (see bottom right corner of the picture for the values):
There seem to be something wrong with the second light, but it might not be with the settings. When the game is rendering the light and the shadow caster for the light is enabled, this assertion suddenly starts failing a lot: !mat.is_nan(), line 292 of transformState.I.
mat.is_nan() error usually means that one of the models or lights has an invalid transformations somewhere, most commonly a scale component set to 0.
Other things that may make it not show any shadows: (1) the model is not rendered by the shadow casting light for some reason - enable base.bufferViewer.toggleEnable() to see if it is rendered into the depth buffer. Depending on your near/far settings, it may show up only very faintly. (2) the floor (or one of its ancestors) doesn’t have setShaderAuto() called on it.
If you can’t figure it out, use writeBamFile() on your scene (including the lights) and upload the resulting .bam file so that others can take a look at it.
Alright !
mat.is_nan kinda make sense to me, though it appears I haven’t been able to chase down everything that turned out to have a scale value set to zero (I generate colliders from a model’s geometry, and some of them have no depth, so it ends up with a z-scale of 0).
I suppose calling set_shader_auto is a good way of making sure it’s set on all the nodepathes ? I did that, but there’s no visible difference.
I also can’t use both Panda3D and Python. Is there another way of getting the bufferView thing effects in a C+±only environment ?
I’ve made a bam from my scene: it should be downloadable from this link as a bam generated by Panda 1.9.0 (I haven’t checked if it was retro-compatible with 1.8.1 ?). webcloud6.zaclys.com/public.php … c15621c0fe
The textures aren’t there though. Would it be easier to check it out if I added them ?