$translucent: Difference between revisions
TomEdwards (talk | contribs) |
|||
Line 22: | Line 22: | ||
== Caveats == | == Caveats == | ||
=== Flickering === | === Flickering and reversed depth === | ||
Translucency can sometimes cause a material to flicker, or cause sorting issues with nearby surfaces. In both cases consider using '''<code>$alphatest</code>''' instead of <code>$translucent</code> when this happens. It drastically lowers quality, but will usually resolve the issue and is much faster to draw. | |||
[[File:Translucent2p.png]] | |||
=== Compatibility with other effects === | === Compatibility with other effects === |
Revision as of 02:55, 14 November 2009
The $translucent
VMT command specifies that the material should be partially see-through. The alpha channel of $basetexture
is used to decide translucency per-pixel.
Any object that has a $translucent
material does not affect VIS, and can be seen through by NPCs from any angle.
VMT syntax example
$translucent <bool>
LightmappedGeneric { $basetexture glass\window001a $translucent 1 }
Additional parameters
$additive <bool>
- Add the material's colour values to the existing image, instead of performing a multiplication. This means, among other things, that the material will always brighten the world.
Caveats
Flickering and reversed depth
Translucency can sometimes cause a material to flicker, or cause sorting issues with nearby surfaces. In both cases consider using $alphatest
instead of $translucent
when this happens. It drastically lowers quality, but will usually resolve the issue and is much faster to draw.
Compatibility with other effects
Certain shader parameters (such as $envmap
) can disable translucency. If you are having trouble getting it to work, try commenting out other parts of the material.
Filtering borders
Texture filtering will blend nearby pixels together even if some of of them are entirely transparent. This can create unwanted outlining effects if sudden drop-offs in alpha coincide with drop-offs in colour, which may well happen when the alpha channel reaches zero and you stop being able to see the pixels.
To resolve this issue, simply blend the colours of your image slightly beyond where the alpha channel drops off. This can be easily achieved by duplicating the translucent layer and smudging it into the relevant areas.
(Unfortunately for users of The GIMP, the program will automatically remove colour information for pixels with an alpha of zero whenever layers are combined. The developers are aware of the the problems such behaviour creates but do not intend to change it.)
See also
$alpha
, for texture-wide translucency$distancealpha
, for vector-like alpha edges$vertexalpha