# Stencil shadows - generating sihouette edges from strips problem

This topic is 4849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey, I have a small problem when generating silhouette edges from indexed tri strips, this is how I do it (pseudo) :
num_faces = num_indices-2; // after first tri every index is one tri
int old = 0

for (i<num_faces)
{
// tris go 0, 1, 2... 1, 2, 3... 2, 3, 4
v1index = indices[old]
v2index = indices[old+1]
v3index = indices[old+2]
old++;

// compute normal
...

if (nomral.dot(light)>=0)
{
}
}

What's the problem here?

##### Share on other sites
Hello..

For the edge siluette you do not want every edge where thenormal is >= 0..
You want to find the edge between the part of the model that is facing towards the light and the part that is facing from the light.

That is, find the dges where on one side the normal points from the light and on the other side it points towards the light.

There should be a ready-made algorithm for thise somewhere, and if not it shouldn't be to hard to make.

Good luck!

##### Share on other sites
Thanks for replying, but I don't think that's the problem in there, because it works just fine with tri lists. :)

Oh.. and note that I'm skipping degenerated faces.

Not sure what the problem might be, it could be when I add the edges... maybe. :)

##### Share on other sites
I solved the problem, I forgot to do the swapping... :=)

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633698
• Total Posts
3013412
×