Jump to content
  • Advertisement
Sign in to follow this  
Toji

Judgement day has come! (Choosing a shader lang)

This topic is 4887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I feel like my little pet project engine has gotten to the point where I want to seriously start integrating shaders into it. I've been toying around with simple effects for a while, and have become reasonably familiar with both CG and GLSL, but I haven't really used them for anything serious as of yet. So... I'd like to know everyone's opinons of the current state of the High Level Shading Languages avalible. What you've used, why you like one or the other, and what problems you've had with either. I know that a while back support for either was iffy at best, but I hope that's improved considerably. Not trying to start any flame wars here, I just want educated opinions. [Edited by - Toji on June 1, 2005 10:05:54 PM]

Share this post


Link to post
Share on other sites
Advertisement
I for one believe that high level shading languages are still pretty far from being robust and reliable enough to be introduced to application targeting the big crowd.

I had my share of headaches and bitterness about some shaders that I wrote and which would run on a set of hardware while excluding some other, heck even the same hardware but with different drivers could give you a nightmare.

For the problems aforementioned, I for one decided to stick with ARB programs instead as I'm almost guaranteed to have them work pretty much everywhere given the right extensions.

Just my $0.02

Share this post


Link to post
Share on other sites
I think this is what you'll hear from other people. GLSL's implementations are so... inconsistent, that untill it gets some help it probably wont be the best option. GLSL though, in my opinion, is the prettiest language, I like how it interfaces with the main program. CG on the other hand, has an interface that I dont like quite as much. Additionally, its completely incapable of using branching on any non-nvidia card (in OpenGL)(as far as i know, if im wrong, PLEASE correct me :-))

hope that helps/hope i didnt give out any horribly wrong information regarding cg as im new to it (driven away from GLSL)
-Dan

Share this post


Link to post
Share on other sites
The OpenGL Shading Language is the future.
The ARB interface will slowly lag more and more behind as there are no plans to update it (it already lacks the ability to branch and loop the SM3.0 cards can perform).

Cg can perform branching and looping, however it must use NV extension or GLSL as the backend to achieve this.

The GLSL compilers are indeed a tad immature, this is true, however they have only been in existance for less than two years and arent the only thing being worked on. However I would say for the most part they are now alot more stable on Win32 platforms, not perfect and maybe not as fast has hand produced code in some instances (however how much of that is down to the compiler and how much is down to the programmer being 'clever' and making life harder for the compiler is another matter) but its certainly getting there. Linux and OSX drivers might be a different matter, I dont know [smile]

I use GLSL myself, I've had no problems with it but I've not really pushed it all that much. It does have some issues so I wont pretend its perfect, but frankly if you are just starting to learn shaders its probably the best way to learn as its alot simpler than Cg in some respects and intergrated more tightly with OpenGL and as I opened with, it is the future.

Share this post


Link to post
Share on other sites
I was just wondering how is it possible to do Per-pixel lighting/other effects on GF3 cards if you do not have branching/looping on it? Most of the GLSL tutorials seem to use if's, loops(uniforms) alot. How do people achieve all those lighting effects on todays games which run on GF3 hardware?

Share this post


Link to post
Share on other sites
I'd imagine through the ARB interfaces. That said, I think conditionals in shaders are kinda abused. You can certainly to per-pixel lighting without a single if or for, as it's really nothing more than calculating the brightnesss of the pixel based on the angle from it to the light. (Oversimplification, but hey.)

In any case, I think I'm leaning towards GLSL simply because, as phantom said, it's the future of shading with openGL. nVidia sounds like they're not very interested in supporting cg in the future, so why support a dying language? In the meantime, though, I think I'll implement every thing through ARB shaders, then make an interface for GLSL avalibe for such a time when it becomes stable enough for regular use.

I'd still love any other opinions, though!

Share this post


Link to post
Share on other sites
Quote:
I was just wondering how is it possible to do Per-pixel lighting/other effects on GF3 cards if you do not have branching/looping on it? Most of the GLSL tutorials seem to use if's, loops(uniforms) alot. How do people achieve all those lighting effects on todays games which run on GF3 hardware

in my game i use ~200 glsl shaders,
in none of the 200 do i use an if statement or any loops
perpixel lighting doesnt need conditionals to work?
then again glsl doesnt work on gf3 u will need register combiners on that hardware

Share this post


Link to post
Share on other sites
I myself use cg, but I would recomend GLSL, it will be future of gl shading. I've not used it recently but from what I hear things have really gotten better from the year + ago when I last tried it.

The only real bonus to using cg over GLSL is it supports geforce 3 and 4 cards IMO.

Share this post


Link to post
Share on other sites
Quote:
Original post by JavaCoolDude
God!!! I can only imagine the compile and load times of those 200 shaders
/shudder


I can't imagine he'd be using them all at once... (And if so I'm so, so sorry)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!