terrain texture question
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement