Archived

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

okonomiyaki

How often do you use vertex/pixel shaders?

Recommended Posts

okonomiyaki    548
I''m just advancing into the next stage of advanced graphic programming, having learned vertex and pixel shaders. Now I went to write my actual program and I was surprised at how confused I was on when to actually use the powerful shaders. Since I discovered how powerful both vertex and pixel shaders were, I almost want to abandon the fixed function pipeline altogether and use my own shaders for everything. Is this bad? Would I be re-inventing the wheel and wasting time? For example, I was going to texture the ground in my landscape. Should I write my own ground vertex shader that passes information to my own ground pixel shader so that I could get as detailed as possible, possibly try a little bump mapping if it weren''t too slow, or should I stretch a large texture over the land and multitexture with smaller tiles with the fixed function pipeline? Can you really go so much farther with programmed shaders or am I belittling the fixed function pipeline?

Share this post


Link to post
Share on other sites
Drilian    1067
I use them quite a bit, but there are some instances when a simple multitexture will do the job just as nicely (And with much less work) than a shader.

In my current project, almost everything uses shaders. As a matter of fact, I think I'm ALWAYS using vertex shaders. But there are a few places that I don't use pixel shaders. I don't use pixel shaders for the fonts in-game, or for shadow volumes (since nothing gets drawn to the screen for the shadow volumes anyway).

Hope that helps,

Josh

[edited by - Drilian on October 20, 2002 5:06:17 PM]

Share this post


Link to post
Share on other sites
Drath    138
I am using CG, a vertex/pixel shading language by nvidia at developer.nvidia.com. It is in the style C and really makes life a good deal simpler. It also has a runtime compiler that makes shaders easier toperfect for all you need to do is tweak them, save, then execute your program.

Share this post


Link to post
Share on other sites
JovialPeon    122
if you want to take full advantage of the hardware, you should only use your own shaders (providing your min spec will allow). the fixed function pipe does a lot of extra stuff that you don''t nessesarily need on every vertex. it is best (but more time consuming) to write a different shader for all the effects you require. one with two lights, one with four lights, etc. also, in advanced shader methods, you can pack your matrices into the constant registers and do all of your skinning in the shader (which means you will want a skinned shader and unskinned for static geometry. which is two shaders for every effect you desire.).

the reason why the fixed is slower is because it does everything - optionally. for example, there can be up to eight lights on one vertex. but what if you only have two lights effecting that vert? in the fixed pipe, it still has to do the calculations for eight. the result is the same as with two, but almost four times slower. the more familiar you get with shaders, the more sense this will make.

hope that helps,
-tim

Share this post


Link to post
Share on other sites
DrunkenHyena    805
There aren''t a lot of video cards on the market that support pixel shaders. Vertex shaders are pretty safe since they can be done in software fairly quickly. If you''re okay with targetting the high-end hardware then that''s fine. Just remember that it''s a small minority compared to the potential market.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
eldee    122
hrm.. and if you choose to do the bumpmapping route, dont just
make a B&W version of your texture as the specular map. ever
since those screenshots of doom3 came out, everybody and their
brother is trying to get it in their game. unfortunately a small
percentage is doing it right.
worst one i''ve seen so far was a model of some biker dude..
he had a tatoo across his chest, and since the author used B&W
textures as his specular map, the tatoo was indented.
looked like it was stamped in his chest.



-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
okonomiyaki    548
Thanks a lot for the tips guys.. I understand how programmed shaders would be faster (because it''s written specifically for the effect).
As for the hardware support, I really don''t care that much right now that many people can''t support pixel shaders. I think that by the time I make anything useful pixel shaders will become a standard. This is because it is going to be a long time before I make anything really useful, possibly 4 years. I think that''s definitely long enough for pixel shaders to become available to most people.
And if not, then I''ll optimize it for the people without pixel shaders, it just won''t look nearly as good.
I think that I am going to use my own vertex shaders for everything, but stay away from pixel shaders only because I don''t know them well enough. If I think an effect would be greatly intensified with a pixel shader, I may try it but the impression I got was that pixel shaders don''t need to be written for everything as much as vertex shaders.
Thanks again guys, see you later

Share this post


Link to post
Share on other sites