Results 1 to 2 of 2

Thread: Lighting/Shading

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Maidstone, Kent, UK


    Hi guys. I'm trying to get a diffuse light onto an object (looking over it so it's basically 2D), then save this to file, I have created a prediction algorithm to determine the exact position of the light source but it always goes off course after a while. The algorithm renders various test light positions and compares this (byte by byte) with the original image, ending up with a numeric difference between the images, selecting the closest point and testing within the particular segment represented by that point.
    So, how accurate is the lighting model employed in OpenGL? As some points further away from the original light source seem to score higher than those that are actually closer. Also, is there some way that I can make the light change more varied for various distances, so it light has a wider spectrum and light intensity degrades regularly?

    Thanks for any help. I'm very close to getting the same position as the source, but it just seems to deviate near the end.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2002
    San Diego, CA, USA

    Re: Lighting/Shading

    Open GL has a vertex lighting model. When you create a single large quad and light it with a light that is very close to the center, it will actually appear dark. Why? Because the light is at a steep angle from each vertex's normal. The standard OpenGL pipeline works better on tesselated objects. If you want a more accurate scene, subdivide the faces a lot. Also, if you write your own lighting in a vertex/fragment program, you will get accurate results without having to tesselate your surfaces.

Similar Threads

  1. Lighting/Shading artifacts
    By cluosh in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-18-2016, 04:22 AM
  2. Shading or lighting looks off on my teapot.
    By Wongderful in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-14-2015, 07:54 PM
  3. I need help with 3d shading/lighting
    By xman84 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-28-2010, 12:46 PM
  4. Shading and lighting
    By CoolRef in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 10-19-2010, 09:43 PM
  5. Lighting + Shading..
    By cutting_crew in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-10-2003, 08:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean