Results 1 to 3 of 3

Thread: Shadowing. . .

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2003
    Location
    tyler, tx, usa
    Posts
    14

    Shadowing. . .

    What is the easiest way to put shadows into a program? What about making fog? Thanks!

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Dec 2002
    Location
    Espoo, Finland
    Posts
    599

    Re: Shadowing. . .

    Hi,

    Basic fog can be enabled with glEnable(GL_FOG) and adjusted with glFog* commands.

    Unfortunately there's no easy way to get shadows. Two algorithms are well suited for realtime purposes, stencil shadows and shadow maps (search). Both are about as easy to implement, but they both their own drawbacks, so which one you should choose depends on the application. There are also more limited algorithms, but personally I don't find them any easier than the "good" ones.

    -Ilkka

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    Vancouver, BC, Canada
    Posts
    118

    Re: Shadowing. . .

    Originally posted by Nelah:
    What is the easiest way to put shadows into a program? What about making fog? Thanks!
    To do basic fog you just enabled it, like enabling smooth shading. Very easy as others have said.

    Shadows.. OpenGL doesn't do shadows. At least not real shadows. As others have said there are basically two ways. Neither works correctly 100% of the time.

    Stencil shadows seem a bit more flexable, but are IMHO much more difficult to implement correctly for all cases. They fortunatly only require a stencil buffer to work (TNT era hardware had this)

    Shadows maps are IMHO much much much easier to implement. If your app already has a function to DrawScene() then shadow maps are super easy. You just call draw your object/scene to the shadow map and then draw your scene like normal, but with the shadow map applied.

    Both solutions involve you doing work to compute the shadow rather than letting OpenGL just turn shadows on.
    http://developer.nvidia.com/view.asp?IO=ogl_rtt_shadow http://developer.nvidia.com/view.asp?IO=Shadow_Map

Similar Threads

  1. Self-shadowing with stencils
    By gordon1 in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 06-16-2009, 04:08 AM
  2. preventing self-shadowing
    By Vexator in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 12-09-2006, 01:55 AM
  3. Shadowing Oddity...
    By NitroGL in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 11-04-2002, 12:00 PM
  4. geometric self-shadowing
    By Pentagram in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-12-2002, 01:29 AM
  5. Shadowing
    By tdavie in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-07-2000, 12:03 PM

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