PDA

View Full Version : Polygon's winding, and sil' edges winding



okapota
02-15-2002, 02:18 AM
hi there,
i still have a problem with sil' edges.
i have a mesh with all faces CCW. i have closed my volumes. i sort all of the sil' edges so they have the same winding. but now i have just one problem - if the first sil' edge has CW winding, all the others will also. and then the shadow volume's sides will be reveresed.
PH told me that if my polys will have the same winding i wont have to sort the edges, but i dont see how is it possibile. i mean, two adjacent polys with the same winding will have reversed adjecent edge. you see what i mean?
so i think im missing some thing here, because on all presentaions or apps i have seen this problem doesnt exists. so how do you know if your sil edges have the correct winding?

PH
02-15-2002, 02:33 AM
Use the edge from the front-facing triangles ( with respect to the light source ). This is your AB edge and extend(AB) = A'B'. So all silhouette quads can be created from BAA'B'

okapota
02-15-2002, 03:49 AM
yes, this is clear. but for that i need to first go over all polygons, and check if they are front facing or not, and i should put the connectivity data inside the polygons, and not in an edge list.
right now i have a list of edges, each has two normals, then i build a list of edges from the first list to be my sil edges.
i guess its not the way.

PH
02-16-2002, 02:27 AM
If you don't loop over your triangles then you can't close the shadow volume - you'll need to know which triangles to use for the caps. Besides, it's a lot more CPU work to use the edges.

You already said that you were using convex polyhedra ( brushes in Quake ), so you could easily calculate the relationship between the number of edges, vertices and faces using V - E + F = 2 ( Euler's Formula ).
Consider a simple box, it has twice as many edges as faces, a pyramid has 8 edges but only 5 faces and so on.

okapota
02-16-2002, 06:39 AM
thanks, its sort of working now. at least for cubes. for cylinders it produces cracked shadows, ill fix it.