GLSL: some information

Started by
12 comments, last by _the_phantom_ 18 years, 10 months ago
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!
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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 :)
You should never let your fears become the boundaries of your dreams.
@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!
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.
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.
You should never let your fears become the boundaries of your dreams.
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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.
You should never let your fears become the boundaries of your dreams.
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?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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).
You should never let your fears become the boundaries of your dreams.

This topic is closed to new replies.

Advertisement