This article's documentation is for anything that uses the Source engine. Click here for more information.

Fr/$translucent: Difference between revisions

From Valve Developer Community
< Fr
Jump to navigation Jump to search
No edit summary
 
m (Multipage removal)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{LanguageBar|title = $translucent}}
{{this is a|shader parameter|name=$translucent}}
{{toc-right}}
{{toc-right}}
{{finishtranslation}}
Le paramètre <code>$translucent</code> permet de rendre votre texture transparente de facon contrôler par pixel. Le canal Alpla est utilisé pour la transparence, le noir est transparent et le blanc opaque.
Les object avec un matériaux transparent ne sont pas affecter par le VIS, les NPC peuvent voir au travers.


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.
==VMT syntax example==


$translucent <[[bool]]>
== VMT syntax ==


  [[LightmappedGeneric]]
  {{L|LightmappedGeneric}}
  {
  {
  [[$basetexture]] glass\window001a
  "$basetexture" "glass\window001a"
  '''$translucent 1'''
  "$translucent 1"
  }
  }


Line 20: Line 21:
: 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.
: 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 ==
== Mise en garde ==


=== Flickering ===
=== Clignotement ===
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 ===
La translucidité peut parfois causé au matériaux des clignotement. Dans ce cas utilisé le paramètre <code>$alphatest</code> à la place de <code>$translucent</code>, vous perdrez en qualitée mais cela résoudra le problème.
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.
 
=== Conpatibilité avec d'autres effects ===
 
Certains paramètre comme <code>$envmap</code> peuvent désacivez la transparence. SI vous avez ce problème essayer de rajouter des commentaires dans votre VMT.


=== Filtering borders ===
=== 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 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.
[[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 sudden drop-offs in alpha coincide with drop-offs in colour, which may well happen when the {{L|alpha channel}} reaches zero and you stop being able to see the pixels.


[[Image:Decal anisotropic.jpg|center|An unwanted filtering border.]]
[[File: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.
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.]]
[[File: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 TGA. 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]. A simple workaround is to save images as PNG rather than TGA, as The GIMP allows the preservation of colour information for transparent pixels when saving PNG images.  The resulting images can be imported into VTFEdit as normal, but cannot be used with VTex, as it does not offer PNG import support.)
 
== See also ==


*<code>[[$alpha]]</code>, for texture-wide translucency
('''Unfortunately for users of {{L|The GIMP}},''' the program will '''automatically remove colour information for pixels with an alpha of zero''' when the image is saved to TGA. 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]. A simple workaround is to save images as PNG rather than TGA, as The GIMP allows the preservation of colour information for transparent pixels when saving PNG images.  The resulting images can be imported into VTFEdit as normal, but cannot be used with VTex, as it does not offer PNG import support.)
*<code>[[$distancealpha]]</code>, for vector-like alpha edges
*<code>[[$vertexalpha]]</code>


[[Category:List of Shader Parameters|T]]
{{ACategory|Shader parameters|translucent}}

Latest revision as of 03:52, 12 July 2024

English (en)Español (es)Français (fr)中文 (zh)Translate (Translate)

UNTRANSLATED string "this is a" see Template:This is a/strings

Info content.png
This page has not been fully translated.
You can help by finishing the translation.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)

Le paramètre $translucent permet de rendre votre texture transparente de facon contrôler par pixel. Le canal Alpla est utilisé pour la transparence, le noir est transparent et le blanc opaque. Les object avec un matériaux transparent ne sont pas affecter par le VIS, les NPC peuvent voir au travers.


VMT syntax

LightmappedGeneric(en)
{
	"$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.

Mise en garde

Clignotement

La translucidité peut parfois causé au matériaux des clignotement. Dans ce cas utilisé le paramètre $alphatest à la place de $translucent, vous perdrez en qualitée mais cela résoudra le problème.

Conpatibilité avec d'autres effects

Certains paramètre comme $envmap peuvent désacivez la transparence. SI vous avez ce problème essayer de rajouter des commentaires dans votre VMT.

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(en) reaches zero and you stop being able to see the pixels.

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.

Fixing filtering borders.

(Unfortunately for users of The GIMP(en), the program will automatically remove colour information for pixels with an alpha of zero when the image is saved to TGA. The developers are aware of the the problems such behaviour creates but do not intend to change it. A simple workaround is to save images as PNG rather than TGA, as The GIMP allows the preservation of colour information for transparent pixels when saving PNG images. The resulting images can be imported into VTFEdit as normal, but cannot be used with VTex, as it does not offer PNG import support.)