Jump to content

  • Log In with Google      Sign In   
  • Create Account


Using shaders vs fixed pipline


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 m41q   Members   -  Reputation: 151

Like
0Likes
Like

Posted 13 October 2012 - 09:51 AM

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

Sponsor:

#2 Yours3!f   Members   -  Reputation: 1299

Like
2Likes
Like

Posted 13 October 2012 - 10:33 AM

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).

Edited by Yours3!f, 13 October 2012 - 10:35 AM.


#3 m41q   Members   -  Reputation: 151

Like
0Likes
Like

Posted 13 October 2012 - 10:43 AM

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...

#4 Kaptein   Prime Members   -  Reputation: 2058

Like
2Likes
Like

Posted 13 October 2012 - 12:21 PM

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

#5 MarkS   Prime Members   -  Reputation: 882

Like
1Likes
Like

Posted 13 October 2012 - 12:38 PM

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.

#6 TheChubu   Crossbones+   -  Reputation: 4075

Like
1Likes
Like

Posted 13 October 2012 - 03:44 PM

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


#7 m41q   Members   -  Reputation: 151

Like
0Likes
Like

Posted 13 October 2012 - 04:49 PM

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 gameplayPosted Image

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

#8 Yours3!f   Members   -  Reputation: 1299

Like
1Likes
Like

Posted 14 October 2012 - 06:51 AM

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 gameplayPosted Image

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS