PnP TerrainCreator - Forum

The PnP TerrainCreator Forum
It is currently Mon Nov 20, 2017 1:19 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Light RA/Dec to light vector?
PostPosted: Tue Oct 18, 2011 10:59 am 
Offline

Joined: Tue Oct 18, 2011 10:55 am
Posts: 1
I can't seem to figure out the equation to convert the TerrainCreators light parameters RA and Dec into a unit vector. I've tried a number of different spherical equations but none of them are quite right. Can someone help me out and give the equation to convert RA and Dec into a light vector direction. Thanks!


Top
 Profile  
 
 Post subject: Re: Light RA/Dec to light vector?
PostPosted: Sun Nov 06, 2011 10:19 pm 
Offline
Programmierdochfix
User avatar

Joined: Tue Apr 27, 2004 12:53 pm
Posts: 892
Location: Braunschweig
Hi, the light direction vector is computed in the following way from the RA and Dec values:

Code:
D3DXMATRIX matRot1;
D3DXMatrixRotationZ(&matRot1,-this->m_fRA);

3DXVECTOR3 vecStart(0.f,1.f,0.f);
D3DXVECTOR3 vecTemp;
D3DXVec3TransformNormal(&vecTemp,&vecStart,&matRot1);

D3DXVECTOR3 vecDir;
D3DXMATRIX matRot2;
D3DXMatrixRotationX(&matRot2,this->m_fDec);
D3DXVec3TransformNormal(&vecDir,&vecTemp,&matRot2);

return vecDir;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron