Garry's Mod Wiki

Revision Difference

Shaders/showz#565221

<cat>shader</cat> <title>showz</title> <shader> <description> Outputs the `$BASETEXTURE` of the `.a` or `.r` channel, raised to a power for debugging the depth texture. Outputs the `$BASETEXTURE` of the `.a` or `.r` channel, raised to a power for debugging the depth texture. Use the `r_showz_power` convar to raise the resulting depth image to a power. This number can also be negative: `r_showz_power -1`. <warning> `$BASETEXTURE` works only with capital letters. If you enter it in small letters, the texture will not be added to the material. Also, the texture should be entered after creating the material. For the same reason. </warning> <note>⤶ Use the `r_showz_power` convar to raise the resulting depth image to a power. This number can also be negative: `r_showz_power -1`.⤶ </note>⤶ </description>⤶ ⤶ </description>⤶ <parameters> <item name="BASETEXTURE" type="ITexture"> Texture of depth. Example: `_rt_ResolvedFullFrameDepth`. </item> <item name="alphadepth" type="number"> Selecting a channel of $basetexture for output from a shader. `0` — show `.r` channel; `1` — show `.a` channel. </item> </parameters> </shader> <example> <description> Creation of showz material and output <page>render.GetResolvedFullFrameDepth</page> to HUD. </description> <code> local mat = CreateMaterial("showz_resolvedfullframedepth", "showz", { ["$ALPHADEPTH"] = 0, }) mat:SetTexture("$BASETEXTURE", render.GetResolvedFullFrameDepth()) RunConsoleCommand("r_showz_power", 1) hook.Add("HUDPaint", "showz_test", function() render.SetMaterial(mat) render.DrawScreenQuad() end) </code> <output> ![](https://i.ibb.co/67Zj8Xs2/depthtest.jpg) </output> </example>