UnlitTwoTexture: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Took out the shader icon template, feels too extra.)
No edit summary
Line 43: Line 43:
{{MatParam|$CrosshairTint|RGB matrix| Tints the <code>$basetexture</code> when using <code>$CrosshairMode</code>|only={{csgo}}}}
{{MatParam|$CrosshairTint|RGB matrix| Tints the <code>$basetexture</code> when using <code>$CrosshairMode</code>|only={{csgo}}}}
{{MatParam|$CrosshairColorAdapt|float|Used for multiplying the average Luminance of <code>$texture2</code> <br>{{note|Default Value <code>"0.4"</code>}}|only={{csgo}}}}
{{MatParam|$CrosshairColorAdapt|float|Used for multiplying the average Luminance of <code>$texture2</code> <br>{{note|Default Value <code>"0.4"</code>}}|only={{csgo}}}}
{{MatParam|$translucent|bool|[[$translucent]] is a [[Expensive|expensive]] translucency using a full [[Alpha]] mask, for very fine gradients. Uses [[$basetexture]] as the source alpha, and blends [[$texture2]]'s alpha over whatever is opaque.</code>|since={{l4d}}}}
<br>
<br>
<br>
<br>
Line 81: Line 82:
     "$additive"    "1"
     "$additive"    "1"
}
}
</syntaxhighlight>
{{l4d}} {{path|effects/smoke_plumes_anim|vmt}}
<syntaxhighlight>
UnLitTwoTexture
{
"%tooltexture" "effects/smoke_plumes_00"
$basetexture "effects/smoke_plumes_scroll"
$texture2 "effects/smoke_plumes_00"
$translucent 1
$nocull 1
$no_fullbright 1
$nofog 1
$scale "[1 1]"
$scroll "[2 2]"
Proxies
{
LinearRamp
{
resultVar "$scroll[0]"
rate -.01
}
LinearRamp
{
resultVar "$scroll[1]"
rate .035
}
TextureTransform
{
scaleVar $scale
translateVar $scroll
resultVar $basetexturetransform
}
}
}
</syntaxhighlight>
</syntaxhighlight>



Revision as of 04:45, 15 February 2025

  • Two base textures are multiplied together and can be transformed independently. (Just like the Multiply blending mode in typical image editors.)
  • Unrelated to WorldVertexTransition, which is used for making alpha fading transitions between two base textures on displacements.


Note.pngNote:This Shader works on both Brushes and Models
Confirm: Do models require $model in branches before Counter-Strike: Global Offensive?
Tip.pngTip:The same effect can be created using $detailblendmode 8 on UnlitGeneric.

Parameters

$basetexture The first Texture that is used, how it is used depends on the effects which are enabled. By default $basetexture will be multiplied with $texture2.
$frame $basetexturetransform
$texture2 Second Texture that is used in different ways depending on which effects are used.
By default $basetexture will be multiplied with $texture2.

Note.pngNote:First texture is applied via $basetexture.

$frame2 $texture2transform
$color $color2
$beachfoam

Icon-Important.pngImportant:This parameter is intended to be used with $additive.

On the Dangerzone Wave Model, both $texture2 and $basetexture use the 'Beachwaves' Texture.

Todo: Do both Parameters need to use the same Texture?

The 'Beachwaves' Texture uses the RGB channels for different purposes.

Todo: Find a better Name for the Texture...
  • Red Channel : Waves Albedo Texture
Todo: Can this be tinted using $color/$color2?
  • Green Channel : Distortion/Noise for the Red Channel
  • Blue Channel : Distortion/Noise for the Red Channel
Todo: Further documentation required.



$CrosshairMode $texture2 is used for a framebuffer texture.
The result will be blended between Crosshair Texture + CrosshairTint and Crosshair Texture * CrosshairTint using Average Luminance of $texture2 * $CrosshairColorAdapt $CrosshairTint $CrosshairColorAdapt $translucent

Example

Stock .vmt 🖿hl2/materials/models/props_combine/portalball001_sheet.vmt

"UnlitTwoTexture"
{
	"$basetexture" "models/props_combine/portalball001_sheet"
	"$texture2" "models/props_combine/portalball001b_sheet"
 	"$model" 1
	"$nocull" "1"
	"$additive" "1"
	"Proxies"
	{

		"TextureScroll"
		{
			"texturescrollvar" "$texture2transform"
			"texturescrollrate" -.2
			"texturescrollangle" 60
		}
	}

}

Counter-Strike: Global Offensive 🖿models/props/hr_massive/beachwaves/beachwaves.vmt

UnlitTwoTexture
{
    "$beachfoam"   "1"
    "$basetexture" "models/props/hr_massive/beachwaves/beachwaves"
    "$texture2"    "models/props/hr_massive/beachwaves/beachwaves"
    "$additive"    "1"
}

Left 4 Dead 🖿effects/smoke_plumes_anim.vmt

UnLitTwoTexture
{
"%tooltexture" "effects/smoke_plumes_00"
$basetexture "effects/smoke_plumes_scroll"
$texture2 "effects/smoke_plumes_00"

$translucent 1

$nocull 1
$no_fullbright 1
$nofog 1
$scale "[1 1]"
$scroll "[2 2]"
Proxies
{
LinearRamp
{
resultVar "$scroll[0]"
rate -.01
}
LinearRamp
{
resultVar "$scroll[1]"
rate .035
}
TextureTransform
{
scaleVar $scale
translateVar $scroll
resultVar $basetexturetransform
}
}
}

See also