Jump to content
  • Advertisement
Sign in to follow this  
MegaPixel

help ! my point light is following the camera

This topic is 3072 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 guys,

I managed to implement a deferred renderer it works pretty well, but I've

noticed that as I move around with the camera the point light shading is

following the camera, or it's just my impression ... :|.

As I perform any lighting calculation in view space I need obviously for the

light position to be expressed in view space. Therefore I multiply it for the

viewMatrix.

This is a VIDEO showing the problem:

http://img594.imageshack.us/img594/6477/pointlightissue.mp4

Currently I transform the light like this:


//view space light position
D3DXVec3Transform(&VSLightPos,&(*itr)->getLightPos(),&pRenderer->getViewMatrix());



Thanks in advance for any hint :)


Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by My_Mind_Is_Going
Are you sure you're actually translating the light position, multiplying the view matrix by a vector with w=1?


Actually you got a point ! I'm quite sure that I'm multiplying the light pos as lightPos = (x,y,z,1). But maybe due the big number of changes I could have been missing that ...

I'll have a look and I'll let you know

Thanks a lot

Share this post


Link to post
Share on other sites
Quote:
Original post by MegaPixel
Quote:
Original post by My_Mind_Is_Going
Are you sure you're actually translating the light position, multiplying the view matrix by a vector with w=1?


Actually you got a point ! I'm quite sure that I'm multiplying the light pos as lightPos = (x,y,z,1). But maybe due the big number of changes I could have been missing that ...

I'll have a look and I'll let you know

Thanks a lot


Ok actually I wasn't doing multiplication with w = 1 but using just x,y,z. Therefore I changed with:


D3DXVec4Transform(&VSLightPos,&D3DXVECTOR4((*itr)->getLightPos().x(*itr)->getLightPos().y,(*itr)->getLightPos().z,1.f),&pRenderer->getViewMatrix());



but the problem is still there !!!

:((((

Share this post


Link to post
Share on other sites
Quote:
Original post by MegaPixel
Quote:
Original post by MegaPixel
Quote:
Original post by My_Mind_Is_Going
Are you sure you're actually translating the light position, multiplying the view matrix by a vector with w=1?


Actually you got a point ! I'm quite sure that I'm multiplying the light pos as lightPos = (x,y,z,1). But maybe due the big number of changes I could have been missing that ...

I'll have a look and I'll let you know

Thanks a lot


Ok actually I wasn't doing multiplication with w = 1 but using just x,y,z. Therefore I changed with:

*** Source Snippet Removed ***

but the problem is still there !!!

:((((


Pleaseeeeee I'm getting crazy :((( ... Everything seems to be fine to me: I recostruct the position in view space the light is transformed in view space, the normal is in view space !!! Infact I perform lighting in view space :D. However, the lighting seems to follow the camera as the camera moves.

this video is showing the problem:

http://img706.imageshack.us/img706/4306/lightingissue.mp4

Please, everything seems correct to me !!!








Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!