Archived

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

BrianH

terrain texture question

Recommended Posts

BrianH    145
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
BrianH    145
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