gl_LightSource[0].position

Hi,

I’m trying to implement some kind of simple lighting in a GLSL vertex shader.
Currently I’m using a directional light and I’m trying to get the L-Vector for the diffuse calculation like this:

vec3 lightDir = normalize(gl_LightSource[0].position.xyz)

The only problem is, this position doesn’t change if I rotate the scene, etc.
(I tried this by simple setting the vertex-color to that value)
The GL-Spec says, that the position gets stored after having been transformed by the modelview-matrix, so it should change when I rotate the view.
If I use fixed-function lighting, it works.
Has anybody else experienced this issue or can tell me what I’m doing wrong?
I’m using an ATI Radeon 9800 with Catalyst 4.1

Thanks,

Jan Eickmann

I had a similar problem. Seems like the ATI driver doesn’t multiply the light position with the modelview matrix if you are using GLslang.

[This message has been edited by Corrail (edited 02-08-2004).]

Thanks for the info. At least I’m happy that I didn’t do something stupid in my shader. Well for now, I’ll just have to pass it in as a uniform.

Jan

Btw: is there any list for the current limitations in the ATI driver concerning GLSL?

[This message has been edited by jeickmann (edited 02-09-2004).]

Hi there,

I believe the issue with gl_LightSource[n].position has been resolved and will be fixed in a future release. I will double check to make sure.

There is a list of known GLSL caveats that ATI maintains. Please contact ‘devrel@ati.com’ to receive it.

Thanks.

– Dan (ATI)

> There is a list of known GLSL caveats that ATI maintains. Please contact ‘devrel@ati.com’ to receive it.

Already did that last thursday, thank you. No answer yet, though. Thats why I was asking here.

Thanks for clearing it up though.

Jan

P.S: please don’t misunderstand this as being unpatient.

[This message has been edited by jeickmann (edited 02-09-2004).]

Hi Jan,

Thanks for your patience, I spoke with devrel and you should hear back today.

Also, I was incorrect, this issue has not been fixed. We will try to reproduce it. If you have a reproducer app, please send it to ‘devrel@ati.com’ as this will expediate the issue being fixed.

Thanks.

– Dan (ATI)

Hi all. I’m totally new to shading languages and i’d like to learn. I’ve seen some examples and this thread seemed to explain my problem. It doesn’t, but here it is anyways:

vec3 LightDir = normalize(gl_LightSource[0].position.xyz);
LightDir -= v;

I get the error :
gl_LightSource left of ‘[’ is not of type array, matrix or vector. Did i forget something? Please help…

Thanx,
Marty

what graphics card are you using? In 3dlabs drivers, gl-state based on arrays or structs is not yet supported. So you have to supply this info as a uniform.

If it’s an ATI, it “should” work. At least you shouldn’t get a compile error. As stated above, the implementation is buggy insofar, as that you have to manually multiply the light-pos with the modelviewmatrix.
I mailed a test-shader to ATI devrel, so hopefully, it will be fixed in the next driver release.

Regards,
Jan

Ok, thanx… Suddenly it works I downloaded the new ATI drivers (for my radeon 9600 xt, 256MB) and it works fine now. I get a link error when I use noise functions though. This is what i did:

vec4 SomeRandSeed = vec4(1,1,1,1);
vec4 MyNoise = noise4(SomeRandSeed);

Ow. I read some ‘tutorials’ but I still can’t find out how to use the uniforms. I can declare them in the shader, but how to I communicate from my application (in cpp)?

Thanx,
Marty

Ok, I got it now… Thanx anyways for the help. My first shader works, per fragment lighting and my own dot3 bumpmapping

Hi Jan,

I just wanted to follow up yet again. We reproduced the issue with gl_LightSource[n].position, and indeed the value being set was the object space position rather than the eye space.

We have a fix for the issue and it will show up in a future driver release.

Thanks.

– Dan (ATI)

Hey, thanks for the reply.
Always good to know what happens to your bug reports. You kind of develop a certain affection towards them :slight_smile:

Jan

Originally posted by dginsburg:
[b]Hi Jan,

I just wanted to follow up yet again. We reproduced the issue with gl_LightSource[n].position, and indeed the value being set was the object space position rather than the eye space.

We have a fix for the issue and it will show up in a future driver release.

Thanks.

– Dan (ATI)[/b]

Sorry to hijack that thread, but would it be possible to include a changelog concerning everything that has been changed/added in ATI’s glSlang-implementation in the release notes of newer drivers?
I was a bit disappointed when I downloaded Cat4.1 and nothing in that way was mentioned.

Hi Panzer,

ATI Devrel maintains a list of the large changes and caveats for each release. Please send an E-mail to ‘devrel@ati.com’ and request the GLSL caveats list to get it.

Thanks.

– Dan (ATI)

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.