Results 1 to 3 of 3

Thread: Simulating sun light

  1. #1
    Member Newbie
    Join Date
    Aug 2003
    Posts
    38

    Simulating sun light

    I'd like to simulate some sun light in my 3d scene.
    I'm putting the light position in one of my defined 3d space corners,but I still get the ambient lighting effect.
    How can create one direction light effect?
    From some books what I understand is - that for this I must use diffuse light.
    In OpenGL gl/glu libraries I found only
    ambient lighting module.

  2. #2
    Guest

    Re: Simulating sun light

    To properly represent something like the sun, you'll want to place the light at infinity. Take a look at the documentation for light position parameters - you'll want to set the fourth parameter to 0 to set the light at infinity, but remember to disable attenuation.

    Anyway, removing ambient lighting. Obviously you'll need to set the ambient component of any lights you use to black, but the trick is that there's a global ambient component totally seperate from the GL_LIGHTx lights, and it has a non-zero default. Take a look at glLightModel with respect to GL_LIGHT_MODEL_AMBIENT:
    http://tc1.chemie.uni-bielefeld.de/d...ightModel.html

  3. #3
    Guest

    Re: Simulating sun light

    Addendum: And yes, you'll need to use diffuse lighting. It's set in basically the same way as ambient. Take a look at the docs for glLight:
    http://tc1.chemie.uni-bielefeld.de/d...e/glLight.html

Similar Threads

  1. how to simulating a dozen lights
    By zydgyy in forum OpenGL: User Software
    Replies: 1
    Last Post: 12-15-2011, 02:05 AM
  2. simulating a cubemap
    By Vexator in forum OpenGL: GLSL
    Replies: 6
    Last Post: 05-14-2007, 07:10 PM
  3. Simulating CLAMP_TO_BORDER with 1.2
    By loicm in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-07-2006, 11:10 AM
  4. Simulating key pressing, is that possible?
    By Filipe Xavier in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-05-2004, 09:54 AM
  5. simulating smoke...
    By krawa chan in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 06-08-2001, 02:24 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