Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Problem with creating shadow volume

  1. #1
    Intern Newbie
    Join Date
    Jun 2004
    Posts
    34

    Problem with creating shadow volume

    Hi,

    currently I try to implement Stencil Shadow volumes. I have read a lot of articles about it and now I want to implement it myself. But the SV creating doesn`t work the way it should. The SV is created, but looks weird, e.g. has wholes. Here is my code:
    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">void CDepthPassSV::InsertEdge( unsigned int* pEdges, unsigned int& dwNumEdges, unsigned int v0, unsigned int v1 )
    {
    for(unsigned int i=0; i < dwNumEdges; i++)
    {
    if( ( pEdges[2*i+0] == v0 && pEdges[2*i+1] == v1 )

  2. #2
    Intern Newbie
    Join Date
    Jun 2004
    Posts
    34

    Re: Problem with creating shadow volume

    My posting is screwed up in some way
    So, this is the whole posting I wrote:

    Hi,

    currently I try to implement Stencil Shadow volumes. I have read a lot of articles about it and now I want to implement it myself. But the SV creating doesn`t work the way it should. The SV is created, but looks weird, e.g. has wholes. Here is my code:
    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">void CDepthPassSV::InsertEdge( unsigned int* pEdges, unsigned int& dwNumEdges, unsigned int v0, unsigned int v1 )
    {
    for(unsigned int i=0; i < dwNumEdges; i++)
    {
    if( ( pEdges[2*i+0] == v0 && pEdges[2*i+1] == v1 )

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jun 2003
    Location
    Virginia
    Posts
    212

    Re: Problem with creating shadow volume

    You can preview and edit your posts.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Oct 2002
    Location
    San Diego, CA, USA
    Posts
    209

    Re: Problem with creating shadow volume

    I think whats happening here is that you are trying to shadow using all of your edges. I really don't know, I just infer from what you are saying (and your code isn't quite useful, either)

    what you should do is find a set of "silhouette edges" ... only the edges that dictate your shadow's edge. The way you do this is by storing all edges with pointers to their associated faces. Calculate and find all edges which are connected to one face that's facing "towards the light" and one face that's facing "away from the light" ... Doing this is simple, just test the sign of the value returned by the dot product of the face's normal and the direction which the light is.

    Once you have these edges, you should only use these to generate your shadow. I also suggest you save off which faces are towards the light, which are away from the light in case you want to cap your shadow volumes.

    I suppose I have laid the problem bare for you without going into too much detail.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •