Vertex shaders, how does it work?

Started by
1 comment, last by ThunderMusic_80 18 years, 6 months ago
Hi, I know I shouldn't go into this, and anyway, my graphic card doesn't seem to support it, but I want to know how vertex shaders work. I heard they can only process 1 vertex at a time and doesn't care for the others, in fact doesn't know about the others. So How can this make sense? I've heard it is THE solution for damage simulation in a car racing simulation, but how can it simulate damages on a model when it doesn't know about the surrounding vertices positions? I don't want to get into all the details of the vertex shaders, I know it's a complex concept, but I want to know if what I heard about it is true and how it works for what I've heard. In fact, what is missing from what I've heard for everything to make sense? lol Thanks
ThunderMusic
Advertisement
Wikipedia has an entry on pixel and vertex shaders which should be an adequate general-purpose backgrounder for you.

Vertex shaders can apply a deformation to a mesh (imagine for this example you have a car door made up of many polygons connected by vertices). You don't necessarily need to know the positions of the surrounding vertices to do this as the renderer knows about those -- all you care about is how that particular vertex is deformed (i.e. how deep it is indented from its normal position on the hood).

When you run the shader, you would do some kind of lookup on where the dents are (this information would be stored in your game engine somewhere and updated when a new dent is created due to a collision) and then, based on that information of how deeply a particular vertex is dented, apply it to the mesh using the shader.

Imagine an analogue to a heightmap in that regard.
thanks a lot for the link, it will help... ;) and your answer help a lot too. It clears things up a little bit. ;)

thanks
ThunderMusic

This topic is closed to new replies.

Advertisement