• Advertisement
Sign in to follow this  

How to combine auto generated sphere mapping and texture transformation?

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

My code is something like this: .... m_pD3DDevice->SetTransform(D3DTS_TEXTURE0, pMatrix); m_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); m_pD3DDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_SPHEREMAP); .... It seems that Direct3D ignores the transformation from the matrix (pMatrix) and only generates the sphere mapping! I looked into Direct3D pipeline(http://www.xmission.com/~legalize/book/preview/poster/pipeline-9.0.png). After the automatic texture coordinate generation the texture cooridinate should go to texture matrix transformation. But it seems does not work this way or I did something wrong? Does anyone know what going on here? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
TCI_SPHEREMAP was added in D3D9, so I never used it. In DX8 spheremapping was done with TCI_CAMERASPACENORMAL, and a matrix to scale and bias the values from -1..1 to 0..1. Since this method has existed longer, I imagine most developers are still using this method, rather than the TCI_SPHEREMAP method.

You should be able to combine your matrix with the scale-bias matrix and use TCI_CAMERASPACENORMAL.

Another thing might be that you're trying to translate your coordinates using a regular transform matrix. When using COUNT2 you want to make a 2D transformation where translation is in _31, _32.

Share this post


Link to post
Share on other sites
I have tried COUNT4 and it did not work!


Namethatnobodyelsetook:
I missunderstood your answer. Now it works, thanks.

But I still don't understand why it is not _41 and _42.
Could you explain me in more detail?

[Edited by - vanger on January 20, 2009 4:00:17 AM]

Share this post


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

  • Advertisement