Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Khaos Dragon

pixel shaders

This topic is 5240 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

I am now at the point where I want to make a decent looking sky for my world and I have heard pixel shaders are a useful tool for doing this. However my first concern, is that pixel shaders will make my 100% portable code extremely hardware dependent and only work with a few select graphics cards. Secondly I am wondering what I should learn. Cg seems to be the most popular but I have heard that it has trouble with ATI cards. Meanwhile I have heard that glslang and hsdl are fairly good as well.

Share this post


Link to post
Share on other sites
Advertisement
Going to put this in point form as I dont have time to type it out fully:

* Pixel shaders (fragment programs) are not needed for a decent looking sky. Infact, a great looking sky can be done without them quite easily. Look at the sky in Unreal (the first one).. even today its still a very nice looking sky.

* Pixel shaders wont magically make things look good. It can take quite a bit of work to get the effect youre after.

* Pixel shaders should work fine so long as the underlying hardware supports them. All new hardware being released supports them, back from the GFFX and R300 cards.

* Cg optimizes for nVidia hardware, and doesnt run as optimally on ATi hardware. The compiler is open source though, so you could change this.

* GLSlang implementations are still being worked on, they are available for use but arent 100% complete, and current hardware doesnt support the spec 100%. As a bonus though, the GLSlang compiler is in your gfx card driver, and it will compile more optimally to the underlying hardware.

* HLSL is for DX, not OpenGL.. but the syntax is essentially the same as Cg.

Share this post


Link to post
Share on other sites
Cg works fine on my Radeon 9600 pro. But GLSL is more advanced and is the primary high-level shading language for OpenGL. Recent drivers have good support for GLSL, so it is what I recommend you to learn.



"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites
quote:
Original post by Khaos Dragon
However my first concern, is that pixel shaders will make my 100% portable code extremely hardware dependent and only work with a few select graphics cards.

The ideal solution to this is multiple rendering paths in your game. So you''d have one for GeForce2 cards, one for the latest Radeon and so on. Then you use the appropriate one for the hardware its running on. However obviously this means you''ve got a lot of different renderers to write, and sometimes you''ll find different pieces of hardware are not that much different for what you''re doing.

Instead a good solution is to pick several hardware/extension ranges. So you might have a GeForce 3&4 level renderer, one using the latest glslang for really new cards, and a base OpenGL1.1 renderer for everything else.

As long as you''ve got your base 1.1 renderer you don''t have to worry about it not working, the trick then is to make enough renderers that the graphics card matches as close as possible to the renderer being used.

Share this post


Link to post
Share on other sites

  • 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!