[Solved]Large scale illumination

I have a very large scale scene, and had set up a simple point light to illuminate.

The problem is only a certain range of radius was lit. So is there any other way to change the point light’s intensity, or some similar attribute like that?

The reason why I use point light is it can have the effect of attenuation, which can express the layer of the scene. Because right now I’m still focusing on the gameplay, so don’t wanna spend too much time on lighting.

Any ideas?

You can set the attenuation of a PointLight using the setAttenuation() method. See the API documentation for a bit more about this.


I read the API doc but still didn’t get it. According to an article I found on the forum you wrote before:

# attenuation coefficients will causes the light to drop off gradually with distance. 
# There are three attenuation coefficients: A, B, C, 
# where the net attentuation is defined by A + Bd + Cd^2. 
# (So if you want a light dropoff proportional to the square of the distance, 
# as real lights do, use something like (0, 0, 1) .) 
# pointLight.setAttenuation(Point3(A, B, C)) 

so if I set:

attenuation = Point3(0,0,10000)

My question is: what’s the “d”? Is it the “distance”? It would be calculated automatically by Panda from the light to the model, or there’s a way to put into the actual value?

I really tried hard but my scene was always in the same black… :frowning:

Attenuation is the rate at which the light fades. Higher levels of attenuation will fade faster (get dark sooner); lower levels will fade slower (stay bright longer).

d is the distance from the light to each vertex.

If you want to make your light brighter, try something like (0, 0, 0.01). If you don’t care about d, put your attenuation parameter in the first parameter, which doesn’t involve d, e.g. (1, 0, 0). If you want to make your light never attenuate at all, try (0, 0, 0).

Note that there are other things that may make your scene black, particularly when you have only one point light providing light for the whole scene. In particular, you should make sure that at least some of the normals are facing towards your point light.


Thanks for the fast reply!
I think my model’s normals are good~
Now I’ll do a little bit trial and see what’s going on~

Now the light works pretty well.
However there is a new problem… I’ll make a new thread and discuss about it.