Lighting up complex/multi-layered scenes

By default, Panda does not attempt to keep a model from shadowing itself. The caveat to this is that it does try to keep fragments/triangles from being their own occluder (and thus causing shadow acne) by rendering back faces instead of front faces. This thread goes more into shadows than you probably wanted to know. If you want to try using front faces for shadow casting, use this snippet from the linked forum thread:

light.setInitialState(a.getInitialState().removeAttrib(CullFaceAttrib))

CullFaceAttrib is from panda3d.core, however, I am not entirely sure what a is supposed to be in this case.

As for light baking, Panda doesn’t really do anything to help or hinder this. I believe the auto shader supports multiple UVs, which is the common way to do light maps. You’ll probably want to bake a lightmap in Blender and then tweak texture stages in code when loading the level (unless the correct information is already described in the EGG file). You’ll want your diffuse, etc using UV1 and your light map being multiplied against the fragment color result (don’t know if there is a way to tell the auto shader to do this) and using UV2.

1 Like