Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I found that the vertex shaders are sometimes very useful, especially because they can generate geometries and extract and use a lot of informations from just 1 image.

The problem is that my project still isn't that big and looking to bigger project or just to commercial games, seems like the vertex shaders are rarely used.

Am I wrong or the pixel shaders are much more used than the vertex shaders?

This has something to do with performance issues and compatibility issues? What about some possible bottleneck like the memory controller/CPU ?

share|improve this question
3  
I'm not sure if you're understanding the difference between fragment and vertex shaders. They are used for different things. So one being used much more than the other doesn't imply anything about the usefulness of the other. –  Byte56 Aug 9 '12 at 18:30
    
@Byte56 no, the point is about what should i adopt for future uses, the fact that the vertex shaders are useful is not a doubt for me, even more, since i understand their usefullness i don't get why they aren't used that much. I want to discuss possible performance issues rather than if they are useful or not. –  user827992 Aug 9 '12 at 18:33
2  
Vertex shaders can't generate geometry. Geometry shaders can, but that comes with a cost. –  Laurent Couvidou Aug 9 '12 at 18:35
1  
They aren't used as much because they serve a different purpose, not because of performance. And if you're doing a side by side comparison of some effect that can be implemented either on vertex or pixel shader (such as texture scrolling) then the vertex shader will actually be faster because it's executed far less times (per vertex vs per pixel). –  David Gouveia Aug 9 '12 at 18:39

1 Answer 1

up vote 9 down vote accepted

This seems like a big misunderstanding on your part, and I think the comparison doesn't make much sense because in general they serve different purposes:

  • Vertex shaders are executed once for every vertex in the geometry, and are used to modify or add new information to those vertices. For example, they can be used to slightly modify the position of the vertex, or calculate a light value for that vertex.

  • Pixel shaders on the other hand are executed once for every pixel/fragment that covers that geometry, and are used to determine what the final color for that fragment should be.

It might be true that pixel shaders are used a lot more than vertex shaders, but that's because there are a lot of effects that require that extra control over the color of each fragment that are only possible with pixel shaders, e.g. things such as bump mapping, or any full screen post processing effect. Vertex shaders have different uses, and are used mostly for other types of effects such as creating waves in the ocean, and other types of distortions.

As for your performance question, if you can implement the exact same effect, with same visual quality either on vertex shader or pixel shader, then I think the vertex shader version will probably be a lot faster, because the number of vertices will usually (always?) be a lot smaller than the number of pixels covered by the primitive.

share|improve this answer
    
your answer is really interesting, but the problem is that probably i misunderstood the difference between vertex shaders and geometry shaders, and in reality, i was writing and thinking about the geometry one. I probably should open another Question ... sorry for that, but at least i have understood the difference with your post, thank you. –  user827992 Aug 9 '12 at 18:41
2  
In high-end games on iOS devices, I often had to balance calculations between vertex shaders and fragment shaders. Vertex shaders are run once per vertex, and fragment shaders are once per fragment which passes a depth test. On devices with low resolution displays (iPhone3, etc), it was often faster to put the calculations on the fragments, since if you were clever about sorting your draw operations, high-triangle-count objects would often have fewer visible pixels than vertices. (Of course, that would then hurt performance on retina devices, where there were heaps more pixels to draw) –  Trevor Powell Aug 10 '12 at 0:11
    
@TrevorPowell Thanks for the input, I figured there might be some edge cases like that but couldn't think of a real scenario :) –  David Gouveia Aug 10 '12 at 10:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.