   Strange Lighting  problem (per pixel glsl)
  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 strangeYou can check out a short video-clip: http://www.digitalwaste.org/clip-lighting-xvid.aviI 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.zipif 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   
  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.   ;Quote:Original post by eviltwigflipperThat 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;  ok, shadercode updated. Now it also compiles on my radeon (9800pro).The lighting problem is the same!feedback is welcome, i am realy lost hereb   ;  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.   ;Quote:Original post by EligFour 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