Results 1 to 7 of 7

Thread: shadows aren't showing up

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    shadows aren't showing up

    I've been trying to get some shadows to show up and I've been mimicking a program that works. My shadows are showing up at all and I've made sure I double checked the squish plane to be the ground . I noticed that not all of my polygons are wound ccw could this be a probelm. I don't know what I'm doing wrong the code is too confusing to post but if anybody has any common mistakes that beginners make I would appreciate it.

  2. #2
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    Oxford, England
    Posts
    472

    Re: shadows aren't showing up

    If you are projecting the polygons of the model onto the floor, make sure that if your model is drawn with back face culling on, set it to cull front faces when you draw the shadows. Secondly, if they are being drawn on to a surface that has already been drawn (ie, you've drawn a floor first and then the shadows are drawn on top, ensure that the depth test is set to GL_LEQUAL.

    glDepthFunc( GL_LEQUAL );

    if you are using shadow volumes, it may be the depth buffer or a problem with the stencil buffer.....

  3. #3
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: shadows aren't showing up

    Hey there.
    I had a similar problem.
    Ok firstly make tripely sure youre plane is correct, cos that screwed me around for two days, I'm embarrased to say . OK despite what he said above, cos he probably knows more than me, also I had to render my shadow first and then the object that casts it. Otherwise I got my shadow cast onto the object. Maybe thats youre problem...

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    Re: shadows aren't showing up

    Thanks for the help guys I tweaked my normals and wound all my polygons the right way. I used the info you gave me but I'm still not getting shadows but instead I'm getting a black line which is a definite improvement. I need to start reading up on buffers because it seems that the problem probably lies somewhere there. If you know why I'm getting a black line rather than a shadow I'm all ears. Thanks for the help guys.

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2000
    Posts
    19

    Re: shadows aren't showing up

    Have you looked into polygon offset?

  6. #6
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    Re: shadows aren't showing up

    I got my shadows to work finally. I had to render the shadows first while not disabling glDepthTest(); and then rendering the other objects. I also had to render the shadows slightly above the the ground plane in order for them not to look choppy. I was wondering if thats the cheap solution to the problem. Can you reneder shadows in the same exact plane as you render the ground? I'm not famaliar at all with polygon offset what is that?

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: shadows aren't showing up

    Yes, you can render two coincident, coplanar polygons, without getting z-fighting. One method is to use glPolygonOffset. That method merely adjusts the z value of the pixels before they are compared. It does not actually draw the polygon in a slightly raised position however. The offset is just for the testing purposes. Another method is to use the stencil buffer to mark where the ground plane(s) is(are) and to then draw the shadows with depth testing disabled, and stencil testing enabled so that the shadow is only drawn on the ground plane(s). It looks rather stupid however when a shadow appears to run under a wall rather than up a wall.

Similar Threads

  1. Replies: 2
    Last Post: 12-31-2017, 07:45 PM
  2. Objects aren't always drawn
    By Shelling in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-16-2008, 11:18 AM
  3. stencil shadows- edges aren't projected correctly
    By jcabeleira in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 07-29-2003, 04:45 PM
  4. TechDemo showing scene graph shadows
    By tooltech in forum OpenGL: Advanced Coding
    Replies: 18
    Last Post: 09-23-2002, 02:51 PM
  5. We aren't prepared for GOOD shadows!
    By santyhamer in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 01-13-2001, 03:35 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