Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Lighting on tree leaves.

  1. #1
    Intern Newbie
    Join Date
    Feb 2002
    Location
    Dallas, TX
    Posts
    33

    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.

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2004
    Posts
    4

    Re: Lighting on tree leaves.

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •