Skip to main content
GameDev.net gamedev.net
🔒 Locked

Text based shaders vs. hardware

Started by FOrceX Apr 19, 2001 at 1:27 AM 1 replies 300+ views
Original Post
FOrceX
FOrceX
Is it true that text based shaders like those used in Q3 can now be implemented in hardware through pixel and vertex shaders? I mean, how would you do it? Would you keep the binary shader file around instead of a text one and then directly load that onto your card when you need it? Im just curious as i dont want to spend valuable time creating an entire text-based shader infrastructure. Or should i anyway just for ''fun'' and because i have old hardware like TNT2 that cannot do hardware shader effects at all?
Danack
Danack
quote:
Original post by FOrceX
Is it true that text based shaders like those used in Q3 can now be implemented in hardware through pixel and vertex shaders?



The pixel and vertex shaders are different to the shaders used in Q3. The shaders scripts in Q3 were used to set up textures, lighting and blending options (i''m pretty sure). The pixel and vertex shaders are different things entirely as they are in effect small fuctions....

quote:

Would you keep the binary shader file around instead of a text one and then directly load that onto your card when you need it?



There are two ways of using pixel and vertex shaders. You can create static shaders from text files using NvAsm to generate a static binary script, which you can then load onto the card through DirectX/OpenGL.
The other way is to create the shaders within your game from text strings, which can be done dynamically. The easiest way to see this working is to get the NvEffectsBrowser and look at the NvLink sample. This allows you to dynamically generate different shaders with a number of options ( different lights / using textures etc ).

The NvLink has been made fast enough to be used in games, I think its supposed to generate something like 20,000 shaders per second. Obviously you would cache the shaders you''re using in game and would only generate new ones.

This seemed like a pretty weird idea to me when I first heard, of it....as i would have thought that you should know which shaders you need before running your game, but one of the nVidia guys explained that the reason for needing it is that you could easily have so many combinations of rendering that it would be irritating having to create all of the possibilities before hand. For example if you wanted to add a special power-up that makes things shiny, having to go back and redo all the shaders again would be really irritating...

What you''re meant to do if the shader you want to generate is to big to fit onto the card I don''t know.

quote:

Im just curious as i dont want to spend valuable time creating an entire text-based shader infrastructure.



You should look at the NvEffectsBrowser ( particularly the NvLink one ) and then decide....though I guess you''re really talking about a whole rendering infrastructure rather than a pixel/vertex shader handling infrastructure, and you will still need that.

cheers
dan




Game production:
Good, quick, cheap: Choose two.
Game production:Good, quick, cheap: Choose two.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.