Archived

This topic is now archived and is closed to further replies.

Stencil shadows, 4 point Tile based terrain.

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok here is my terrain the map has so many tiles each tile has 3 heights. kinda like a height map but it has straight vertical cliffs. ok so any way the problem is generateing the sileoettes for the shadows. right now they are all generated PRE tile so each time has its own shadow. sounds nice. but its over kill even if the tile don''t ever show a shadow. it is still drawn and added in to the whole shadow, no graphically this looks PERFECT but the speed is lacking. Could any one help me out on with Eliminateing shadows that don''t need to be draw because they will show no shadow to begin with. or perhapes any other way to enhance the speed of stencil shadows. my method follows-
draw terrain with textures
Stencil Enable  
Stencil inc
draw shadows
stencil dec
draw shadows backfacing
stecil =
Draw blened quad over screeen
disable stencil
 
note the system work perfectly, I just need to speed it up becauase its way to slow. Thanks.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Run a silouhette finder on your tiles from the point of view of the light, to generate your shadow volume. The algorithm you post is fine; the problem is in the actual shadow volume you hand to it.

Share this post


Link to post
Share on other sites
This is what I thought, I just posted that to be sure.

The silleote finder I have right now, is VERY BAD. it is per tile, and for the most part is pretty much impossilbe to use, it takes my fps from 140 to 40, I need a way of geting rid of useless shadows or not finding them in the first place.

thanks.

[edited by - Xero-X2 on June 3, 2003 1:22:07 AM]

Share this post


Link to post
Share on other sites
The general way of reducing the number of shadow volumes you're rendering is the edge test. First, make a list (array or linked list) of all the edges in the "heightmap" you have. Then, when rendering, run through each edge, and see if is an occluder edge, ie. one of it's polygons is lit, the other is in shadow. Save the ID of this edge, and then all you'll need to do is run through the saved edges, and make your occluder volumes from those. However, this method requires that your "heightmap" be a convex hull, ie. a brush, like a box, cylinder or cone, but something which is closed. You can do this by adding sides and a bottom to your "heightmap"...



Coding Stuff ->  [ iNsAn1tY Games | DarkVertex | How To Do CSG | Direct3D Vs. OpenGL | Google ]
Fun Stuff    ->  [ Evil T-Shirts | Stick-Based Comedy | You're Already Here | The Best Film Reviews ]


[edited by - iNsAn1tY on June 3, 2003 7:40:07 AM]

Share this post


Link to post
Share on other sites
I think I have seen a similar method to this one before.

just a few thoughts

If I added a method to check to see if an edge only has one owner. AKA has no neighbor such as the bottom wouldn''t they ALWAYS cast a shadow? and this would mean I would have to compile my "Heightmap" into a triangle mesh correct?

Share this post


Link to post
Share on other sites
Yes, you would need to make your heightmap into a triangle mesh. However, this isn''t too difficult, and the savings you''d make in terms of shadowing and framerate might be substantial. You could load your heightmap, and with some fast code, create the triangle mesh from the heightmap dyncamically...



Coding Stuff ->  [ iNsAn1tY Games | DarkVertex | How To Do CSG | Direct3D Vs. OpenGL | Google ]
Fun Stuff    ->  [ Evil T-Shirts | Stick-Based Comedy | You''re Already Here | The Best Film Reviews ]

Share this post


Link to post
Share on other sites
I tried this out, I got pretty good results

but I had some bad results as well,

1. My terrarin type, allowed T junctions to form between polygons.

2. There where many problems including not showing of any shadows when the terrarin was smoothly connected,

3. There was a few other problems that I did not fix. but the idea did work, but unfortunatly due to a bad design on my part eariler on, the terrarin system has far to many issues.

Thank you very much.

[edited by - Xero-X2 on June 8, 2003 2:17:05 PM]

Share this post


Link to post
Share on other sites