Jump to content
  • Advertisement
Sign in to follow this  

Simple Dot3 Bumpmapping with dx9 ?

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

hi all i try to make a game and now my landscape works ok, and now i want to add some stuff to it.. and i want to use dot3 mapping, i remeber in old sdk times there was dot3 simple sample without vertex/pixel shader but i lost that code and cant remember .. it was very simple.. a texture was loaded..and the from that texture a second for the dot3 was created ..and only some render states and sun position that was all.. with shaders i got much problems and i am glatt that vs1.1 water now works perfect can anybody help me how can i add simple dot3 in dx9 without shaders use (creating dot3 bump texture from another, and what settings at renderstates) here some older pictures from my work , the trees at moment are only decals because i cant find any 3d lowpoly trees and i dont have a million dollar in my bed for speedtree license :) my.php?image=jpic00014small1ni.jpg my.php?image=pic000294bx.jpg my.php?image=jpic00014small1ni.jpg my.php?image=pic000303xc.jpg much greetings and thx for any help :)

Share this post

Link to post
Share on other sites
You can use D3DXComputeNormalMap to convert a greyscale heightmap into a normal map, which you can then use with D3DTOP_DOTPRODUCT3. The sample likely encoded the sun direction vector into TFACTOR like this.

unsigned char sunx, suny, sunz;
sunx = (sundirvector.x+1)*128;
suny = (sundirvector.y+1)*128;
sunz = (sundirvector.z+1)*128;
unsigned long tfactor;
tfactor = (((unsigned long )sunx)<<16) | (((unsigned long)suny)<<8) | sunz;
pDev->SetRenderState(D3DRS_TEXTUREFACTOR, tfactor);
pDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DOTPRODUCT3);
pDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pDev->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
pDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
pDev->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
pDev->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pDev->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
pDev->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT);
pDev->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE);
pDev->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pDev->SetTexture(0, pNormalMap);
pDev->SetTexture(1, pDiffuseMap);

Share this post

Link to post
Share on other sites

I have been playing with your example, and have managed to get some interesting results. However I haven’t been able to get a nice blend between the diffuse and the bump map, rather I am getting mostly bump and not much texture.

Do you possibly have a more complete example?


Share this post

Link to post
Share on other sites
hmm.. i try everything but it dosnt work

the result ending up in an complete white 3d object,
i try everything from the old dx8 examples..but
the pieces of code there did fit together

is there any complete tutorial for dot3 that really works?

->loading texure
->create bumpmap/compute normalmap
->setting devices (and everything needed)
->draw dot3 bumped Mesh

much thx

Share this post

Link to post
Share on other sites
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!