Class Shading
-
Method Summary
Modifier and TypeMethodDescriptionstatic ShaderNodeboxUv(float scale) Texture coordinates that follow the surface on every face: the world plane the normal faces most, so walls do not smear a pattern seen from above.static ShaderNodedistanceFade(float from, float to) 1 near the camera and 0 beyondto, for fading detail out with distance.static ShaderNodefill(ShaderNode distance, float softness) Turns a signed distance into coverage with a soft edge: 1 inside, 0 outside.static ShaderNodefresnel(float power) Schlick style edge factor: 0 facing the camera, 1 at grazing angles.static ShaderNodeheightFade(float from, float to) 1 belowfromand 0 abovetoalong world height, smoothly between.static ShaderNodeopaque(ShaderNode rgb) OpaqueVEC4from aVEC3colour.static ShaderNoderamp(ShaderNode t, ShaderNode a, ShaderNode b, ShaderNode c) A smooth three colour ramp:aat 0,bat 0.5,cat 1.static ShaderNoderim(ShaderNode color, float power) A coloured glow along the silhouette.static ShaderNodescroll(ShaderNode uv, float u, float v) A texture coordinate that scrolls with time.static ShaderNodesdBox(ShaderNode p, ShaderNode center, ShaderNode halfSize) The signed distance to an axis aligned box: negative inside.static ShaderNodesdCircle(ShaderNode p, ShaderNode center, float radius) The signed distance to a circle: negative inside.static ShaderNodesdSegment(ShaderNode p, ShaderNode a, ShaderNode b) The distance to a line segment.static ShaderNodestroke(ShaderNode distance, float width, float softness) A band ofwidtharound the zero line of a signed distance: outlines, rings, foam lines along a shore.static ShaderNodeworldUv(float scale) Texture coordinates from world position seen from above, so a pattern tiles across meshes without seams and ignores their UVs.
-
Method Details
-
fresnel
Schlick style edge factor: 0 facing the camera, 1 at grazing angles.
Parameters
power: higher keeps it closer to the silhouette; 5 is physical
Returns
a
FLOAT -
rim
A coloured glow along the silhouette.
Parameters
-
color: aVEC3 -
power: how tight the rim is, 2 to 8
Returns
a
VEC3, for theEMISSIVEhook -
-
heightFade
1 below
fromand 0 abovetoalong world height, smoothly between. Both stages.Parameters
-
from: the height where the fade starts -
to: the height where it ends
Returns
a
FLOAT -
-
distanceFade
1 near the camera and 0 beyond
to, for fading detail out with distance. Both stages.Parameters
-
from: the distance where the fade starts -
to: the distance where it ends
Returns
a
FLOAT -
-
worldUv
Texture coordinates from world position seen from above, so a pattern tiles across meshes without seams and ignores their UVs. Both stages.
Parameters
scale: repeats per world unit
Returns
a
VEC2 -
boxUv
Texture coordinates that follow the surface on every face: the world plane the normal faces most, so walls do not smear a pattern seen from above. A cheap one sample stand-in for triplanar blending.
Parameters
scale: repeats per world unit
Returns
a
VEC2 -
scroll
A texture coordinate that scrolls with time. Both stages.
Parameters
-
uv: aVEC2 -
u: units per second along u -
v: units per second along v
Returns
a
VEC2 -
-
sdCircle
The signed distance to a circle: negative inside.
Parameters
-
p: aVEC2point -
center: aVEC2 -
radius: the radius
Returns
a
FLOAT -
-
sdBox
The signed distance to an axis aligned box: negative inside.
Parameters
-
p: aVEC2point -
center: aVEC2 -
halfSize: aVEC2of half the width and height
Returns
a
FLOAT -
-
sdSegment
The distance to a line segment.
Parameters
-
p: aVEC2point -
a: aVEC2end -
b: the otherVEC2end
Returns
a
FLOAT, never negative -
-
fill
Turns a signed distance into coverage with a soft edge: 1 inside, 0 outside.
Parameters
-
distance: a signed distance -
softness: the width of the edge
Returns
a
FLOAT -
-
stroke
A band of
widtharound the zero line of a signed distance: outlines, rings, foam lines along a shore.Parameters
-
distance: a signed distance -
width: the band width -
softness: the width of its edges
Returns
a
FLOAT -
-
ramp
A smooth three colour ramp:
aat 0,bat 0.5,cat 1.Parameters
-
t: aFLOAT -
a: aVEC3 -
b: aVEC3 -
c: aVEC3
Returns
a
VEC3 -
-
opaque
Opaque
VEC4from aVEC3colour.Parameters
rgb: aVEC3
Returns
a
VEC4with alpha 1
-