PDA

View Full Version : Shaders: where to start?



avocados
07-12-2005, 07:45 PM
I don't know if I should go with cG or the OpenGL shader language. Or if I should hold off on the shaders for a bit. I'm assuming they both have the same hardware requirements, can a geForce4 run these ok? Specifically, I'm interested in rendering terrain with some texture blending. Is this going to be faster on my older card using multitexturing or a 3d texture than a shading language?

wizzo
07-12-2005, 10:22 PM
Or if I should hold off on the shaders for a bit. I don't think so =)
seriously, shaders are VERY interesting to develop, just go for it

GLSL won't run on on gf4 (geforce fx and radeon 9500 are requiered).
As far as I know, cg will most certainly run on this hardware, because cg compiler convert and adapt your code to your hardware. It means your shaders will use register combiners on old nvidia hardware.

Considering performances, it wont be faster than multitexturing or 3d texture, especially on rather old hardware. In a general way, don't use shaders to reproduce existing features, as the fixed pipeline is higly optimised, performance wont be beaten with shaders, most of the time

hope it helped
wizzo

kingjosh
07-13-2005, 08:40 AM
You may want to do a combination of both. While Cg (http://en.wikipedia.org/wiki/Cg_programming_language) runs on older hardware, it is proprietary in nature and vendor controlled. GLSL (http://en.wikipedia.org/wiki/GLSL) needs newer hardware, but is fully portable across platforms and allows the developer to use the shader(s) on any hardware providing a compliant implementation.

Korval
07-13-2005, 10:04 AM
More importantly, running Cg fragment shaders on old hardware (GeForce 4 and prior) is not easy. You can't just write any old shader and expect it to work. Effectively, you have to live within the restrictions of the hardware: register combiners & texture shaders. You have to code using special intrinsics that call texture shader routines, and use only the math operations that register combiners support.

In short, it's a pain. And it's probably not worthwhile to bother.

avocados
07-13-2005, 03:52 PM
Thanks, that's a lot of help. I'd love to start on shaders now but it is important to me to use a standard, platform-independant, non-proprietary language with lower system requirements. I'll skip shaders on my first little game, I do have a lot I want to learn in the meantime.