Bump Maping???
Hi,
I can''t seem to find any good examples of how to use bump maping in D3D IM. I''ve tried using the code from the sdk documentation,
but it doesn''t work ->
----------------------------------------
'' Stage 0: the base texture
g_d3ddevice.SetTextureStageState(0, D3DTSS_COLOROP,
D3DTOP_MODULATE)
g_d3ddevice.SetTextureStageState(0, D3DTSS_COLORARG1,
D3DTA_TEXTURE)
g_d3ddevice.SetTextureStageState(0, D3DTSS_COLORARG2,
D3DTA_DIFFUSE)
g_d3ddevice.SetTextureStageState(0, D3DTSS_ALPHAOP,
D3DTOP_SELECTARG1)
g_d3ddevice.SetTextureStageState(0, D3DTSS_ALPHAARG1,
D3DTA_TEXTURE)
'' Stage 1: the bump map
'' Use luminance for this example.
g_d3ddevice.SetTextureStageState(1, D3DTSS_COLOROP,
D3DTOP_BUMPENVMAPLUMINANCE)
g_d3ddevice.SetTextureStageState(1, D3DTSS_COLORARG1,
D3DTA_TEXTURE)
g_d3ddevice.SetTextureStageState(1, D3DTSS_COLORARG2,
D3DTA_CURRENT)
'' Stage 2: a specular environment map
g_d3ddevice.SetTextureStageState(2, D3DTSS_TEXCOORDINDEX, 0)
g_d3ddevice.SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_ADD)
g_d3ddevice.SetTextureStageState(2, D3DTSS_COLORARG1,
D3DTA_TEXTURE)
g_d3ddevice.SetTextureStageState(2, D3DTSS_COLORARG2,
D3DTA_CURRENT)
'' Set the bump mapping matrix.
g_d3ddevice.SetTextureStageStateSingle(1, D3DTSS_BUMPENVMAT00,1#)
g_d3ddevice.SetTextureStageStateSingle(1, D3DTSS_BUMPENVMAT01,0#)
g_d3ddevice.SetTextureStageStateSingle(1, D3DTSS_BUMPENVMAT10,0#)
g_d3ddevice.SetTextureStageStateSingle(1, D3DTSS_BUMPENVMAT11,1#)
g_d3ddevice.SetTextureStageStateSingle(1, D3DTSS_BUMPENVLSCALE,
0.5)
g_d3ddevice.SetTextureStageStateSingle(1, D3DTSS_BUMPENVLOFFSET,
0#)
g_d3ddevice.SetRenderState D3DRENDERSTATE_ALPHABLENDENABLE, True
----------------------------------------
Thanks for the help.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement