I’m trying to create a scene with an environment, some objects and a rotating camera.
What I’m trying to get is:
One PointLight within an object (a glowing Sphere, ‘jack’)
Some Directional lights lighting little of the remaining objects
Is my first question possible?
Can it illuminate objects, let’s say, from 0 to 50 or 100 pixels/inches/meters away from it?
Do I have to add a AmbientLight? (cause without it it isn’t working at the moment)
Last but not Least: How do I create something like a dark light in the sky (a darkblue color sphere or something far far away but still shining upon the scene and its objects)?
If anyone can answer on or more of these questions That would be really kind.
All the best
You should look at the code in the lighting tutorial in the samples folder. That would be a lot more help than what I would post here. To answer your questions:
Yes it is possible to create a pointlight within an object. But be aware that since the pointlight is inside the sphere and (I assume) the normals are facing outward, the pointlight wont light the sphere itself, but will still light other objects around it. The directional light will light the sphere that contains the pointlight.
You can adjust the attenuation of the PointLight with setAttenuation(). This sets the falloff of the lighting in terms of a constant, a linear, and a quadratic term. look at http://panda3d.org/manual/epydoc/public/pandac.PointLight.PointLight-class.html
for the PointLight class. You will have to experiment with this to get the right effect for yourself.
No ambient light is necessarily needed for lighting effects.
If your dark light is really far far away (like the moon) you might want to just use a directional light instead of a pointlight, and point it such that it looks as though it coming from the source.
Again I strongly suggest you look at the lighting tutorial because it covers all of these questions and shows you exactly how to do this kind of stuff.