Using shaders vs fixed pipline

Started by
6 comments, last by Yours3!f 11 years, 6 months ago
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
Advertisement
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).
thanks,
Although I see the advantage of having more features with shaders, to me it looks like they are a ton of work:
Currently I´m using lighting with the fixed pipeline and it works quite well. Of course one could improve it, but for me it works fine. But when I want to change something (like programming texture splatting) and I choose to use shaders, I have to reprogram the whole lighting again!
Is there anywhere anything like a "default shader" that can just be modified?

IF I have to program light and fog by myself again, I´d really prefer to focus on other issues rather than reimplementing existing features...
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
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.
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 Making a Terrain Generator

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.

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

This topic is closed to new replies.

Advertisement