Lighting on tree leaves.

This probably has a really obvious answer, so I will post it in the beginners forum.

Picture a nightime simulation, with some 3D trees, not billboards. There is nearly 0 ambient light, but the user has a flashlight.

When he shines his light on the tree, and hits the leaves, some reflect back nicely. Others are very black, because they are turned over and they are facing the wrong way.

Is there a way to have the directional lighting not care about the sign of the normal?

I do care about the differences between straight on, and angled, so I don’t want everything to return as fully lit.

Thanks!

TriangleMan.

Hey TriangleMan,

I don’t know if this would mess up other stuff in your scene, but you could try turning on two-sided lighting and using the same material for the front and back faces of the leaves. Use GL_FRONT_AND_BACK instead of GL_FRONT_FACE when you set the material, and turn on two-sided lighting with:

glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);

There may be a more efficient solution to give you what you’re looking for, but give that a try.

-matt