Jump to content
  • Advertisement

Archived

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

BrianH

terrain texture question

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

Hello, I want to have 2 textures on my terrain: 1 for the basic ground color (TEX1) and a 2nd as a detail layer (TEX2). I also want the blending of the detail texture to depend on the distance the face is from the camera. So that faces far away from the camera basically dont show the detail. I am having some troubles with this.. here is what I have figured so far: 1. I want to use the D3DRS_TEXTUREFACTOR state to specify the blending for each set of faces. This will be changed depending on the distance of the faces from the camera. The problem i ran into was setting up the texture stage states for this. At first I modulated TEX1 with the diffuse color, then did a linear blend using D3DTOP_BLENDFACTORALPHA. However, this produced an additive effect.. which is not what I want. I basically want to modulate TEX2 onto the texture, but also take the blend factor into account... Dst = (DIFFUSE * TEX1) * (TEX2 * BlendFactor) This will allow the detail texture to darken and add color, but not to brighten the ground texture. I got it sorta working by switching TEX1 and TEX2 and setting the diffuse color to 0; this basically equates to: Dst = (0 + (TEX2 * BlendFactor) * TEX1 but now i cannot use the diffuse color... Any ideas? -BrianH

Share this post


Link to post
Share on other sites
Advertisement
Am i going to need to split this into 2 passes to achieve this effect? I would basically render the base texture on the first pass. then on the second pass I would use the blendfactor as the alpha value and render the faces with the detail texture, with the modulate operation...


-BH

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!