PDA

View Full Version : gl_LightSource[0].position



jeickmann
02-08-2004, 12:52 PM
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

Corrail
02-08-2004, 02:58 PM
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).]

jeickmann
02-08-2004, 11:25 PM
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).]

dginsburg
02-09-2004, 06:22 AM
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)

jeickmann
02-09-2004, 06:30 AM
> 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).]

dginsburg
02-09-2004, 07:11 AM
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)

Marty666
02-09-2004, 12:09 PM
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

jeickmann
02-09-2004, 01:50 PM
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

Marty666
02-09-2004, 02:23 PM
Ok, thanx... Suddenly it works http://www.opengl.org/discussion_boards/ubb/smile.gif 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

Marty666
02-09-2004, 05:48 PM
Ok, I got it now... Thanx anyways for the help. My first shader works, per fragment lighting and my own dot3 bumpmapping http://www.opengl.org/discussion_boards/ubb/smile.gif

dginsburg
02-10-2004, 09:00 AM
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)

jeickmann
02-10-2004, 09:06 AM
Hey, thanks for the reply.
Always good to know what happens to your bug reports. You kind of develop a certain affection towards them :-)

Jan

PanzerSchreck
02-10-2004, 09:30 AM
Originally posted by dginsburg:
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)

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.

dginsburg
02-10-2004, 10:01 AM
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)