Lighting a scene - currently looks bad

My models aren’t great but I had hoped they’d looked better in the scene. They don’t look too bad in blender.

I’m thinking my lighting is not the best. I’m hoping someone has some ideas that would help me improve the overall look of my scene. Right now, there is ambient occlusion (which I don’t really understand…) and 1 ambient light and 2 directional lights and fog (maybe too much fog)

Basically, I’m working on a world generator. Here are two screen shots: zoomed out and in.


What I don’t like is you can’t really see the detail of the models…instead you see like the same color and the shape filled. There doesn’t appear to be all the lighting details that make objects appear 3D. This is my first 3D attempt so I do understand I’m not going to be able to make it perfect right off the bat but I’d like to improve some before I start making my hopping animals.

Hmm… I’m somewhat guessing here, but a few thoughts that I have are these:

First, have you tried rotating your directional light’s heading-value around through 180 degrees? It looks as though your directional light might perhaps be facing towards the player, leaving only the tops and shadowed sides of the objects visible.

In fact, perhaps it would help to see the code that you use to set up your lights, and a print-out of your camera’s HPR values in the view above.

Otherwise, perhaps the ambient occlusion effect is overwhelming things–what happens if you remove it?

My feel is the scene is lacking in shadows. Try rotating the directional lights so that the trees and grass cast a shadow. Maybe drop a cloud shadow map on the terrain to make it look interesting

Good video on the topic, with lots of aplicable tips:

Maybe the models don’t have vertex normals, somehow? It doesn’t actually look like the models have lighting applied, because I see no shading on the trees. Were they procedurally generated?

I thought that myself, if I recall correctly, but if you look very very carefully at the “steps” of the landscape you can see that the sides facing the viewer are slightly darker than the tops. This suggests to me that there is some lighting being applied–either that or the sides of the “steps” are given a different colour to the tops.

Thank you all for replying so quickly!! Still struggling with getting the scene to look more natural. I remove ambient occlusion and fog to make things easier to see…

I re-read the lighting docs and realized I had forgotten to include .setShaderAuto() on the render node. I also removed all lights and added back just 1 ambient and 1 point. Also, before, I hadn’t used .setShadowCaster(True…) on the light. Here is the code for those two lights.

    if self.sun is not None:
    if self.render.find("sun") is not None:
        self.sun = None
        self.sun_np = None

self.sun = PointLight('sun')
self.sun.setShadowCaster(True, 512, 512)
self.sun.setColor((.5, .5, .5, 1))
self.sun_np = self.render.attachNewNode(self.sun)
self.sun_np.setPos(0, 0, 30)

if self.a_sun is not None:
    if self.render.find("a_sun") is not None:
        self.a_sun = None
        self.a_sun_np = None

self.a_sun = AmbientLight('sun')
self.a_sun.setColor((.0025, .0025, .0025, 1))
self.a_sun_np = self.render.attachNewNode(self.a_sun)


Doing all this made it worse and better…I guess. Here are two pics, with camera heading printed to help.


I mean, there are shadows now…they look horrible haha but that’s progress. Is there a way to make softer or transparent shadows? These are so intense (refer to the 2nd image above).

Edit: It was asked above if the trees were generated, no they are models. Everything on the map are blender made models (the grid height and positioning is the procedural stuff)

Increasing the brightness of the ambient light, or adding a second non-shadowing directional light from the top or from the other direction, will help make the scene look brighter again and will make the shadows less pitch black.

1 Like

The above was advice that came to mind for me, too.

The shadows, and a close look at the trees, shows that they are now indeed lit–just from the side facing away from the camera. Thus all that we see is the darkened side.

I’d also suggest increasing the brightness of your “sun”–right now it has has a colour of (0.5, 0.5, 0.5, 1), meaning that it’s casing grey light, rather than bright white.

And finally, if you’re going to use a point-light what does the scene look like if you move the light’s x- and y- coordinates such that it’s positioned over the corner of the world closest to the camera? I’m thinking that this might increase the amount of the scene that presents its lit side to the camera, which might look better.


By the way, I think that the following line is unlikely to work:

    if self.render.find("a_sun") is not None:

From what I see in your code, “a_sun” is the name of the variable in which you’re keeping your ambient-light object. But “render” doesn’t know anything about your variable-names. Instead, it’s searching the names assigned to the nodes–and you’re assigning to your ambient-light node the name “sun” (as opposed to “a_sun”).

Thank you all!

I was able to get something good enough to continue on my project. I re-did some of the models which had really low value colors making them dark in-game. Also I looked here at some great advice.

I also changed my ground tiles to not be so sharp and added some bevel to the tops which helped the shadows look a bit better.

1 Like

Keep in mind that you can set your light colours to a value brighter than (1, 1, 1, 1) to compensate for dark material colours.

I’d also suggest increasing the brightness of your “sun”–right now it has has a colour of (0.5, 0.5, 0.5, 1), meaning that it’s casing grey light, rather than bright white.

I get what you mean, but this is a bit of an inaccurate way to word it. There’s no such thing as a “grey” light as much as there is no such thing as a “brown” light; it’s still white light, just less bright. Light colours are not “colours” in the same way as the thing you apply to a material; whereas a material colour is limited to a range of 0 - 1 (where 1 is “reflect all light”), a light’s colour value represents a brightness that is not limited to such a range.

Hmm… I would disagree: All colour is light, after all, just a matter of what wavelengths are primarily involved. The colour “grey” is always just “somewhere between full white and nothing at all”.

(And brown is very much not white. :P)

The fact that the system can represent intensities of colour greater than 1 doesn’t mean that the values in question aren’t colours.

In general, it would be nice to add a setting to the panda 3d post-gamma correction. Something like color balance, like in games.

@serega-kkz This is supported, see CommonFilters.setGammaAdjust:

However, it should not be used to fix bad lighting or bad material values in a scene.


Well, I meant as part of the base. Therefore, before determining whether the color of the model is dark or the lighting is insufficient. It’s a good idea to pre-adjust the color correction for the screen.