Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Carandiru

Spherical Enviroment Mapping

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

Anyone know of a good tutorial for DirectX 8 / 8.1b that will use spherical enviroment mapping WITHOUT pixel/vertex shaders & effect scripts? Please let me know! .:[Carandiru]:. -Skilled C++ Programmer -DirectX 8.1b, Win32

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Set your texture coordinate index to D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR or D3DTSS_TCI_CAMERASPACENORMAL. Reflection vector looks better, but takes more time to compute. Normal vector will not really work on a flat surface.

The your texture transform to scale of 0.5 and offset of 0.5

_11 = _22 = 0.5f;
_31 = _32 = 0.5f

Enable texture transform and set the texture transform, Draw, turn off texture transform.


  
pDev->SetTextureStageState( nStage, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR );
pDev->SetTextureStageState(nStage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
pDev->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+nStage), &xformmatrix);
...
Draw
...
pDev->SetTextureStageState(nStage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );


Typical use:
Stage 0 = diffuse texture. Stage 1 = env texture.
Stage 0, selectarg1 (texture).
Stage 1, add (texture, current).
Stage 2, disable.

Share this post


Link to post
Share on other sites
Thank you very much, it was suprisingly hard to find any information on this.

.:[Carandiru]:.
-Skilled C++ Programmer
-DirectX 8.1b, Win32

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!