PBR (Strata shader): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(→‎Supported Parameters: Updated list to match actual parameters from shaders.json. Would upload file, however P2CE devs dont want filesharing until mod gets released so not yet)
Line 3: Line 3:
{{note|Similar unrelated PBR-based shaders are also used in {{tfbranch|4.1}} and {{Source2|4.1}}.}}
{{note|Similar unrelated PBR-based shaders are also used in {{tfbranch|4.1}} and {{Source2|4.1}}.}}
==Supported Parameters==
==Supported Parameters==
<!-- list and descriptions from P2CE shaders.json -->
===Basics===
===Basics===
{{MatParam|$basetexture|texture|Defines an albedo texture.}}
{{MatParam|$basetexture|texture|Base texture with lighting built in.}}
{{MatParam|$surfaceprop|string|Links the surface to a set of physical properties (footstep sounds, bullet penetration {{confirm}}, etc)}}
{{MatParam|$basetexture2|texture|Blended texture for use with displacements}}
{{MatParam|$flags|int|Flags}}
{{MatParam|$flags_defined|int|Flags_defined}} {{todo|What do flags do?}}
{{MatParam|$flags2|int|Flags}}
{{MatParam|$flags_defined2|int|Flags_defined}}


===Adjustment===
===Appearance===
{{MatParam|$basetexturetransform|matrix|Transforms the texture before use in the material. This does not affect [[lightmaps]] on the surface.}}
{{MatParam|$basetexturetransform|matrix|Transforms the texture before use in the material. This does not affect [[lightmaps]] on the surface.}}
{{MatParam|$color|color|Adjusts the color of the texture}}
{{MatParam|$color2|color|Ditto}}
{{MatParam|$frame|int|Sets which frame to use if $basetexture is animated}}
{{MatParam|$frame2|int|Sets which frame to use if $basetexture2 is animated}}
{{MatParam|$srgbtint|color|Tint value to be applied when running on new-style srgb parts}}
==Flashlight===
{{MatParam|$flashlighttexture|texture|Flashlight spotlight shape texture (default is effects/flashlight001)}}
{{MatParam|$flashlighttextureframe|int|Animation frame to use if $flashlighttexture is animated}}


===PBR===
===PBR===
{{MatParam|$mraotexture|texture|Defines an MRAO map to use. Needed for the texture to actually use PBR features. Metalness is on the red channel, roughness is on the green, and ambient occlusion is on the blue channel.}}
{{MatParam|$mraotexture|texture|Defines an MRAO map to use. Needed for the texture to actually use PBR features. Metalness is on the red channel, roughness is on the green, and ambient occlusion is on the blue channel.}}
{{MatParam|$model|boolean|Specifies whether or not this texture is used on a model.}}
{{MatParam|$mraoframe|int|Frame to use if $maraotexture is animated}}
{{MatParam|$speculartexture|texture|Enables use of colored F0 (specular map), overrides metalness from MRAO texture.}}
{{MatParam|$mraotexture2|texture|Defines an MRAO map to use for the blended texture. Needed for the texture to actually use PBR features. Metalness is on the red channel, roughness is on the green, and ambient occlusion is on the blue channel.}}
{{confirm|Which games use $useparallax and which ones use $parallax? Are they the same?}}
{{MatParam|$mraoframe2|int|Frame to use if $maraotexture2 is animated}}
{{MatParam|$parallax|only={{Strata}}|boolean|Enables parallax mapping on the material.}}
{{MatParam|$parallax|boolean|Enables parallax mapping on the material.}}
{{MatParam|$useparallax|float|Ditto{{confirm}}}}
{{MatParam|$mraoscale|color|Specifies the strength of Metalness(R), Roughness(G), and Ambient Occlusion(B) for $mraotexture}}
{{MatParam|$mraoscale2|color|Specifies the strength of Metalness(R), Roughness(G), and Ambient Occlusion(B) for $mraotexture2}}
{{MatParam|$parallaxdepth|float|Defines the depth of the parallax map}}
{{MatParam|$parallaxdepth|float|Defines the depth of the parallax map}}
{{MatParam|$parallaxcenter|float|Defines the center of the parallax map. 0.5 is a good start}}
{{MatParam|$parallaxcenter|float|Defines the center of the parallax map. 0.5 is a good start}}
{{MatParam|$blendtintbymraoalpha|bool|Blend tint by the alpha channel in MRAO texture. Similar to $blendtintbybasealpha for [[VertexLitGeneric|VLG]]}}
==={{p2ce}}Paint===
{{MatParam|$paintsplatnormalmap|texture|The paint splat normal map to use when paint is enabled on the surface}}
{{MatParam|$paintsplatbubblelayout|texture|The layout texture which defines the distribution of bubbles in the paint}}
{{MatParam|$paintsplatbubble|texture|The normal mapped texture of a single bubble}}
{{MatParam|$paintenvmap|texture|Envmap that is consistent across all painted surfaces}}


===Lighting===
===Lighting===
{{MatParam|$bumpmap|texture|Sets the normal map (new way of setting normalmap)}}
{{MatParam|$bumpmap|texture|Sets the normal map (new way of setting normalmap)}}
{{MatParam|$normaltexture|texture|Sets the normal map (for backwards compatibility)}}
{{MatParam|$bumbframe|int|Frame to use if $bumpmap is animated.}}
{{MatParam|$bumpmap2|texture|Sets the normal map to blend to (new way of setting normalmap)}}
{{MatParam|$bumbframe2|int|Frame to use if $bumpmap2 is animated.}}
{{MatParam|$normaltexture|texture|Normal map texture (deprecated, use $bumpmap)}}
{{MatParam|$emissiontexture|texture|Allows setting an emission texture. Enabled self illumination.}}
{{MatParam|$emissiontexture|texture|Allows setting an emission texture. Enabled self illumination.}}
 
{{MatParam|$emissionframe|int|Frame to use if $emissiontexture is animated.}}
{{MatParam|$emissiontexture2|texture|Allows setting an emission texture to blend to. Enabled self illumination.}}
{{MatParam|$emissionframe2|int|Frame to use if $emissiontexture2 is animated.}}
{{MatParam|$emissionscale|color|Color to multiply $emissiontexture with}}
{{MatParam|$emissionscale2|color|Color to multiply $emissiontexture2 with}}
{{MatParam|$hsv|color|HSV color to transform $basetexture texture with}}
{{MatParam|$hsv_blend|bool|Blend untransformed color and HSV transformed color}}


===Reflection===
===Reflection===
{{MatParam|$envmap|cubemap|Specular reflections}}
{{MatParam|$envmap|cubemap|Specular reflections}}
{{MatParam|$envmapcontrast|normal|Controls the [[Wikipedia:Contrast (vision)|contrast]] of the reflection. 0 is natural contrast, while 1 is the full squaring of the color (i.e. color*color).
{{MatParam|$envmapparallax|matrix|{{todo|What is this?}} Should be in this format: {{code|<nowiki>[1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]</nowiki}}
: {{note|Will not work when Phong is enabled.}}
{{MatParam|$envmapframe|int|Frame to use if material specified in $envmap is animated}}
: {{tip|Use higher contrasts to diminish relatively darker areas and increase "hot spots".}}}}
{{MatParam|$envmaporigin|vec3|The world space position of the env_cubemap being corrected}}
{{MatParam|$envmapsaturation|RGB matrix|Controls the color saturation of the reflection. 0 is greyscale, while 1 is natural saturation. R, G and B can be de/oversaturated respectively using <code>"[r g b]"</code>
{{MatParam|$bdrf_integration|texture|Texture to use for {{w|Bidirectional reflectance distribution}}}}
: {{note|In the Shadercode for {{src13|2}} and {{as|2}} the parameter is defined as a float parameter. However it will be used as a vec3 and the Shader expects and uses it as such.}}
: {{note|Will not work when [[Phong]] is enabled on models.}}
: {{bug|{{css}} Works only on models.}}}}
{{MatParam|$envmaptint|RGB matrix|Controls the intensity of the reflection's [[RGB|red, green and blue]] color channels. Any positive number can be used. Default is <code>"[1 1 1]"</code>, which means 100% intensity. {{note|You ''must'' use quotemarks, as there are space characters within the value.}} {{tip|This command is often used to dim the brightness of a specular reflection without the overhead of an <code>$envmapmask</code>.}}}}
{{MatParam|$useenvambient|boolean|Makes the reflections use the lowest mip level of the cubemap for ambient light instead of the ambient cubes. Can cause artifacts with moving props.}}


===Transparency===
===Transparency===
{{MatParam|$alpha|float|Scales the opacity of an entire material.}}
{{MatParam|$alpha|float|Scales the opacity of an entire material.}}
{{MatParam|$alphatest|bool|Specifies a mask to use to determine binary opacity.}}
{{MatParam|$alphatestreference|float|Specifies the minimum color value of the alpha channel in which the effect is rounded to 255. A value of ".3" will create a thicker shape while a value of ".7" will create a thinner shape.}}
{{MatParam|$alphatestreference|float|Specifies the minimum color value of the alpha channel in which the effect is rounded to 255. A value of ".3" will create a thicker shape while a value of ".7" will create a thinner shape.}}
{{MatParam|$translucent|bool|Specifies that the material should be partially see-through.}}


%keywords - A list of keywords separated by commas. Examples of keywords are: architectural,brown,gray,grime,hanger,industrial,metal,modern,shed,urban,wall,floor
%keywords - A list of keywords separated by commas. Examples of keywords are: architectural,brown,gray,grime,hanger,industrial,metal,modern,shed,urban,wall,floor
==See Also==
==See Also==
*[[Physically Based Rendering]]
*[[Physically Based Rendering]]
*[[Adding PBR to your mod]]
*[[Adding PBR to your mod]]
*[[Adapting PBR Textures to Source]]
*[[Adapting PBR Textures to Source]]

Revision as of 10:15, 3 August 2023

English (en)Русский (ru)Translate (Translate)
Shader-ball.png

PBR It uses many different texture maps to create a more accurate simulation of light.

Note.pngNote:Similar unrelated PBR-based shaders are also used in Titanfall branch Titanfall branch and Source 2 Source 2.

Supported Parameters

Basics

$basetexture $basetexture2 $flags

$flags_defined
Todo: What do flags do?

$flags2 $flags_defined2

Appearance

$basetexturetransform $color $color2 $frame $frame2 $srgbtint

Flashlight=

$flashlighttexture $flashlighttextureframe

PBR

$mraotexture $mraoframe $mraotexture2 $mraoframe2 $parallax $mraoscale $mraoscale2 $parallaxdepth $parallaxcenter $blendtintbymraoalpha

Portal 2: Community EditionPaint

$paintsplatnormalmap $paintsplatbubblelayout $paintsplatbubble $paintenvmap

Lighting

$bumpmap $bumbframe $bumpmap2 $bumbframe2 $normaltexture $emissiontexture $emissionframe $emissiontexture2 $emissionframe2 $emissionscale $emissionscale2 $hsv $hsv_blend

Reflection

$envmap

{{MatParam|$envmapparallax|matrix|
Todo: What is this?
Should be in this format: <nowiki>[1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]</nowiki

$envmapframe $envmaporigin $bdrf_integration

Transparency

$alpha $alphatestreference

%keywords - A list of keywords separated by commas. Examples of keywords are: architectural,brown,gray,grime,hanger,industrial,metal,modern,shed,urban,wall,floor

See Also