tecs.gfx.meshes
Per-view 3D lighting, shadows, ambient probes and environments.
A View owns one lighting configuration. Directional rays, point lights and spotlights illuminate all mesh materials except unlit ones. Three texel-snapped directional cascades and a local-light shadow atlas retain their maps until the scene, camera or relevant settings change. Ambient cubes and environments are independent: one provides diffuse irradiance, the other roughness-dependent specular reflections and the sky.
const lighting = tecs.gfx.meshes.newLighting()
lighting.shadows = true
lighting.ssao = true
world:spawn(tecs.gfx.View({
camera3D = tecs.gfx.newCamera3D({y = 2, z = 6}),
lighting = lighting
}))Module contents
Types
| Type | Kind | Description |
|---|---|---|
Lighting | record | Lights meshes with a directional source, optional fog and an ambient cube. |
Functions
| Function | Kind | Description |
|---|---|---|
newLighting | function | Creates independently mutable lighting settings with the documented defaults. |
Types#
Lightingrecord#
record Lighting ...Lights meshes with a directional source, optional fog and an ambient cube. A View owns these settings. Changes take effect on its next rendered frame.
Members
| Name | Kind | Description |
|---|---|---|
directionX | field | Caller-writable. |
directionY | field | Caller-writable. |
directionZ | field | Caller-writable. |
r | field | Caller-writable. |
g | field | Caller-writable. |
b | field | Caller-writable. |
intensity | field | Caller-writable. |
ambient | field | Caller-writable. |
fog | field | Caller-writable. |
fogStart | field | Caller-writable. |
fogFinish | field | Caller-writable. |
fogR | field | Caller-writable. |
fogG | field | Caller-writable. |
fogB | field | Caller-writable. |
probe | field | Caller-writable. |
probeIntensity | field | Caller-writable. |
shadows | field | Caller-writable. |
shadowScale | field | Caller-writable. |
shadowDistance | field | Caller-writable. |
shadowSplitLambda | field | Caller-writable. |
shadowSplitBlend | field | Caller-writable. |
shadowDepthPadding | field | Caller-writable. |
shadowStrength | field | Caller-writable. |
shadowBias | field | Caller-writable. |
shadowSoftness | field | Caller-writable. |
ssao | field | Caller-writable. |
ssaoScale | field | Caller-writable. |
ssaoRadius | field | Caller-writable. |
ssaoBias | field | Caller-writable. |
ssaoIntensity | field | Caller-writable. |
ssaoPower | field | Caller-writable. |
localShadows | field | Caller-writable. |
localShadowSize | field | Caller-writable. |
localShadowCapacity | field | Caller-writable. |
localShadowBias | field | Caller-writable. |
localShadowSoftness | field | Caller-writable. |
environment | field | Caller-writable. |
environmentIntensity | field | Caller-writable. |
skyboxIntensity | field | Caller-writable. |
environmentRotation | field | Caller-writable. |
directionXfield#
directionX: numberCaller-writable. Sets the X direction in which light rays travel.
directionYfield#
directionY: numberCaller-writable. Sets the Y direction in which light rays travel.
directionZfield#
directionZ: numberCaller-writable. Sets the Z direction in which light rays travel.
ambientfield#
ambient: numberCaller-writable. Sets uniform ambient irradiance before the cube probe.
fogFinishfield#
fogFinish: numberCaller-writable. Sets the world distance where fog becomes opaque.
probefield#
probe: {number}Caller-writable. Supplies 18 non-negative irradiance values, RGB for positive X, negative X, positive Y, negative Y, positive Z, negative Z. An empty array disables the probe. The normal's squared axes blend faces.
shadowsfield#
shadows: booleanCaller-writable. Enables three texel-snapped directional shadow cascades.
shadowScalefield#
shadowScale: numberCaller-writable. Sets shadow-map resolution relative to the larger viewport dimension.
shadowDistancefield#
shadowDistance: numberCaller-writable. Limits shadow coverage in world units beyond the camera near plane.
shadowSplitLambdafield#
shadowSplitLambda: numberCaller-writable. Blends uniform and logarithmic cascade spacing from zero through one.
shadowSplitBlendfield#
shadowSplitBlend: numberCaller-writable. Sets cascade cross-fade width from zero through one half.
shadowDepthPaddingfield#
shadowDepthPadding: numberCaller-writable. Adds non-negative light-space depth for off-camera casters.
shadowStrengthfield#
shadowStrength: numberCaller-writable. Scales shadow occlusion from zero through one.
shadowBiasfield#
shadowBias: numberCaller-writable. Offsets receiver depth to suppress self-shadow acne.
shadowSoftnessfield#
shadowSoftness: numberCaller-writable. Sets the 3 by 3 PCF radius in shadow texels; zero uses one location.
ssaoScalefield#
ssaoScale: numberCaller-writable. Sets AO resolution relative to the viewport, up to one.
ssaoRadiusfield#
ssaoRadius: numberCaller-writable. Sets the positive hemisphere radius in world units.
ssaoIntensityfield#
ssaoIntensity: numberCaller-writable. Scales non-negative ambient occlusion strength.
ssaoPowerfield#
ssaoPower: numberCaller-writable. Sets positive AO contrast before the edge-aware blur.
localShadowsfield#
localShadows: booleanCaller-writable. Enables shadows for lights carrying LIGHTCASTSSHADOWS.
localShadowSizefield#
localShadowSize: integerCaller-writable. Sets each local shadow face edge in pixels.
localShadowCapacityfield#
localShadowCapacity: integerCaller-writable. Limits shadow-casting lights in stable extraction order.
localShadowSoftnessfield#
localShadowSoftness: numberCaller-writable. Sets the local-shadow PCF radius in texels.
environmentfield#
environment: string?Caller-writable. Selects the stable name returned by models.loadEnvironment.
environmentIntensityfield#
environmentIntensity: numberCaller-writable. Scales non-negative specular environment radiance.
skyboxIntensityfield#
skyboxIntensity: numberCaller-writable. Scales the sky background; zero hides it while retaining reflections.
environmentRotationfield#
environmentRotation: numberCaller-writable. Rotates the environment around world Y in radians.
Functions#
newLightingfunction#
function newLighting(): LightingCreates independently mutable lighting settings with the documented defaults.
Returns
| Type | Description |
|---|---|
Lighting | caller-owned settings to attach to a View |