Garry's Mod Wiki

Garry's Mod Wiki

Description

This shader was especially designed to be used with maps, in particular the cube maps(up, down, front, back, left, right), they allow to modify the ambiance of a map.

Parameters

Vector bottomcolor
The top bottom of the texture(used for gradient)
Vector duskcolor
The dusk color
number duskscale
The scale of the dusk
number duskintensity
The intensity of the dusk
number fadebias
The fade bias
number hdrscale
The HDR scale
Vector suncolor
The color of the sun
Vector sunnormal
The normal of the sun
number sunsize
The size of the sun
Vector topcolor
The top color of the texture(used for gradient)
string startexture
Specifies which star texture will be used
number starfade
Determines how visible the stars are
number starscale
Determines the scale of the stars
number starpos
The scroll position of the star texture. Used for texture scrolling. Can be any value
number starlayers
Specifies how many layers of stars should be rendered. Accepts values between 0 and 4. 0 means no stars will be rendered

Example

A basic example that shows how to create a material with this shader and render it. This particular example draws a custom skybox on top of the existing one. It uses g_Sky's default parameters as an example.

local sky_material = CreateMaterial("g_Sky_example", "g_Sky", { ["$topcolor"] = "[0 0 1]", ["$bottomcolor"] = "[0 1 1]", ["$fadebias"] = "1.0", ["$hdrscale"] = "1.0", ["$sunnormal"] = "[0 1 0.5]", ["$duskcolor"] = "[1 0.4 0]", ["$duskscale"] = "1", ["$duskintensity"] = "1.0", ["$suncolor"] = "[1 1 1]", ["$sunsize"] = "1", ["$startexture"] = "skybox/starfield", ["$starfade"] = "1", ["$starscale"] = "1", ["$starpos"] = "1", ["$starlayers"] = "0" }) local maxs = Vector(64, 64, 64) local mins = -maxs hook.Add("PostDrawTranslucentRenderables", "", function(a, b, c) if b or c then local sun_info = util.GetSunInfo() sky_material:SetVector("$sunnormal", sun_info.direction) cam.Start3D(vector_origin, EyeAngles()) render.SetMaterial(sky_material) cam.IgnoreZ(true) -- Swapped mins and maxs so that the box will render inside out render.DrawBox(vector_origin, angle_zero, maxs, mins, color_white) cam.IgnoreZ(false) cam.End3D() end end)

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...