Divine Skins
Divine Skins Wiki

Hero material settings reference

Every setting in Deadlock's hero shader in plain English: what each feature does, which texture goes in which slot, and what to avoid.

Advanced

This page lists the settings of pbr.vfx, the shader every Deadlock hero material uses. Keep it open next to the recolor and custom material guides, linked under Next steps. The data comes from Valve's own shader as of build 6779.

What you need

CSDK 12

Source 2 Viewer

A plain text editor

for hand edits

CSDK 12's Material Editor shows these settings as fields and checkboxes. Source 2 Viewer decompiles a hero material so you can compare. You only need the text editor if you edit .vmat files by hand.

Keep it fair

A recolor changes that hero for you everywhere, enemies included. So some settings can make an enemy easier to see. The tables on this page mark every setting:

MarkMeaning
KeepLeave it as the original has it. The game needs it.
OKChanges the look only.
CarefulFine if the hero stays about as bright and as easy to see as the original.
AvoidChanges how easy a hero is to see. Do not use it on hero skins.
No glow, full-bright, see-through, or outline changes

Never make a hero glow, ignore lighting, turn see-through, or lose its outline. Never make a hero very dark either. What's allowed and how to stay safe lists the rules.

Anatomy of a .vmat

A material is a short text file. It holds four kinds of lines.

The four kinds of lines in a .vmat: the shader, F_ feature flags that switch on or off, g_ values for numbers and colors, and texture inputs

Here is a small example for a custom hero body:

Code
"Layer0"
{
	"shader" "pbr.vfx"
	"F_USE_NPR_LIGHTING" "1"
	"F_USE_STATUS_EFFECTS_PROXY" "1"
	"g_vColorTint1" "[1 1 1 0]"
	"TextureColor1" "materials/models/mymod/body_color.png"
	"TextureNormal1" "materials/models/mymod/body_normal.png"
	"TextureRoughness1" "materials/models/mymod/body_rough.png"
	"TextureMetalness1" "[0 0 0 1]"
}
LineLooks likeWhat it does
Shader"shader" "pbr.vfx"Always pbr.vfx for heroes.
Feature flagsStart with F_"1" turns a feature on, "0" turns it off.
ValuesStart with g_Numbers and colors. Colors are lists of numbers from 0 to 1, such as [1 1 1 0].
Texture inputsEnd in 1, such as TextureColor1A path to a source image, or a flat color in brackets.

When you compile, the material becomes a .vmat_c file. Each texture input then points to a compiled texture with a code in its name, such as body_color_png_63291cfb.vtex_c.

Check the shader on new materials

The game's config sets the Material Editor's default shader to environment_texture_set. A brand new material may start on that shader. Always check that the shader reads pbr.vfx.

Feature flags

The Material Editor shows some flags as checkboxes. The labels we know are in bold.

Lighting and outline

FlagWhat it doesMark
F_USE_NPR_LIGHTINGUse NPR Lighting. Deadlock's stylized lighting, with rim light and banded shading. Every hero material needs it.Keep
F_USE_STATUS_EFFECTS_PROXYUse Status Effects Proxy. Lets status effects, like Veil Walker or an ultimate, draw over the mesh. Without it, those effects are missing on your skin.Keep
F_SOLID_COLOR_OUTLINESolid Color Outline. A flat colored outline. g_vSolidOutlineTint sets the color.Careful
F_OVERRIDE_NPR_OUTLINEA custom outline thickness, set by g_flOverrideNprOutlineThickness.Avoid
F_DISABLE_NPR_OUTLINERemoves the outline.Avoid
F_NO_SPECULAR_AT_FULL_ROUGHNESSTurns off shine where roughness is at its maximum.OK
F_UNLITThe surface ignores light and shadow.Avoid
F_SELF_ILLUMSelf Illumination. Makes the surface glow, with a mask, a tint, and a strength.Avoid

Transparency

FlagWhat it doesMark
F_ALPHA_TESTAlpha Test. Cutout transparency, for hair cards and lace. Each pixel is shown or hidden.Careful
F_TRANSLUCENTTranslucent. A see-through surface.Avoid
F_ADDITIVE_BLENDAdds the surface's color on top of what is behind it.Avoid
F_ADVANCED_TRANSLUCENCYExtra see-through options.Avoid
F_WRITE_DEPTH_BEFORE_ALPHA_BLENDINGWrite Depth Before Alpha Blending. Fixes bald or see-through spots when the hero fades out.OK
F_CLOAKThe invisibility and refraction effect.Keep

Never remove F_CLOAK or translucency from a stealth or invisibility look. Keep alpha test cutouts small, like hair strands. Large cutouts make a hero near-transparent.

Guides tell you to tick Write Depth Before Alpha Blending on every new hero material. But Valve's shader allows it only when Translucent is on. On a normal, solid material it may do nothing.

Surface and UV

FlagWhat it doesMark
F_RENDER_BACKFACESDraws both sides of each face.OK
F_USE_FRONT_FACE_NORMALS_FOR_BACK_FACESLights the back side of a face like its front side.OK
F_SHEENA soft cloth sheen.OK
F_GLASSA glass surface.Careful
F_DETAILAdds a detail texture on top.OK
F_SECONDARY_UVUses a second UV set.OK
F_ENABLE_TEXTURE_TRANSFORMSScrolls or rotates the textures.OK
F_VERTEX_COLOR, F_PAINT_VERTEX_COLORSUses the mesh's vertex colors.OK
F_JITTER_VERTICESShakes the vertices as an animation.OK
F_MATERIAL_VARIANT"Material Referencing": builds on another material.OK

Rendering tweaks

FlagWhat it doesMark
F_OVERRIDE_BLOOM_AMOUNTChanges how much bright parts bloom, or glow.Avoid
F_DISABLE_DEPTH_WRITE, F_DISABLE_Z_PREPASSLow-level drawing changes.Keep
F_DO_NOT_CAST_SHADOWSThe surface casts no shadow.Keep

Flags that need or block each other

FlagNeeds
Use Status Effects ProxyNPR lighting, Unlit, or Self Illumination
Solid Color Outline, both outline overrides, and F_NO_SPECULAR_AT_FULL_ROUGHNESSNPR lighting
F_ADDITIVE_BLEND and Write Depth Before Alpha BlendingTranslucent

Some flags block each other. For example, Sheen, Glass, Cloak, and Translucent cannot be combined. Cloak and Status Effects Proxy cannot be combined either.

Texture inputs and how they are packed

The shader packs several input images into one compiled texture. You never pick the compiled format. The compiler does that.

How the shader packs images: color plus metalness becomes g_tColor, normal plus roughness becomes g_tNormalRoughness, tint mask plus rim light mask becomes g_tTintMaskRimLightMask, and ambient occlusion becomes g_tAmbientOcclusion
InputFile suffixPacked intoFormat
TextureColor1 with TextureMetalness1 in alpha_color, _metalg_tColorBC7
TextureColor1 with TextureTranslucency1 in alpha_color, _transg_tColor (translucent or alpha test only)BC7
TextureNormal1 with TextureRoughness1_normal, _roughg_tNormalRoughnessBC7
TextureAmbientOcclusion1_aog_tAmbientOcclusionBC4
TextureTintMask1 (red) with TextureRimLightMask1 (green)_maskg_tTintMaskRimLightMaskBC5
TextureNprOutlineMask1_maskg_tNprOutlineMaskBC4
TextureNprTramsissiveColor1_colorg_tNprTransmissiveColorBC7
TextureSelfIllumMask1_maskg_tSelfIllumMaskBC4
TextureSheenColor1 with TextureSheenRoughness1_sheen, _roughg_tSheenBC7
TextureDetail, TextureDetailMask_detail, _detailmaskg_tDetail, g_tMasks1BC7, BC4
TextureAltColor1 with TextureAltTextureReveal_color, _blendg_tAltColor_RevealBC7
  • Type TextureNprTramsissiveColor1 with Valve's spelling. The typo is in the shader itself. This input sets the color of the hero's shadow side. If shadows look wrong, set it to a flat color.
  • Use the file suffixes. The Material Editor's file picker filters by them. A color image not named *_color may not show up. Rename it, or switch the picker's filter to all images.
  • Source images can be PNG, TGA, PSD, or JPG. TIF, PFM, and SVG also work.
  • Keep the original size. Hero body textures seem to be 2048 x 2048, and Abrams' weapon textures 512 x 512. Check yours in Source 2 Viewer. Use sizes that are a power of two, such as 512, 1024, or 2048.
  • Flat colors become tiny textures. A flat color in a texture input compiles to a small texture with _vmat_g_ in its name.
  • Ship the new compiled files together. A new .vmat_c points to new .vtex_c files with new codes in their names. Pack them all. The recolor guide shows how.

Color values for recolors

These values change color without new images.

ValueDefaultWhat it doesMark
g_vColorTint1[1 1 1 0]Multiplies the color texture. Details stay visible.OK
g_bMaskColorTint1OnApplies the tint only where TextureTintMask1 is white.OK
g_nTextureColorTintMode1Not listedHow the tint mixes: 0 is Multiply, 1 is Preserve Luminance, 2 is Mod2X.Careful
g_vAlbedoContrastSaturationBrightness11 1 1Contrast, saturation, and brightness of the color texture. Keep brightness near 1.Careful
g_vSolidOutlineTintNot listedColor of the solid outline.Careful
g_flOverrideNprOutlineThickness0.2Outline thickness, from 0 to 2.Avoid
g_vSelfIllumTint1, g_flSelfIllumScale1Not listedGlow color and glow strength.Avoid

Many hero materials ship a tint mask. With g_bMaskColorTint1 on, a tint then changes only some parts of the hero.

Texture inputs can hold a flat color instead of an image. Write red, green, blue, and alpha from 0 to 1. To convert a color from 0 to 255, divide each number by 255. The gold from the briefcase guide, 255 192 47, becomes:

Code
"TextureColor1" "[1 0.753 0.184 1]"

For shine and metal:

InputLowHigh
RoughnessBlack: smooth and shinyWhite: matte
Metalness0: does not look like metal1: looks like metal

Settings you cannot change per material

The NPR rim light and shading steps, such as g_flNPRRimLightStrength and g_flNPRDiffuseStepSharpness, are scene settings. The game sets them for the whole scene. A material cannot change them, so adding them to your .vmat does nothing.

Settings to avoid

Leave these alone on any hero material. Each one changes how easy that hero is to see:

KindWhat to leave alone
GlowSelf Illumination, F_UNLIT, or a bloom override
BrightnessA high brightness value, or a tint mode that makes the hero brighter than the original
TransparencyTranslucent, additive blending, or large alpha test cutouts
Stealth looksRemoving F_CLOAK or translucency from invisibility effects
OutlinesRemoving the outline, making it thicker, or giving it a loud color
DarknessVery dark colors that hide a hero in shadows

Common problems

More fixes are in Errors when making mods and Model and skin problems.

Next steps

Credits

This guide is based on the work of these creators. Check out their original work.