Results 1 to 4 of 4

Thread: Lighting

  1. #1
    Member Newbie
    Join Date
    Oct 2012
    Posts
    32

    Lighting

    Hi

    I've had a search on the forum for this but I can't find the answer. I would like to create a light source that only lights items near by so it fades out really quickly. I thought this was possible. I have read this

    http://glprogramming.com/red/chapter05.html

    My plan was to have a 180 degree spot light, set it to be at a specific position then use attenuation.

    The attenuation has a formula

    1/ (GL_CONSTANT_ATTENUATION + (distance*GL_LINEAR_ATTENUATION) + (distance^2*GL_QUADRATIC_ATTENUATION))

    Does anyone have any good values for these 3 such that you have a bright center and then a rapid tail off brightness (like what a candle would do in real life)

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Lighting

    Using legacy GL vertex lights like that is not ideal because it is much more constrained compared to GLSL per fragment lighting.

    Make sure you use a highly tesselated "ground" to check the attenuation, to avoid pitfal 2. Poor Tessellation Hurts Lighting.

    Then the idea about attenuation is to forget about quadratic and constant, and just play with linear. Less realistic in theory, but much easier to control and in practice more realistic as it will simulate some gamma correction.

  3. #3
    Member Newbie
    Join Date
    Oct 2012
    Posts
    32

    Re: Lighting

    Thanks, I've played around but there isn't really a good setting that I can find, the room I have have has so little variation in light its not distinguishable. Can you recommend any good places to find out GLSL information on how to get some good lighting effects?

  4. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674

    Re: Lighting

    Can you recommend any good places to find out GLSL information on how to get some good lighting effects?
    Well yes, but you're not going to be able to just drop it into your existing code. It's intended as an in-depth tutorial, not a copy-and-paste annex.

Similar Threads

  1. How to introduce Specular and Diffuse lighting into Bumped lighting
    By Liable in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 12-06-2004, 05:48 PM
  2. Lighting problem (opengl + shader lighting)
    By ox1d_47 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-19-2004, 09:43 PM
  3. debug lighting vs release lighting
    By haust in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-30-2003, 10:43 AM
  4. lighting back facing triangles _without_ using two sided lighting
    By Nicolas Lelong in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 02-07-2003, 03:05 AM
  5. About lighting (not OpenGL lighting, but general lighting)
    By Anonymous Coward in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-04-2001, 09:10 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