[SOLVED] Lights problem: dark parts of the models

I set up plenty of PointLights around my models, but for whatever reason one side of the models remains completely dark.

Let’s say I position a model at (0,0). Then I place 9 LightPoints all around the models, so every side is fully lit. Doesn’t work. One side is not lit and there are shadows indicating that the light only comes from one direction.

EDIT: Hm, perhaps the problem is the following: I set up lights in the centre of my map and this area works well. Then I’m trying to setup lights a bit to the side from the centre and for whatever reason the centre lights are predominant and the side building is lit only from the lights coming from the centre. For whatever reason the lights set up at the side are considered of lesser importance by the engine.

Does it work like that? How should I do it, so it works right?

I don’t think my code is wrong, but anyhow here it is:

        self.mRGB = 0.35
        plight = PointLight('plight')
        plight.setColor(Vec4(self.mRGB, self.mRGB, self.mRGB, 1))
        plnp = render.attachNewNode(plight)
        plnp.setPos(self.centrX, self.centrY, self.centrupZ)

What’s wrong? What do I miss?

How would you recommend to setup lights in a correct way in Panda?

So far I export my models without lights. I thought to add lights in Panda. Can I/should I export the models with lights from Max?

Most hardware have a limit on lights, if you’re not using deferred lighting then maybe the problem is that only 4 or 5 lights lit the model?

If you want all the sides of the model fully lit then maybe try a ambient light?

Ha, that might be it. How can I determine what’s the limit? How can I use deffered lights to overcome this limit?

FYI, I used 10 LightPoints in the centre of my map and another 10 at the side. As I said, the side lights don’t work or work in a weird way. The centre works correctly.

I use ambient light, but the effect is somewhat weak. To be honest, I don’t see the effect of the ambient light. Could that be that I placed the ambient light at the end and, as an effect, it gets kicked out of the limit?

EDIT: Yes, it seems so. When I place the ambient light at the top of my code, it works well. Alright, so I can only use a very limited number of lights due to this limit? Not even 20 lights? It doesn’t make sense.

Actually, you’re usually limited to 8 lights per object. It’s not a limitation coming from Panda, the hardware just won’t display more. If you need more lights, you have to use lightmapping (only static lights) or deferred shading (dynamic lights). Or both, if you want indirect lighting.

Most games that don’t use deferred shading usually use at most 2 dynamic lights per object (with at most one casting shadows), and most of the scene is lit by static lightmaps (usually normal mapped and generated using radiosity). That’s how Unreal Engine 3, Source and idTech5 games work. The more complex (in the shaders department) solution is deferred shading, used in GTA4 and Stalker, among others. The most complex approach is the one used in Battlefield 3, which kind of combines those methods.

OK, thanks. Apart from using ambient light, I’ll group the models and use the lighting more efficiently (per object group). Together with the use of lightmapping and -maybe- shading at a later stage.