VR Standard (Source 2 Shader)

From Valve Developer Community
Jump to: navigation, search

VR Standard is a material shader available in <SteamVR Home> SteamVR Home and <Half-Life: Alyx> Half-Life: Alyx. It is a PBR shader supporting many different features, and is the main shader used for Hammer meshes, models and overlays.

Note:This shader is deprecated in <Half-Life: Alyx> Half-Life: Alyx in favor of the VR Complex shader. Most shader parameters are non-functional.

Usage

This shader is a physically based shader with a workflow similar to commonly used PBR shaders, but with a few key differences. It uses texture maps both commonly associated with the metal-rough and specular-gloss workflows. It uses a grayscale map for the full scale of reflectivity along with a metalness map that does not affect the amount of specular light. Like with the metal-rough workflow, an albedo map with both the diffuse and specular color is used.

VR Standard Specular-gloss Metal-rough
Combined diffuse and specular color Diffuse color Combined diffuse and specular color
Reflectivity (grayscale) Specular color
Metalness Metalness
Glossiness Glossiness Roughness

Properties

To do: Add any new properties from HL:A.

Base Properties

Color <texture>
    A texture for both diffuse and (metallic) specular color. Typically you will want to remove any baked in lighting information from this texture.

Uses the file suffix: _color

Color tint <color>
    Tints (multiplies) the color texture with a flat color.

Texture coordinate scale <vector2d>
    Adjusts the U and V scale for this layer. Keep in mind that texture scale can also be adjusted for the entire material on a per-face basis using the texture scale adjustments in Hammer.

Texture coordinate offset <vector2d>
    Offsets the UVs of the material by the specified values.

Texture coordinate scroll speed <vector2d>
    Scrolls the UVs of the material by the specified speed.

Normal <texture>
    Tangent space OpenGL format (+Y) normal map. Use the Legacy Source 1 inverted normals option in the texture settings for DirectX for mat normal maps.

Uses the file suffix: _normal

Reflectance <texture>
    The overall reflectivity level for the layer.

Black: low reflectance materials. (brick, carpet etc) White: high reflectance materials. (polished metal, glass)
Typically this can be set to a single color value for objects that area single surface type. For objects that have multiple surface types you'll want to author a texture map. Because the materials are energy conserving high reflectance materials with tight highlights may appear overall darker in value.
Uses the file suffix: _refl

Reflectance range <vector2d>
    Allows you to adjust the black point and white point for the texture similar to the levels adjustment in Photoshop. Be careful of setting extreme settings on the range sliders as you can easily over compress the value range.


Specular

Specular <boolean>
    Enables specular shading.

Anisotropic gloss <boolean>
    Enables a limited form a anisotropic gloss, allowing the view direction to affect the gloss. Requires a glossiness map with two channels.
Advanced Fresnel controls <boolean>
    Enables additional Fresnel settings.
Fresnel facing <float>
    F0 value. The ratio of reflectance when the material is viewed from head on. Only available as a flat value in this shader.
Fresnel facing range <vector2d>
    To do: Likely meant for a unavailable texture version of Fresnel facing.
Fresnel exponent <float>
    Controls how much the reflectance increases with shallower angles. Larger values pull the highlight further out.
Glossiness <texture>
    Controls the shape of the lighting. This affects both specular highlights and also, to a lesser extent, diffuse lighting.
Black: high roughness, low glossiness and spread out highlights. white: low roughness, high glossiness and tight highlights.
Authored similar to a specmask in the old material system. This map is what is primarily used to achieve variation in specular highlights. Supports anisotropic gloss with the U-axis on the red channel and the V-axis in the green channel.
Uses the file suffix: _gloss
Glossiness range <vector2d>
    Allows you to adjust the black point and white point for the texture similar to the levels adjustment in Photoshop. Be careful of setting extreme settings on the range sliders as you can easily over compress the value range.
Specular cube map <choices>
    Enables ambient specular reflections using cubemaps.
  • None
  • In-game cube map - Picks the closest autogenerated cubemap
  • Artist cube map - Use a hand authored cubemap
Cube map <texture>
    A hand authored cubemap to use with this material.
You will rarely want to hand author a cube map in this fashion. In most cases use the 'in-game cubemap' setting instead to chose the closest auto-generated cube map in your level.
Uses the file suffix: _cube
Cube map brightness <float>
    Multiplier that controls the overall intensity of the cube map. The reflectivity and glossiness of the surface are also factors.
Cube map blur <float>
    Creates a pseudo-blurry reflection effect by picking a lower mip level to apply the cube map at. Blurriness and cube map resolution are not linked. If you increase the resolution of your cube map you will need to adjust the blurriness to compensate.
Cube map radius <float>
    Projection radius for artist cubemaps.
Cube map center <vector3d>
    Projection offset for artist cubemaps.
Specular cube map projection <boolean>
    Enables parallax corrected cubemaps when under the influence of a env_cubemap_box or similar entity.
Disable specular highlights <boolean>
    Disables direct specular highlights, leaving only cubemap reflections.
Metalness texture <boolean>
    Uses a texture instead of a flat value for the metalness map.
Metalness <texture>
    Controls color tinting of the specular highlights. The tint color is based on the underlying diffuse color texture.
Typically used for metal materials but is useful on all surfaces when used sparingly.
Uses the file suffix: _metal
Metalness range <vector2d>
    Allows you to adjust the black point and white point for the texture similar to the levels adjustment in Photoshop. Be careful of setting extreme settings on the range sliders as you can easily over compress the value range.


Lighting

Unlit <boolean>
    Disables all lighting and renders the color with full brightness.

Indirect textures <choices>
    What indirect textures to use.

  • None
  • Artist lightmap - Use a hand authored lightmap and AO map.
  • Ambient Occlution texture - Use a hand authored AO map.
Indirect textures UV 2 <boolean>
    Use a secondary UV map for artist lightmaps and AO. Requires a model mesh with multiple UV maps.
Indirect light <texture>
    An artist authored lightmap.
Uses the file suffix: _lightmap
Indirect scale <float>
    Lightmap scale
Ambient Occlusion <texture>
    Greyscale AO map.
Uses the file suffix: _ao
Ambient Occlusion Strength Direct Diffuse <float>
    How much the AO map affects real-time diffuse lighting.
Ambient Occlusion Strength Direct Specular <float>
    How much the AO map affects real-time specular lighting.

Directional lightmap minimum Z <float>
    Controls the minimum level of lightmap directionality. High values will force the directionality vector to affect the brightness even with low lighting contrasts.

Directional lightmap strength <float>
    How much static lighting can be affected by the view direction and surface normals.


Translucent

Alpha test <boolean>
    Alpha tested transparency where each pixel is either fully opaque or transparent. Uses sharpened Alpha to Coverage.

Alpha test reference <float>
    Controls at what translucency value the material transitions from opaque to transparent.

Translucent <boolean>
    Smooth alpha blended translucency. Unlike alpha blending this can have sorting issues.

Translucency <texture>
    Transparency map for the material. Unlike the Source1 material system this is authored as a normal texture and not as an alpha channel.
Uses the file suffix: _trans
Opacity scale <float>
    Overall multiplier on the transparency
Additive blend <boolean>
    Additive effect that makes the material appear as a glow.
Alpha use 2nd UV <boolean>
    Use a secondary UV map for the translucency map. Requires a model mseh with multiple UV maps.
Glass <boolean>
    Adds glass or water-like Fresnel transparency effects to the material. The shallower a the view angle, the more opaque the surface will be.
Note:This effect can lead to increased sorting issues over standard translucency.
Glass Fresnel exponent <float>
    Controls how much the transparency decreases with shallower angles. Larger values pull the opaque area further out.
Glass Fresnel thickness <float>
    F0 value. Control how opaque the material is when viewed head on.
Glass Fresnel max opacity <float>
    Opacity multiplier.


Blend

Blend <choices>
    Adds secondary layers to the material. The layers can be painted in Hammer Terrain Blending tool or added to a DMX mesh using the VertexPaintBlendParams vertex attribute.

  • None
  • 2-Layer
  • 3-Layer
Blend Normals <boolean>
    Adds layer-specific normal and glossines maps.


Layer variables

Settings for each layer besides the base layer.

Color <texture>
    Color texture for this layer.

Uses the file suffix: _color

Scale <vector2d>
    Adjusts the U and V scale for this layer. Keep in mind that texture scale can also be adjusted for the entire material on a per-face basis using the texture scale adjustments in Hammer.

Reveal mask <texture>
    Modulates at what value the layer becomes visible. Equivalent to the Source 1 $blendmodulatetexture parameter.

Uses the file suffix: _blend

Layer Max <float>
    Maximum opacity of the layer.

Blend softness <float>
    Adjusts how hard or soft the edge of the blend reveal is for this layer. Values closer to 0 will produce a hard edge, Values closer to 1 will create a softer edge.

Border color <color>
    Multiplies the specified color over the border region of this layer.

Border offset <float>
    Shifts the border region of the layer towards or away from the computed reveal mask edge. Typically this is left at 0 (no shift), however, other values can be used to create interesting staining or fake shadowing effects.

Border softness <float>
    Controls the size and softness of the border effect. A value close to 0 will create a border that is small and harder edged. Larger values will create borders that extend further and gradually get softer.

Border strength <float>
    An overall multiplier on the border effect. A value of 0 will effectively turn off the border effect. A value of 1 will leave it a full strength.

Normal <texture>
    Normal map for this layer.

Uses the file suffix: _normal

Reflectance <texture>
    Reflectance map for this layer.

Uses the file suffix: _refl

Glossiness <texture>
    Gloss mapp for this layer.

Uses the file suffix: _gloss


Texture Animation

Texture animation <boolean>
    Simple Sub-UV animation. The texture is zoomed in and the UVs are translated for each frame. The animation frames are not blended, so this has limited usefulness for fluid animation. Since the entire texture moves for each frame, tiled textures will not animate frame-by frame correctly.

  • Off
  • Sequential - Plays the frames from start to end
  • Random - Plays the frames in a random order
Animation grid <integer vector2d>
    Number of horizontal and vertical frames in the texture.
Num animation cells <integer>
    Total number of frames in the texture. If set to less than the number of frames in the grid, the last frames are skipped.
Animation time per frame <float>
   
Animation time offset <float>
    Offsets the animation start time.


Two-sided rendering

Render backfaces <boolean>
    Disables backface culling.

Transmissive Sunlight <boolean>
    Makes part of the incoming light shine through the material to the other side. In order to be energy preserving, this makes the front face appear darker.
Transmissive Thickness <boolean>
    Enables the transmissive thickness texture.
Transmissive Thickness <texture>
    Map used to simulate the thickness of the surface. This acts as a multiplier against the amount of light passing through to shade the back side of the surface.
Uses the file suffix: _height


Self illumination

Self illum <boolean>
    Makes the material glow regardless of lighting. This only affects the material itself unlike a true emissive shader.

Self illum mask <texture>
    Mask texture that controls what portions of the surface are illuminated. The material editor looks for '_selfillum' textures by default.
Self illum tint <color>
    A color multiplier applied over the masked self illuminated areas.
Self illum Scale <float>
    How bright the self illumination is.
A value of 1 will effectively make the surface fullbright in the areas indicated by the self illum mask. Values greater than 1 will boost the self illum effect - pushing the color values towards white.
Self illum Scroll Speed <vector2d>
    Scrolls the self illumination texture separately from the rest of the textures.


Per-instance tint mask

Tint mask <boolean>
    Enables the tint mask.

Tint mask <texture>
    Grayscale mask texture that controls which areas should be color tinted.
Black = no tinting. White = full tinting.
You can specify the color tint directly using the 'color tint' attribute in the material - or more usefully use the 'color' attribute in Hammer to adjust the color tint on a per-instance basis.
Uses the file suffix: _mask


Wind

Per-vertex wind effect controllable with an env_wind entity. To do: The wind strength seems to increase by the distance of the model origin.

Enable wind <boolean>
    Enables the wind effect.

Wind mask low <texture>
    Mask texture for low frequency effects. Dark values will disable movement.
Uses the file suffix: _mask
Wind mask high <texture>
    Mask texture for high frequency effects. Dark values will disable movement.
Uses the file suffix: _mask
Wind random noise <texture>
    Two-channel noise texture.
Uses the file suffix: _noise
Wind flexibility <float>
    How far the mesh is moved by the wind.
Wind low frequency effects <float>
    Slow wide effects like trees swaying.
Wind high frequency effects <float>
    Fast effects like leaves rustling.
Wind speed multiplier <float>
    To do: Check how this is different from wind flexibility.
Wind linearity <float>
    Controls how much each vertex moves in unison. Low values makes the vertices move more in different directions than the general wind direction.


Misc

Do not cast shadows <boolean>
    Prevents the material from casting shadows. It will

Disable Z-buffering <boolean>
    Disables the material from being sorted during rendering. The material will draw last over all other materials.

Disable Z-prepass <boolean>
    Excludes the material from being rendered in the Z-prepass. This may impact performance.

Vertex color provided <boolean>
    Tints the material by the mesh vertex colors. Uses first FBX vertex color map and the DMX color vertex attribute.

Morph supported <boolean>
    Required for models with morph channels.

Overlay <boolean>
    Sets the material up to be used as an overlay.

See Also