Alpha-fading
idTech4 (aka Doom3) supports only an alpha threshold. That means the shader for a material sets an arbitrary threshold, and values in the alpha map below that value render opaque, and above that value transparent.
The results in pixels either being transparent, or opaque. The only other way to achive translucency is to set the translucent keyword in a shader. This however, fixes the translucency to 50%.
So there is no way to make models to appear fading-in, or fading-out, except by varying the alpha threshold. Together with a good alpha map with ramps, this can make things appear to burn-away (an effect used by D3 f.i. for the imps "burning" away after you killed them), or to "grow thinner" with distance.
Here is a crude example of such an alpha map (the black parts are transparent, white opaque):
(note: the greyscale images above represents the alpha channel in a diffuse texture)
Example Material with alpha-test:
textures/darkmod/decals/vegetation/cattails_green
{
qer_editorimage textures/darkmod/decals/vegetation/cattail_atlas
surftype15
description "foliage"
//twosided (we use rotated patches to save one surface hence one drawcall)
nonsolid
noshadows
{
blend diffusemap
map textures/darkmod/decals/vegetation/cattail_atlas
alphatest 0.5
}
// TDM Ambient Method Related
{
if (global5 == 1)
blend add
map textures/darkmod/decals/vegetation/cattail_atlas
scale 1, 1
red global2
green global3
blue global4
}
}
Note: This section:
{
if (global5 == 2)
blend add
program ambientEnvironment.vfp
vertexParm 0 1, 1, 1, 1 // UV Scales for Diffuse and Bump
vertexParm 1 1, 1, 1, 1 // (X,Y) UV Scale for specular
vertexParm 2 global2, global3, global4, 1
fragmentMap 0 cubeMap env/gen1
fragmentMap 1 _flat // Bump
fragmentMap 2 textures/darkmod/decals/vegetation/cattail_atlas // Diffuse
fragmentMap 3 _black // Specular
}
has been removed as it is no longer needed in TDM 2.0 (Standalone)
Example LOD Entity Def:
entityDef atdm:nature_grass_base
{
"inherit" "atdm:nature_base"
"editor_displayFolder" "Nature/Grass"
"editor_color" ".4 0.8 0.1"
"editor_usage" "Don't use, base for all TDM LOD grass patches."
"solid" "0"
// grass models usually do not have a clipmodel, resulting in "size == 0"
// Adjust their density thus:
"seed_base_density" "0.01"
// grass may grow through cracks on gravel, but it certainly grows less dense
"seed_material_gravel" "0.05"
// turn off shadows from this distance on
// "lod_1_distance" "250"
// "model_lod_1" ""
// "noshadows_lod_1" "1"
// hide it from this distance on (it is a small object, so can vanish fast)
"hide_distance" "1000"
"lod_fadeout_range" "600"
// by default use more dense grass
"skin" "nature/long_grass_dense"
}