Another light problem

Hello there! Huh, this is my third post within two days… I’m a real noob.
Well, the problem is that I have light and it works fine, except there is no light on the surface of the Sun. It is the light source, so it would make sense for it to be shiny, right?
So, the manual says:
“Note that, unlike a real, physical light bulb, the light objects are not themselves directly visible. Although you can’t see a Panda light itself, you can see the effect it has on the geometry around it. If you want to make a light visible, one simple trick is to load a simple model (like a sphere) and parent it directly to the light itself.”
I have done that. No effect.


class MyApp(ShowBase):
    def __init__(self):
        names = ['mercury', 'venus', 'terra', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune']
        bg = loader.loadModel("models/plane.egg")
        bg.setPos(0, 10000, 0)
        tex = loader.loadTexture("models/stars.jpg")
        bg.setTexture(tex, 1)
        Sol = loader.loadModel("models/Sun.bam")
        texture = loader.loadTexture("models/8k_sun.jpg")
        t = TextureStage("stage1")
        plight = PointLight('plight')
        plnp = render.attachNewNode(plight)
        plnp.setPos(0, 0, 0)
        alight = AmbientLight('alight')
        alight.setColor((0.2, 0.2, 0.2, 1))
        al = render.attachNewNode(alight)
        Sol.setTexture(t, texture, 1)

Inside the Sun:


I know, there is light on the outside Sun, but this is just AmbientLight.
Can somebody please help me about this?

It looks like the PointLight might be inside the star. Is that what you want? For the light to show up on the “inside” of the sun, you likely have a double-sided model as well, which can cause light issues.

Your AmbientLight is set to a somewhat low value of 0.2 . You could set it to (1, 1, 1, 1) for greater brightness.

Yes, it is inside the star, but where else could I possibly place it?
I want shadows, this is why the AmbientLight is set to such low value.

Since the entire sun is ostensibly glowing, why not disable lighting on the sun (via “setLightOff”)? That way the sun will render at full “brightness” regardless of lighting, and thus appear to “glow”.

1 Like

Thank you! It works now!

1 Like

I should add that the trick of disabling lighting is fine for an LDR lighting pipeline but may not be adequate for an HDR pipeline, since things are not limited to a brightness of “1.0” there. To make an object appear bright while being unaffected by lighting, you need to apply a material with a diffuse/specular color of 0, but an emissive color with the desired brightness. You can apply any texture as an emission texture.