Jump to content
  • Advertisement
Sign in to follow this  
GambitSnax

Spherical Mapping queries

This topic is 4512 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

I'm working on implementing environment mapping atm and have come across some problems with my spherical mapping. I can get an object to render a spherical environment map, but the reflection it generates is upside down and flipped vertically. I'm not sure as to why this is happening. I have cubic mapping working in the same scene and it renders fine. Here is some of the code I use for spherical mapping

// load the sphere map into the g_pSphereMap object
D3DXCreateTextureFromFileEx(g_pD3DDevice, "spheremap.jpg", 256, 256, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &g_pSphereMap);

g_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_SPHEREMAP | 0);

g_pD3DDevice->SetTexture(0, g_pSphereMap);


And then I render my object. Can anyone suggest why it might be acting like this? Just an added question, as far as I understand, a spherical map works only for one point in space. So you can't move the object around and expect it to reflect correctly. Does this one point in space also mean just one perspective, aka one direction of view at the object, or should you be able to rotate around the object and see the reflection. I'm thinking you should but i'm not sure how to pass the translations into the texture coordinate generation. Cheers for your help.

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!