Advertisement Jump to content
Sign in to follow this  
tokaplan

Using second set of texture coordinates in bump mapping

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

SDK documentation offers this code to set up texture stages when doing bump mapping: // Set the color operations and arguments to prepare for // bump mapping. // Stage 0: The base texture d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); d3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 1 ); // Stage 1: The bump map - Use luminance for this example. d3dDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1 ); d3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_BUMPENVMAPLUMINANCE); d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE ); d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT ); // Stage 2: A specular environment map d3dDevice->SetTextureStageState( 2, D3DTSS_TEXCOORDINDEX, 0 ); d3dDevice->SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_ADD ); d3dDevice->SetTextureStageState( 2, D3DTSS_COLORARG1, D3DTA_TEXTURE ); d3dDevice->SetTextureStageState( 2, D3DTSS_COLORARG2, D3DTA_CURRENT ); As far as I understand, it assumes that FVF must be something like this: struct BUMPVERTEX { D3DXVECTOR3 p; D3DXVECTOR3 n; FLOAT tu1, tv1; FLOAT tu2, tv2; } My question is: how should I set the second set of texture coordinates when loading model from X-file? Should both coordinate sets be the same? Why should I use two sets of texture coordinates at all? Thank you

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!