• Advertisement
Sign in to follow this  

Strange Lighting problem (per pixel glsl)

This topic is 4427 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 have a realy weird problem with my glsl based lighting. When i test the shaders in Rendermonkey or the Typhoonlabs Tool, everything seems to be fine. But as soon as i add the Lighting Code to our engine, Lighting seems to go crazy. Somehow it seems like the LightSource rotates as soon as i rotate the camera view. Realy strange You can check out a short video-clip: http://www.digitalwaste.org/clip-lighting-xvid.avi I have also put together a small test-project (vs.net/c++) to reproduce the effect. Its a bsp-renderer from gametutorials with a shader unit. The test-project code was not written by me, but it produces the same effect as our engine because our bsp-renderer is based on this code. http://www.digitalwaste.org/sample.zip if you have a few mins, please take a look at it. This is realy bugging me and i need some hints what could be wrong (normals, some rotations i am not aware of ..) thanks alot, b

Share this post


Link to post
Share on other sites
Advertisement
That pixel shader in that demo compiles with errors.

Can you post the shader your using? If its exactlly in that demo the pixel shader doesn't compile.

Share this post


Link to post
Share on other sites
Quote:
Original post by eviltwigflipper
That pixel shader in that demo compiles with errors.

Can you post the shader your using? If its exactlly in that demo the pixel shader doesn't compile.


strange, it works in my nvidia card. are you using ati hardware ? i will check it again.

i think there is a problem with my camera

Share this post


Link to post
Share on other sites
ok, shadercode updated. Now it also compiles on my radeon (9800pro).
The lighting problem is the same!

feedback is welcome, i am realy lost here

b

Share this post


Link to post
Share on other sites
Four words: Render Lights Before Camera.

The thing is, when setting the light position to a vector, that vector does not get transformed by the modelview matrix/etc. upon input. Meaning that, you're world can be rotated in any direction, however your light is still at a location relative to the camera. If you input before, the light is rotated correctly.

Share this post


Link to post
Share on other sites
Quote:
Original post by Elig
Four words: Render Lights Before Camera.

The thing is, when setting the light position to a vector, that vector does not get transformed by the modelview matrix/etc. upon input. Meaning that, you're world can be rotated in any direction, however your light is still at a location relative to the camera. If you input before, the light is rotated correctly.



cool, i will try that out tonight. sorry for the late reply - have internet problems at the moment.

b

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement