Ru/$phong: Difference between revisions

From Valve Developer Community
< Ru
Jump to navigation Jump to search
m (Nesciuse moved page $phong/ru to Ru/$phong over redirect: Language prefixes)
m (-Using L template for links)
Line 1: Line 1:
{{langsp}}
{{langsp}}
[[File:Alyx phong closeup.jpg|thumb|200px|Шейдер Фонг обеспечивает подсветку кожи, губ и головной повязки Аликс.]]
[[File:Alyx phong closeup.jpg|thumb|200px|Шейдер Фонг обеспечивает подсветку кожи, губ и головной повязки Аликс.]]
В большинстве версиях движка доступна только с шейдером <code>[[VertexLitGeneric]]</code>; {{csgo}} '''[[Counter-Strike: Global Offensive]]''' (начиная с 2015) позволяет использовать с шейдером <code>[[LightmappedGeneric]]</code> (с некоторыми ограничениями). Подробнее смотрите [[Phong materials|Фонг материалы]].
В большинстве версиях движка доступна только с шейдером <code>{{L|VertexLitGeneric}}</code>; {{csgo}} '''{{L|Counter-Strike: Global Offensive}}''' (начиная с 2015) позволяет использовать с шейдером <code>{{L|LightmappedGeneric}}</code> (с некоторыми ограничениями). Подробнее смотрите {{L|Phong materials|Фонг материалы}}.


==VMT syntax==
==VMT syntax==


  $phong <[[bool]]>
  $phong <{{L|bool}}>


Шейдер Фонг ''должен'' использовать стандартные значения для любых параметров конфигурации, которые вы не включили в свой файл материала. Однако оказывается так, что это не происходит. Тем не менее, все перечисленные ниже параметры обязательны, даже если их стандартные значения не меняются.
Шейдер Фонг ''должен'' использовать стандартные значения для любых параметров конфигурации, которые вы не включили в свой файл материала. Однако оказывается так, что это не происходит. Тем не менее, все перечисленные ниже параметры обязательны, даже если их стандартные значения не меняются.
Line 26: Line 26:
=== Masking ===
=== Masking ===


; <code>$bumpmap <[[texture]]></code>
; <code>$bumpmap <{{L|texture}}></code>
: Здесь должна быть [[$bumpmap|карта нормалей]]. Ее [[alpha channel|альфа канал]] действует по умолчанию как [[Phong materials#Phong mask and exponent texture|маска Фонга]].
: Здесь должна быть {{L|$bumpmap|карта нормалей}}. Ее {{L|alpha channel|альфа канал}} действует по умолчанию как [[Phong materials#Phong mask and exponent texture|маска Фонга]].
; {{L4D add|<code>$BasemapLuminancePhongMask <[[bool]]></code>}}
; {{L4D add|<code>$BasemapLuminancePhongMask <{{L|bool}}></code>}}
: Интенсивность Фонг основывается на яркости <code>$basetexture</code>.
: Интенсивность Фонг основывается на яркости <code>$basetexture</code>.
;<code>$BasemapAlphaPhongMask <bool></code>
;<code>$BasemapAlphaPhongMask <bool></code>
: Заменяет маску Фонга на [[alpha channel|альфа канал]] <code>[[$basetexture]]</code> вместо [[$bumpmap|карты нормалей]].
: Заменяет маску Фонга на {{L|alpha channel|альфа канал}} <code>{{L|$basetexture}}</code> вместо {{L|$bumpmap|карты нормалей}}.
; <code>$PhongExponent <[[int]]></code>
; <code>$PhongExponent <{{L|int}}></code>
: The numeric value overrides an exponent mask if present.
: The numeric value overrides an exponent mask if present.
; <code>$PhongExponentTexture <texture></code>  
; <code>$PhongExponentTexture <texture></code>  
Line 39: Line 39:
:* '''<span style="color:green">Зеленый канал:</span>''' Albedo tint (if <code>$phongalbedotint 1</code>, higher is more tint)
:* '''<span style="color:green">Зеленый канал:</span>''' Albedo tint (if <code>$phongalbedotint 1</code>, higher is more tint)
:* '''<span style="color:blue">Синий канал:</span>''' Nothing
:* '''<span style="color:blue">Синий канал:</span>''' Nothing
:* '''Alpha channel:''' <code>[[$rimlight]]</code> mask
:* '''Alpha channel:''' <code>{{L|$rimlight}}</code> mask
; {{L4D add|<code>$shinyblood <[[int]]></code>}}
; {{L4D add|<code>$shinyblood <{{L|int}}></code>}}
; {{L4D add|<code>$shinybloodexponent <int></code>}}
; {{L4D add|<code>$shinybloodexponent <int></code>}}
: {{todo|1=See ''[http://www.valvesoftware.com/publications/2010/GDC10_ShaderTechniquesL4D2.pdf#page=33 Shading a Bigger, Better Sequel: Techniques in Left 4 Dead 2]''.}}
: {{todo|1=See ''[http://www.valvesoftware.com/publications/2010/GDC10_ShaderTechniquesL4D2.pdf#page=33 Shading a Bigger, Better Sequel: Techniques in Left 4 Dead 2]''.}}
Line 50: Line 50:
=== Brightness ===
=== Brightness ===


; <code>$phongboost <[[int]]></code>
; <code>$phongboost <{{L|int}}></code>
: Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.
: Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.
; <code>$PhongFresnelRanges <matrix></code>
; <code>$PhongFresnelRanges <matrix></code>
: See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>.
: See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>.
; <code>$PhongDisableHalfLambert <bool></code> {{P2 add}}
; <code>$PhongDisableHalfLambert <bool></code> {{P2 add}}
: Used in [[Portal 2]] on the Personality Cores such as Wheatley, disables functionality of $halflambert. MAY need <code>$halflambert 0</code>!
: Used in {{L|Portal 2}} on the Personality Cores such as Wheatley, disables functionality of $halflambert. MAY need <code>$halflambert 0</code>!
;<code>$AmbientOcclusionTexture <texture></code>
;<code>$AmbientOcclusionTexture <texture></code>
: A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face. [[$ambientocclusion|Ambient Occlusion]] is generally used for the eyes and face.
: A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face. {{L|$ambientocclusion|Ambient Occlusion}} is generally used for the eyes and face.


=== Colours ===
=== Colours ===


; <code>$PhongAlbedoTint <bool></code>
; <code>$PhongAlbedoTint <bool></code>
: Allows the <code>[[$basetexture]]</code> to affect the colour of the Phong highlight. The amount of tint is defined by the green channel of <code>$phongexponenttexture</code> (see above).
: Allows the <code>{{L|$basetexture}}</code> to affect the colour of the Phong highlight. The amount of tint is defined by the green channel of <code>$phongexponenttexture</code> (see above).
; <code>$phongtint "[<red [[float]]> <green float> <blue float>]"</code>
; <code>$phongtint "[<red {{L|float}}> <green float> <blue float>]"</code>
: Modifies the colour of the phong reflection. The channels are interpreted relative to each other (so "[0 0 0]" and "[1 1 1]" are the same).
: Modifies the colour of the phong reflection. The channels are interpreted relative to each other (so "[0 0 0]" and "[1 1 1]" are the same).
; <code>$PhongWarpTexture <texture></code> {{EP2 add}}
; <code>$PhongWarpTexture <texture></code> {{EP2 add}}
: {{todo|Used to create an iridescence effect, as seen on [[npc_hunter]]s.}}
: {{todo|Used to create an iridescence effect, as seen on {{L|npc_hunter}}s.}}


== Phong shading on brush faces ==
== Phong shading on brush faces ==


A May 2015 update to {{csgo}} '''[[Counter-Strike: Global Offensive]]''' added limited support for Phong-based highlights on <code>[[LightmappedGeneric]]</code> materials. Currently it only works when the material is directly lit by an env_cascade_lighting, using the dynamic shadows as a mask (although traditional Phong masking is supported on top of this). It is known to work on displacements as well as <code>[[WorldVertexTransition]]</code> materials, but not water or <code>[[Lightmapped_4WayBlend]]</code>.
A May 2015 update to {{csgo}} '''{{L|Counter-Strike: Global Offensive}}''' added limited support for Phong-based highlights on <code>{{L|LightmappedGeneric}}</code> materials. Currently it only works when the material is directly lit by an env_cascade_lighting, using the dynamic shadows as a mask (although traditional Phong masking is supported on top of this). It is known to work on displacements as well as <code>{{L|WorldVertexTransition}}</code> materials, but not water or <code>{{L|Lightmapped_4WayBlend}}</code>.


=== New Parameters ===
=== New Parameters ===
Line 81: Line 81:
== See also ==
== See also ==


* [[Phong materials]]
* {{L|Phong materials}}
* [[$envmap]] (environment map)
* {{L|$envmap}} (environment map)
* [[$lightwarptexture]]
* {{L|$lightwarptexture}}
* [[$rimlight]]
* {{L|$rimlight}}

Revision as of 08:46, 11 July 2024

English (en)Español (es)Русский (ru)中文 (zh)Translate (Translate)
Шейдер Фонг обеспечивает подсветку кожи, губ и головной повязки Аликс.

В большинстве версиях движка доступна только с шейдером VertexLitGeneric(en); Counter-Strike: Global Offensive Counter-Strike: Global Offensive(en) (начиная с 2015) позволяет использовать с шейдером LightmappedGeneric(en) (с некоторыми ограничениями). Подробнее смотрите Фонг материалы(en).

VMT syntax

$phong <bool(en)>

Шейдер Фонг должен использовать стандартные значения для любых параметров конфигурации, которые вы не включили в свой файл материала. Однако оказывается так, что это не происходит. Тем не менее, все перечисленные ниже параметры обязательны, даже если их стандартные значения не меняются.

VertexLitGeneric
{
	$phong 1

	$bumpmap				[texture]
	$phongexponent			5			// либо это
	$phongexponenttexture	[texture]	// либо это
	$phongboost				1.0
	$phongfresnelranges		"[0 0.5 1]"
}

Параметры шейдера

Masking

$bumpmap <texture(en)>
Здесь должна быть карта нормалей(en). Ее альфа канал(en) действует по умолчанию как маска Фонга.
Template:L4D add
Интенсивность Фонг основывается на яркости $basetexture.
$BasemapAlphaPhongMask <bool>
Заменяет маску Фонга на альфа канал(en) $basetexture(en) вместо карты нормалей(en).
$PhongExponent <int(en)>
The numeric value overrides an exponent mask if present.
$PhongExponentTexture <texture>
An global exponent value, or a per-texel exponent texture map. In an exponent map:
  • Красный канал: Exponent (size of highlight, 0-255, where a value of 0 is a large highlight, 255 small.)
  • Зеленый канал: Albedo tint (if $phongalbedotint 1, higher is more tint)
  • Синий канал: Nothing
  • Alpha channel: $rimlight(en) mask
Template:L4D add
Template:L4D add
$allowdiffusemodulation <int>
[Нужно сделать]
$DiffuseExp
Нужно сделать: Does this have something to do with the $phongexponent, $phongexponenttexture or both?

Brightness

$phongboost <int(en)>
Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.
$PhongFresnelRanges <matrix>
See Phong Fresnel ranges. Default is "[0 0.5 1]".
$PhongDisableHalfLambert <bool> Template:P2 add
Used in Portal 2(en) on the Personality Cores such as Wheatley, disables functionality of $halflambert. MAY need $halflambert 0!
$AmbientOcclusionTexture <texture>
A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face. Ambient Occlusion(en) is generally used for the eyes and face.

Colours

$PhongAlbedoTint <bool>
Allows the $basetexture(en) to affect the colour of the Phong highlight. The amount of tint is defined by the green channel of $phongexponenttexture (see above).
$phongtint "[<red float(en)> <green float> <blue float>]"
Modifies the colour of the phong reflection. The channels are interpreted relative to each other (so "[0 0 0]" and "[1 1 1]" are the same).
$PhongWarpTexture <texture> Template:EP2 add
Нужно сделать: Used to create an iridescence effect, as seen on npc_hunter(en)s.

Phong shading on brush faces

A May 2015 update to Counter-Strike: Global Offensive Counter-Strike: Global Offensive(en) added limited support for Phong-based highlights on LightmappedGeneric(en) materials. Currently it only works when the material is directly lit by an env_cascade_lighting, using the dynamic shadows as a mask (although traditional Phong masking is supported on top of this). It is known to work on displacements as well as WorldVertexTransition(en) materials, but not water or Lightmapped_4WayBlend(en).

New Parameters

$phongMaskContrastBrightness "[<float> <float>]"
Defines the contrast level between light and dark areas in the mask, and the overall brightness, respectively. Added along with support for phong-shaded lightmapped textures.
Нужно сделать: Find out the range of both values, and whether or not it can be used on models.
$phongAmount "[<red float> <green float> <blue float> <brightness> float]"
Controls the tint and brightness. The fourth value can go beyond 1, but affects the brightness of the whole texture, not just the highlight.

See also