Shaders

Started by
1 comment, last by MJP 13 years, 1 month ago
So im making a simple game. I will use shaders for things like the particle system. But when else is a good time to use them? The first time i used shaders was a university project and i didnt have a lot of time when doing the project so I didnt learn them as properly as i should have. Using this as a chance to do them properly.

They can be used for loading in models right? I cant find much on google about that though can anyone help out there, or point out a good site tutorial or something?
What about Lighting? Im not planning on doing anything fancy with the lighting. as part of some of the weapon effects there might be some flashes, would it be good to have per pixel lighting then?

Cheers
Advertisement
I will use shaders for things like the particle system. But when else is a good time to use them?
The correct question is: when to not use them?
Answer: when the target machine does not support them.
Which probably means 'never', as I'm fairly sure Shader Model 2 is commodity on at least 80% of all machines out there. I don't know anybody not having at least Shader Model 2 compliant systems.
But don't take my word for it: here's Unity hardware statistics and Steam hardware survey.

SM2 is already quite flexible. I suggest you to not use FFP at all. The shader-based model is just cleaner, requires you to remember less things about the render states and such. If you design your shading system to work well in your context, it will also turn out somewhat easy.

They can be used for loading in models right?
No, I don't know any connection about that. Models will use them just as they used "material settings" previously but in general, I don't see how a shader can help you load an asset.
In some specific situations, it would be possible to use a shader to do unpack/decompress work, but I don't think you won't need this any time soon.


I cant find much on google about that though can anyone help out there, or point out a good site tutorial or something?
I suggest NVSDK 9.x, it comes with a lot of example shaders. For the theory, MSDN or your GL extension of choice. Most sites I've checked cut the corners here and there so I'm not going to suggest any.


What about Lighting? Im not planning on doing anything fancy with the lighting. as part of some of the weapon effects there might be some flashes, would it be good to have per pixel lighting then?
Sure, shaders buy you a lot of flexibility here, as long as you understand the theory of tangent-space and vector space transforms.
Keep in mind that lighting is fairly compilcated, there are a few well-known lighting models, some ad-hoc ones and each lighting model can appear very different according to parameters or corollary features. I suggest you to stay simply lambertian+dot3 for a while.

Previously "Krohm"

This is a pretty good reference if you're looking to learn the basic mechanics of lighting, and how to implement them in shaders.

This topic is closed to new replies.

Advertisement