Skip to main content
gamedev.net
🔒 Locked

Environment mapping...

Started by zXynK Aug 29, 2008 at 3:33 PM 5 replies 950+ views
Original Post
zXynK
zXynK
Hello, I apologise if this question has been posted before.. I'm having some trouble with my environment mapping, specifically the "taking photos" bit. I'm struggling working out the vectors to create the cube texture. Here is what i have so far...

    vLookDir = D3DXVECTOR3( vTempLookAt.x + 1.0f, vTempLookAt.y, vTempLookAt.z );
    vUpDir = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
    D3DXMatrixLookAtLH( &g_amCubeMapViewAdjust[0], vEyePt, &vLookDir, &vUpDir );


    vLookDir = D3DXVECTOR3( vTempLookAt.x - 1.0f, vTempLookAt.y, vTempLookAt.z );
    vUpDir = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
    D3DXMatrixLookAtLH( &g_amCubeMapViewAdjust[1], vEyePt, &vLookDir, &vUpDir );


    vLookDir = D3DXVECTOR3( vTempLookAt.x, vTempLookAt.y + 1.0f, vTempLookAt.z );
    vUpDir = D3DXVECTOR3( 0.0f, 0.0f, -1.0f );
    D3DXMatrixLookAtLH( &g_amCubeMapViewAdjust[2], vEyePt, &vLookDir, &vUpDir );


    vLookDir = D3DXVECTOR3( vTempLookAt.x, vTempLookAt.y - 1.0f, vTempLookAt.z );
    vUpDir = D3DXVECTOR3( 0.0f, 0.0f, 1.0f );
    D3DXMatrixLookAtLH( &g_amCubeMapViewAdjust[3], vEyePt, &vLookDir, &vUpDir );


    vLookDir = D3DXVECTOR3( vTempLookAt.x, vTempLookAt.y, vTempLookAt.z + 1.0f );
    vUpDir = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
    D3DXMatrixLookAtLH( &g_amCubeMapViewAdjust[4], vEyePt, &vLookDir, &vUpDir );


    vLookDir = D3DXVECTOR3( vTempLookAt.x, vTempLookAt.y, vTempLookAt.z - 1.0f );
    vUpDir = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
    D3DXMatrixLookAtLH( &g_amCubeMapViewAdjust[5], vEyePt, &vLookDir, &vUpDir );
It is creating a cube map but its not right, any pointers are much appretiated! Thanks
zXynK
zXynK
the look at point for the camera

by not right i mean i think the vectors arn't right... is what im doing here right?
swiftcoder
swiftcoder
Quote:
Original post by zXynK
by not right i mean i think the vectors arn't right... is what im doing here right?
What about them isn't right? Is it skewed? Are the faces on the wrong sides of the cube? Something else?
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
zXynK
zXynK
i think the faces are on the wrong side of the cube. I know the cube is rendered right because it works fine with a texture, just cant get the snap shots right
zXynK
zXynK
The problem is arrising when I move the camera. If i use a stationary snap shot position it works fine. What should the view matrix be for each face given the eye and lookat positions?
zXynK
zXynK
anyone?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.