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 6 of 6

Thread: Lightmap generation

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2000
    Posts
    13

    Lightmap generation

    I've just added lightmapping to my engine but
    lightmaps does not look perfect because I cant get my lumel lighting equation to work.Can anyone help?(I have position of lumel in worldspace, it's normal, distance to pointlight and light's radiur).

  2. #2
    Intern Newbie
    Join Date
    Dec 2000
    Location
    Istanbul/Turkiye
    Posts
    36

    Re: Lightmap generation

    Can you give more details about "not perfect"?
    Cem UZUNLAR
    cemuzunlar at 3tegames.com

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2000
    Posts
    13

    Re: Lightmap generation

    Well, faces with lightmaps look nice but some of them are black even if distance to the light source is shorter than light radius. I use this equation:
    Brightness = (1 - 1 / LightRadius * Distance ) * (cosAngle-0.5).

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    Re: Lightmap generation

    Here is mine:

    Brightness=MIN (cos Angle*2.5 , 1 - 1.3 * Distance / Radius )

    I'm also searching a better one

    Y.

  5. #5
    Guest

    Re: Lightmap generation

    Isn't the light intensity just the dot of
    the face normal and the normalized direction
    to the light, divided by the square of the
    distance to the light? At least, I believe
    that's how physics works in general.

    Then you apply the light function (i e
    color, specular, etc).

    I e if the point is P and the light is L and
    the point normal is N, you'd get brightness
    like this:

    B = fL( N . Norm( L - P ) / ( | L - P | ** 2) )

    (B = brightness, fL == light function).

    Note that fL should probably return the
    ambient value for negative arguments (i e
    things facing away from the light).

    Oh, and this argument to fL simplifies
    reasonably well when you start writing it out
    as coordinate operations. Especially the
    | L - P | ** 2 part :-)

  6. #6
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    Re: Lightmap generation

    Just copy the OpenGL lighting model and it'll look good.
    brightness = (1 / (c + d * length + e * length^2)) * dot(norm(L-P),Vertex_Normal);

    where c,d,e are arbitrary constants.

Posting Permissions

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