Alphatexture: Difference between revisions
Jump to navigation
Jump to search
Tip: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.
Code:See this GitHub PR for how to add this to a custom VRAD.
SirYodaJedi (talk | contribs) (Also useful for higher-resolution shadows) |
SirYodaJedi (talk | contribs) (→Potential usecases: links) |
||
Line 16: | Line 16: | ||
== Potential usecases == | == Potential usecases == | ||
This parameter can be useful in certain niche instances: | 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 {{cmd|$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 {{cmd|$additive}} is used, as no alpha channel will be present and neither {{ent|$translucent}} nor {{ent|$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]] | * When a shader such as {{cmd|Refract}} is used, as no alpha channel will be present and neither {{ent|$translucent}} nor {{ent|$alphatest}} are used, and {{ent|$basetexture}} won't be used as the [[diffuse]] | ||
* If a shader such as Wireframe is used, as $basetexture will not be present | * If a shader such as {{cmd|Wireframe}} is used, as {{ent|$basetexture}} will not be present | ||
* When $alpha is used, as VRAD doesn't account for it | * When {{cmd|$alpha}} is used, as [[VRAD]] doesn't account for it | ||
* For creating a sharp high-resolution texture shadow without bloating the map's filesize, as the shadow-casting texture does not need to be shipped with the map. | * For creating a sharp high-resolution texture shadow without bloating the map's filesize, as the shadow-casting texture does not need to be shipped with the map. |
Revision as of 10:26, 3 April 2025
%alphatexture
is an internal material shader parameter available in 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.


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, as VRAD doesn't account for it
- For creating a sharp high-resolution texture shadow without bloating the map's filesize, as the shadow-casting texture does not need to be shipped with the map.