Code: Select all
sampler2D coverage; //coverage
sampler2D lightmap; //lightmap
sampler2D splat1;
sampler2D splat2;
// Pixel shader output structure
struct PS_OUTPUT
{
float4 Color : COLOR0; // Pixel color
};
struct PS_INPUT
{
float4 Position : POSITION;
float4 Diffuse : COLOR0;
float2 LightmapTexCoord : TEXCOORD1; //lightmap texture coords
float2 SplatTexCoord1 : TEXCOORD2; //1st spalt texture coords
float2 SplatTexCoord2 : TEXCOORD3; //2nd spalt texture coords
float normalDist : TEXCOORD0;
};
PS_OUTPUT main( PS_INPUT Input )
{
PS_OUTPUT Output;
float4 TexColor = lerp(tex2D( splat2, Input.SplatTexCoord2),
tex2D( splat1, Input.SplatTexCoord1),Input.normalDist);
float4 LightmapColor = tex2D( lightmap, Input.LightmapTexCoord ); // lightmap
Output.Color = Input.Diffuse * TexColor * LightmapColor;
return Output;
}
1.Here the coverage means what?
2.how do i add the textures(coverage,lightmap,splatmap) to the material?
I simply add the getMaterial().setTexture() behind the set detail texture as follow, apparently unreasonable and invalid.
Code: Select all
// load color map
terrain->loadColorMap("colormap.jpg");
// set detail texture
terrain->setMaterialTexture(0, driver->getTexture("detailmap.jpg"));
terrain->getMaterial(0).MaterialType = (video::E_MATERIAL_TYPE)TexSplatting;
terrain->getMaterial(0).setTexture(0, driver->getTexture("coverage.png"));
terrain->getMaterial(0).setTexture(1, driver->getTexture("lightmap.png"));
terrain->getMaterial(0).setTexture(2, driver->getTexture("splatmap1.png"));
terrain->getMaterial(0).setTexture(3, driver->getTexture("splatmap2.png"));
3.It seems that the lightmap texture coords here equate with CTexture(defined in Arras's app)'s coords which just corresponds to vissible terrain mesh,how do i make it correspond to whole terrain?
Besides, It seems that the link of Hex terrain editor was dead,
If anyone who can offer me another , I would be extremely grateful!
Code: Select all