module CrShader::Language::Builtins::Spatial

Overview

Built-in variables available in 3D Spatial shaders (shader_type :spatial).

Defined in:

crshader/language/builtins.cr

Constant Summary

ALBEDO = Types::Vec3.new

Diffuse albedo surface color in range [0.0, 1.0].

ALPHA = 1.0_f32

Opacity / transparency channel in range [0.0, 1.0].

ALPHA_HASH_SCALE = 1.0_f32

Alpha hash scale factor for hashed alpha testing.

ALPHA_SCISSOR_THRESHOLD = 0.5_f32

Alpha scissor threshold value for alpha-tested materials.

ANISOTROPY = 0.0_f32

Anisotropic highlight direction and flow factor.

ANISOTROPY_FLOW = Types::Vec2.new

Anisotropic tangent flow vector.

AO = 1.0_f32

Ambient occlusion darkening factor [0.0, 1.0].

ATTENUATION = 1.0_f32

Attenuation factor for the light source (light processor only).

BACKLIGHT = Types::Vec3.new

Backlight illumination factor.

BINORMAL = Types::Vec3.new

Binormal (bitangent) vector perpendicular to normal and tangent.

CLEARCOAT = 0.0_f32

Secondary clearcoat specular reflection lobe intensity.

CLEARCOAT_ROUGHNESS = 0.0_f32

Roughness of secondary clearcoat layer.

DIFFUSE_LIGHT = Types::Vec3.new

Diffuse light output accumulator (light processor only).

EMISSION = Types::Vec3.new

Emissive light color emitted by surface, added to scene radiance.

FRAGCOORD = Types::Vec4.new

Window-relative fragment coordinates: (x, y, z=depth, w=1/w).

FRONT_FACING = true

True if the current primitive is facing towards the camera.

INV_PROJECTION_MATRIX = Types::Mat4.new(Types::Vec4.new, Types::Vec4.new, Types::Vec4.new, Types::Vec4.new)

Inverse camera projection matrix: transforms from clip space back to view space.

INV_VIEW_MATRIX = Types::Mat4.new(Types::Vec4.new, Types::Vec4.new, Types::Vec4.new, Types::Vec4.new)

Inverse camera view matrix: transforms from camera space back to world space.

LIGHT = Types::Vec3.new

Incident light direction vector (light processor only).

LIGHT_COLOR = Types::Vec3.new

Radiance color of the light source (light processor only).

METALLIC = 0.0_f32

Metallic dielectric/conductor blend factor [0.0, 1.0]. 0 = dielectric, 1 = metal.

MODEL_MATRIX = Types::Mat4.new(Types::Vec4.new, Types::Vec4.new, Types::Vec4.new, Types::Vec4.new)

Model to world coordinate transformation matrix.

MODELVIEW_MATRIX = Types::Mat4.new(Types::Vec4.new, Types::Vec4.new, Types::Vec4.new, Types::Vec4.new)

Combined modelview matrix: VIEW_MATRIX * MODEL_MATRIX.

NORMAL = Types::Vec3.new

Normal vector perpendicular to surface in model/view space.

NORMAL_MAP = Types::Vec3.new

Normal map vector unpacked from tangent space texture.

NORMAL_MAP_DEPTH = 1.0_f32

Depth scale multiplier for normal map perturbation.

PROJECTION_MATRIX = Types::Mat4.new(Types::Vec4.new, Types::Vec4.new, Types::Vec4.new, Types::Vec4.new)

Camera view space to clip space projection matrix.

RIM = 0.0_f32

Rim lighting intensity factor.

RIM_TINT = 0.5_f32

Tint color blend for rim lighting.

ROUGHNESS = 1.0_f32

Surface roughness microfacet factor [0.0, 1.0]. 0 = mirror smooth, 1 = rough diffuse.

SCREEN_UV = Types::Vec2.new

Screen-space UV coordinate in range [0.0, 1.0].

SPECULAR = 0.5_f32

Specular reflectivity coefficient for dielectrics (default: 0.5 = 4% reflectivity).

SPECULAR_LIGHT = Types::Vec3.new

Specular light output accumulator (light processor only).

SSS_STRENGTH = 0.0_f32

Subsurface scattering strength coefficient.

TANGENT = Types::Vec3.new

Tangent vector orthogonal to normal in model/view space.

TIME = 0.0_f32

Global game elapsed time in seconds.

TRANSMISSION = Types::Vec3.new

Translucent light transmission through thin backfaces.

UV = Types::Vec2.new

Primary texture coordinates [0.0, 1.0].

UV2 = Types::Vec2.new

Secondary texture coordinates for lightmapping or detail textures.

VERTEX = Types::Vec3.new

Vertex position in model/view space (vertex stage: read-write; fragment stage: read-only view position).

VIEW = Types::Vec3.new(0.0_f32, 0.0_f32, -1.0_f32)

Normalized camera view direction in camera space.

VIEW_MATRIX = Types::Mat4.new(Types::Vec4.new, Types::Vec4.new, Types::Vec4.new, Types::Vec4.new)

World to camera view space transformation matrix.