Stenciled Shadows
Hi I have been looking through a bunch of tutorials on how to do Stenciled Volume Shadows. However I am completely confused (well not exactly) but maybe if I could someone figure out how to adapt it to me needs it might make some more sence. So basically from all of the tutorials I have read the shadow is rendered as a quad. However the models that I have loaded store all of its data as a triangular face. So how could I make the example code work for my needs.
I have been looking primarily at these two tortorials (the only ones that I can remember the links to):
http://www.3ddrome.com/articles/shadowvolumes.php and
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=27
Your help would be greatly appriciated!
A quad? Now that's what I call wishful thinking. The whole thing is fairly complicated, but you're not restricted to quads. It's just that when you extrude an edge you get a quad. You can render it as 2 triangles no problem, you just have to set the indices up appropriately.
By the way, you're looking at things the wrong way. You ask "how could I make the example code work for my needs?", which tells me that you're hoping to pretty much copy and paste from a tutorial. I'm actually glad it's not working for you. The more complicated things you attempt, the more you find that you can't just rip someone elses work. What you should be trying to do is understand the concept, so you can write your own code. Sure, it's harder, but if you can learn to do things on your own by tackling them one small step at a time, you'll be a much better programmer in no time. And you'll be able to do things for which there is no tutorial.
By the way, you're looking at things the wrong way. You ask "how could I make the example code work for my needs?", which tells me that you're hoping to pretty much copy and paste from a tutorial. I'm actually glad it's not working for you. The more complicated things you attempt, the more you find that you can't just rip someone elses work. What you should be trying to do is understand the concept, so you can write your own code. Sure, it's harder, but if you can learn to do things on your own by tackling them one small step at a time, you'll be a much better programmer in no time. And you'll be able to do things for which there is no tutorial.
What I mean is that I want to re-write it but I have no idea where to start because I have no idea how to turn 2 triangles into 1 quad. So even if I was planning on just copying the code it would not work. I do not want to copy the code. However I have read a few articles on stenciling and understand the basic principlies (or atleast I think I do) and how to create shadows, but as I said before it requires a quad.
So I am not sure how I would go about creating a quad from 2 triangles or more. I do not understand how to do this. Sorry if I mis-fraised my question as I know see I did (by saying I was just planning on copying code). This is the part that really has me confused. So pretty much my object structure contains:
A Vertex List
And a Faces List which then contains contains an array of three verticies.
Now I guess I also have another question after reading a lot more up on shadows. Would brute forcing (using every face) to project a shadow be the best way to create one. I beleive that it would be because you still need to give each vertex right. Correct me if im wrong.
So I am not sure how I would go about creating a quad from 2 triangles or more. I do not understand how to do this. Sorry if I mis-fraised my question as I know see I did (by saying I was just planning on copying code). This is the part that really has me confused. So pretty much my object structure contains:
A Vertex List
And a Faces List which then contains contains an array of three verticies.
Now I guess I also have another question after reading a lot more up on shadows. Would brute forcing (using every face) to project a shadow be the best way to create one. I beleive that it would be because you still need to give each vertex right. Correct me if im wrong.
You need to work out the vertices that will actually effect the shape of the shadow. Using every single vertex for a model with 8/10/20 vertices will be fine but when you start using proper models you'll get massive FPS loss.
This is currently the problem I'm struggling with myself, can't find a decent algorithm to sort this one out.
Anyway, sorry I couldn't help more. Keep us informed if you find a good way.
This is currently the problem I'm struggling with myself, can't find a decent algorithm to sort this one out.
Anyway, sorry I couldn't help more. Keep us informed if you find a good way.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement