Jump to content
  • Advertisement
Sign in to follow this  
_biobrain_

OpenGL GLSL: some information

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

Hi, I've a few questions about GLSL. I've downloaded the Shader Designer to try the example on www.lightouse3d.com; but my gfx card doesn't support the fragment shader (i've got a nvidia 4200TI) so, my first question is: can I use only a vertex shader (for example, to move my objects or to calculate volume shadows) and use the fixed pipeline to texturing and lighting? 2-I've understood that GLSL is independent from the video card. It's right? Can I develop a shader that works both on nVidia and Ati? 3-I've red a fragment shader that toke the lights attribute from the opengl code. It means that for lighting I've the limit of eight opengl's light? Hum...If I find other questions, I'll post immediatly :-) Thanks a lot! Bye!

Share this post


Link to post
Share on other sites
Advertisement
1) Yes. Just don't use any fragment shaders, and the fixed pixel pipeline will kick in. (Although the card you mention, the 4200 Ti, has fragment shaders.)

2) Yes, and no. For the most part, GLSL on NV will work on ATI and vice versa. Be warned, however, that the ATI compiler is much dumber than the nVidia one. It won't let a lot of things go that the NV compiler will. Also, it seems that NV supports a few functions that ATI doesn't.

3) You are not forced to take the lighting information from GL's light stuff, it's merely a convenience. That said, doing more than 4 lights or so at once is probably a bad idea. Nowadays people only render one light per pass.

Share this post


Link to post
Share on other sites
Quote:
Original post by _biobrain_
can I use only a vertex shader (for example, to move my objects or to calculate volume shadows) and use the fixed pipeline to texturing and lighting?

Yes. You can use only the vertex part and use texture_combiners/register_combiners/.. for the rest.

Quote:
Original post by _biobrain_
2-I've understood that GLSL is independent from the video card. It's right? Can I develop a shader that works both on nVidia and Ati?

Generally true. But be careful because some compilers are more strict than others.

Quote:
Original post by _biobrain_
3-I've red a fragment shader that toke the lights attribute from the opengl code. It means that for lighting I've the limit of eight opengl's light?

No. You can have as much light as you want. The only limit is the instruction count and number of parameters you can pass to it. (In real world scenarios you really won't need more than 4 lights per surface very often).

edit: beaten Promit.. I hate when this happens :)

Share this post


Link to post
Share on other sites
@Promit: well, I can use texture/register combiners...but are you talking about, for example, "nVidia register combiners"? Because I saw only example about nVidia card...can you tell me some informations about Ati's card?

One light per pass means that I render my scene with shadows, reflections etc for every lights, and at the end blend every pass together?

@_DarkWIng_: for the lights stuff...I'm right if, for every single mesh, I choose the four nearest lights and I use these for lighting?

rating++ for both!!! Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
2) Yes, and no. For the most part, GLSL on NV will work on ATI and vice versa. Be warned, however, that the ATI compiler is much dumber than the nVidia one. It won't let a lot of things go that the NV compiler will.

Thats the exact reason while NV's compiler is "dumber", Nvidia doesn't stick to the glSlang specs while ATI does. All those things that work on Nvidia's video card will not work on ATI's or 3Dlabs, etc. cause based on the specs, those are errors.

Share this post


Link to post
Share on other sites
Quote:
Original post by _biobrain_
@Promit: well, I can use texture/register combiners...but are you talking about, for example, "nVidia register combiners"? Because I saw only example about nVidia card...can you tell me some informations about Ati's card?

ATI has a simmilar thing as register combiners(RC) on nVidia. I belive it's called 'Fragment Shaders' (someone correct me if I'm wrong). They are basicly very simmilar but at times a bit more powerfull as RC.

Quote:
Original post by _biobrain_
I'm right if, for every single mesh, I choose the four nearest lights and I use these for lighting?

Yes, that is the most common approach. The other one is to use multipass and use all the lights in range. It's up to you do decite what to use.

Share this post


Link to post
Share on other sites
Quote:
Original post by Hulag
Thats the exact reason while NV's compiler is "dumber", Nvidia doesn't stick to the glSlang specs while ATI does.


When one compiler compiles float f = 1 + FloatVar; and one doesn't, I know which one is the better compiler, specs or not.

Anyway, _biobrain_, if this page includes your card, then you (should) have real fragment shaders, not just register combiners.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Anyway, _biobrain_, if this page includes your card, then you (should) have real fragment shaders, not just register combiners.

GF4 does not support fragment shaders (I have GF4 TI-4600). It supports GL_NV_texture_shader1/2/3 that offers addition programmability over RCs but writing TS is pure hell.

Share this post


Link to post
Share on other sites
The GF4 can do pixel shaders on the D3D side though (HLSL 1.4, if memory serves me right). So does it have ARB_fragment_program but not ARB_fragment_shader?

Share this post


Link to post
Share on other sites
Neither ARB_fragment_program or ARB_fragment_shader are exposed under openGL on GF4. You can get PS1.4 functionality trough combination of RCs and NV_texture_shader so I guess DX compiles down to this (saves you the hard work of writing the whole RC/TS thing).

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!