$translucent: Difference between revisions
TomEdwards (talk | contribs) No edit summary |
TomEdwards (talk | contribs) (Caveats) |
||
Line 1: | Line 1: | ||
{{toc-right}} | |||
The <code>[[$translucent]]</code> [[VMT]] command specifies that the material should be partially see-through. The [[alpha channel]] of <code>[[$basetexture]]</code> is used to decide translucency per-pixel. | The <code>[[$translucent]]</code> [[VMT]] command specifies that the material should be partially see-through. The [[alpha channel]] of <code>[[$basetexture]]</code> is used to decide translucency per-pixel. | ||
Any object that has a <code>$translucent</code> material does not affect [[VIS]], and can be seen through by NPCs from any angle. | Any object that has a <code>$translucent</code> material does not affect [[VIS]], and can be seen through by NPCs from any angle. | ||
==VMT syntax example== | ==VMT syntax example== | ||
Line 22: | Line 20: | ||
:Renders the texture additively, so that its colors add to, instead of replacing, what is displayed behind. | :Renders the texture additively, so that its colors add to, instead of replacing, what is displayed behind. | ||
== | == Caveats == | ||
=== Flickering === | |||
Translucency can sometimes cause a material to flicker. 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. | |||
=== Compatibility with other effects === | |||
Certain shader parameters (such as <code>[[$envmap]]</code>) can disable translucency. If you are having trouble getting it to work, try commenting out other parts of the material. | |||
=== Filtering borders === | |||
[[Wikipedia:Texture filtering|Texture filtering]] will blend nearby pixels together even if some of of them are entirely transparent. This can create unwanted outlining effects if the [[albedo]] swings violently from one colour to another, as it may well when the [[alpha channel]] reaches zero and you stop being able to see the pixels. | |||
[[Image:Decal anisotropic.jpg|center|An unwanted filtering border.]] | |||
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. | |||
[[Image:Filterborder fixed.jpg|center|Fixing filtering borders.]] | |||
('''Unfortunately for users of [[The GIMP]],''' the program will '''automatically remove colour information for pixels with an alpha of zero''' when the image is saved to a format without layers. The developers are aware of the the problems such behaviour creates [http://bugzilla.gnome.org/show_bug.cgi?id=411599#c4 but do not intend to change it]. There seems to be no way around this issue but to use a different program!) | |||
== See also == | == See also == | ||
Line 31: | Line 46: | ||
[[Category:List of Shader Parameters|T]] | [[Category:List of Shader Parameters|T]] | ||
[[Category:VMT Transparency]] | [[Category:VMT Transparency]] | ||
Revision as of 11:52, 13 July 2008
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>
- Renders the texture additively, so that its colors add to, instead of replacing, what is displayed behind.
Caveats
Flickering
Translucency can sometimes cause a material to flicker. 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 the albedo swings violently from one colour to another, as it may well 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 when the image is saved to a format without layers. The developers are aware of the the problems such behaviour creates but do not intend to change it. There seems to be no way around this issue but to use a different program!)
See also
$alpha
, for texture-wide translucency.