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

Using shaders vs fixed pipline

Started by GameDev.net Oct 13, 2012 at 3:51 PM 6 replies 3k views
Original Post
GameDev.net
GameDev.net
Hey,

when I wanted to implement texture splatting for the terrain in my game, I found a post, wich suggested using shaders.
Since I had nearly no experience with shaders until then, I thought it would be nice to learn more about them.
I implemented a simple shader and noticed that the lighting wasn´t there anymore. It looks like one has to program lighting, fog and all that stuff again oneself in the new shader. Is that true?

It would be nice if I just could change the texturing for example and leave the lighting as it is in the standard pipeline.

The only thing I want to do is a nice transition between two or three textures. I know it is possible to do this with the fixed pipeline as well, but I also heard about shaders being much faster doing this. Can I use shaders AND the functionality of the default fixed pipeline or do I have to either do it without shaders or program this functionality myself?

thanks in advance
Yours3!f
Yours3!f
for each object you need to choose between rendering by shaders or fixed pipeline.
for example you can use shaders for the terrain, but render everything else using the fixed pipeline.
however shaders give you much greater flexibility, and new features (because of programmability).
generally it is only advisable to use fixed pipeline when the given hardware (and driver) can't handle shaders.

and yes, you need to reimplement the fixed function pipeline in the shaders if you want those effects (ie. lighting).
Kaptein
Kaptein
actually, once you know how to use shaders, it's the fixed pipeline that's more work
but, i would just make a decision and stick with it
if you are going to work on your project for a long(er) time, then start using shaders right now
you'll get stuck on things for a while, and at some point you'll just "get it", and suddenly fixed pipeline isn't so good anymore =)
i know i did.. i did lots of funny things in my shaders.. now it's all good
if you stick a #version 130 tag on top of your shader, you can use both new and old shader terminology to get you started,
and if you have nvidia card it will force itself to compile using GLSL rules and not mix in Cg, so its almost guaranteed to work on ATI
MarkS_
MarkS_
Shaders *ARE* more work. However, that isn't a bad thing, necessarily. Even if you are doing some really cool effect with a shader, 90% of the shader code will be the same as any other shader. Write some lighting, texturing, shadow and other shaders and then copy and paste as needed. No point is retyping.
TheChubu
TheChubu
Embrace shaders. Be the master of your own lighting.
"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"   My journals: dustArtemis ECS framework and 
Yours3!f
Yours3!f

ok, thanks for all the replies.
I actually am working on the project for a pretty long time now, but switching still may be worth it.
So I decided to learn more about shaders and program two or three and probably I will stick with them.
"Master of my own lighting" sounds very good, but I´d rather like to focus on features for the gameplaywink.png

Even if I don´t use it in this project in the end, I hope it at least will be worth the experience.


here's a cg implementation of the whole OpenGL fixed function pipeline. Cg is very similar to GLSL so you should have no problem porting it after you learned a bit of GLSL.
http://www.codesampler.com/source/ogl_cg_fixed_function.zip

Topic Locked

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

Sign in to reply to this topic.