Alphatexture: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (SirYodaJedi moved page %alphatexture to Alphatexture over redirect: move to prevent external links from being eaten)
No edit summary
Line 3: Line 3:


{{note|As this parameter is only used by VRAD, the VTF mentioned does not need to be shipped with the map if it is unused elsewhere.}}
{{note|As this parameter is only used by VRAD, the VTF mentioned does not need to be shipped with the map if it is unused elsewhere.}}
{{todo|Implementing in custom VRAD; see [https://github.com/Yuis-Archives/source-sdk-2013_vs2022/commit/ea77f7d0172f70f06110b54bc83caf2c5919804d GitHub commit which was used in gmod feature request].}}
{{codenote|See [https://github.com/ValveSoftware/source-sdk-2013/pull/1150 this GitHub PR] for how to add this to a custom VRAD.}}


== Syntax ==
== Syntax ==

Revision as of 14:21, 24 March 2025

%alphatexture is an internal material shader parameter available in Garry's Mod Garry's Mod. Used on static props when the prop is flagged for texture shadows and compiling VRAD with -textureshadows. The alpha channel of the specified VTF will be used instead of $basetexture, even if $alphatest and $translucent are absent.

Note.pngNote:As this parameter is only used by VRAD, the VTF mentioned does not need to be shipped with the map if it is unused elsewhere.
Cpp.pngCode:See this GitHub PR for how to add this to a custom VRAD.

Syntax

"VertexLitGeneric"
{
    $basetexture "models/props_custom/myprop_base"
    %alphatexture "models/props_custom/myprop_alpha"
}

Potential usecases

This parameter can be useful in certain niche instances:

  • When $detailblendmode 4 is used, as the shadows would then make more sense to be cast from $detail
  • When $additive is used, as no alpha channel will be present and neither $translucent nor $alphatest are used
  • When a shader such as Refract is used, as no alpha channel will be present and neither $translucent nor $alphatest are used, and $basetexture won't be used as the diffuse
  • If a shader such as Wireframe is used, as $basetexture will not be present
  • When $alpha is used