@awaken/render
The WebGPU rendering package: the Renderer, the render-settings and post-effect stack, cameras and render-layer culling, lights and cascaded and point-light shadows, render textures, Simulations and their update passes, texture probes, primitive meshes, the hook material system, GPU compute, and device setup. It depends only on @awaken/core.
This page is the API surface; for how a frame is drawn (PBR lighting, shadows, post-processing) see the Rendering section.
ts
import { Renderer, initGPU, defaultRenderSettings, cubeMesh } from "@awaken/render";You set the device up once, upload assets and settings as they change, then hand the renderer a World and camera matrices each frame:
Everything below Renderer.render is internal. See Rendering Pipeline Overview for what each pass does.
device
WebGPU setup and capability probing. Awaken asks for optional features when the adapter has them (indirect-first-instance, texture-compression-bc, timestamp-query) and branches on GPUCaps where they are absent.
| Symbol | Signature | Description |
|---|---|---|
initGPU | (canvas, maxDpr = 2) => Promise<GPUContext> | Request an adapter + device, configure the canvas, and return the context. Throws WebGPUUnsupportedError if WebGPU is unavailable. |
GPUContext | interface | { canvas, device, context, format, caps, adapterInfo, adapter?, depthTexture, depthView, width, height, renderScale, maxRenderPixels?, resize(), reconfigure() }. reconfigure() configures the canvas again for a page returning from the background. |
GPUCaps | interface | { indirectFirstInstance, maxStorageBuffersPerStage, textureCompressionBC, timestampQuery, maxTextureDimension2D }. |
WebGPUUnsupportedError / GpuStartFailure | class / "no-webgpu" | "no-adapter" | "device-failed" | Why WebGPU could not start. |
onGpuError | (fn | null) => void | Route WebGPU validation errors to a sink (the editor's Console). Repeats of one message are throttled to one counted line a second. |
effectiveRenderScale | (cssW, cssH, dpr, renderScale, maxPixels) => number | The backing-store scale after renderScale and the pixel budget. |
probeAdapters | () => Promise<AdapterOption[]> | Detect a discrete + integrated GPU choice (empty when there is only one). |
savedGpuPref / setGpuPref | () => GPUPowerPreference / (pref) | Read/write the persisted GPU power preference. |
textureCompressionBCSupported | () => boolean | Module-level mirror of BC support (so the import dialog can gate compression without a context). |
renderScale (0.25–1) sets the internal render resolution; maxRenderPixels caps the pixel count whatever the canvas size (0 = off). See Performance.
Renderer
The WebGPU renderer. Construct it with new Renderer(ctx, opts?). opts.editor takes createEditorKit (the grid, picking, selection outline and camera inset); a shipped game passes nothing and compiles none of those shaders. opts.deferPipelines compiles nothing at construction: the loader calls preparePipelines(world) once the scene is in.
Frame & scene
| Method | Signature | Description |
|---|---|---|
render | (world, view, proj) => void | Draw one frame from the given camera matrices. |
needsDraw | (view, proj) => boolean | Whether render would show anything the canvas does not already hold. The player skips frames that return false. |
requestDraw | () => void | Force the next frame to draw (scripts: api.requestDraw()). |
onDrawRequest | setter | Called when the renderer goes from nothing to draw to something to draw, so a slowed frame loop can wake. |
pick | (world, view, proj, px, py, mask?) => Promise<Entity | null> | GPU id-buffer pick at a device pixel; mask skips render layers. Returns null on a renderer built without the editor kit. |
invalidate | () => void | Mark the draw cache stale. |
syncTransforms | (world, worldMats, entities) => void | Push moved entities' matrices and material fields into the instance buffers without a rebuild. |
syncLights | (world, worldMats) => void | Re-gather the lights for the next frame (walks light entities only). |
setStepTransforms | (steps | null) => void | Per-fixed-step matrices, so a Simulation's camera steps draw each step as it was. |
moveObject | (e, mat) => boolean | Fast-path single-object matrix update (false if a rebuild is needed). |
setCullingMask / cullingMask | (mask) => void / number | The screen pass's render-layer mask, from the screen camera's cullingMask or the Scene view's Layers menu. |
sceneBounds | () => { x, y, z, r } | null | A sphere around every drawn object, from the cache's bounding spheres. |
preparePipelines | (world, opts?, onProgress?) => Promise<number> | Compile, asynchronously, the pipelines this scene draws with. |
pipelineStats | () => { mode, created, warmed, late } | late names pipelines a deferred renderer compiled synchronously on first use. |
getStats | () => RenderStats | Per-frame stats: draw calls, vertices, batches, instances, shadow draws, CPU rebuild/cull ms, GPU pass timings (-1 without timestampQuery), point-shadow slots and bakes, and targetPasses. |
Assets
| Method | Signature | Description |
|---|---|---|
uploadMesh / removeMesh | (id, data, opts?) => void / (id, opts?) | Upload/replace or free a mesh. opts.dynamic keeps it out of static merging (runtime meshes a script rebuilds). |
updateSkinnedMesh | (id, positions, normals?, colors?) => void | In-place vertex rewrite for a CPU-skinned or deformed mesh (same topology). |
uploadTexture | (id, source, roleOverride?) => void | Upload an albedo/normal/mask texture; block-compresses to BC for the local GPU when enabled. |
hasTexture / gpuTextureBytes / textureMemory | (id) / (id) / number | Membership, one texture's VRAM after compression, and the total. |
meshCenter | (id) => Vec3 | null | Local-space AABB centre of an uploaded mesh. |
setMaterials | (list: Material[]) => void | Register the project's materials (flattening extends chains). |
setGlobalParam / getGlobalParam | (name, x, y?, z?, w?) / (name) | A global shader value every material declaring it reads (api.setGlobalShaderParam). |
updateParticles / removeParticles | (handle, data, count, opts, trail?) / (handle) | Per-emitter particle instance buffers, written straight to the GPU. |
setSkyCube | (cube | null) => void | Six RGBA faces (+X −X +Y −Y +Z −Z) as an sRGB cube; null reverts to the gradient sky. |
compute | GpuCompute | The executor behind api.gpu (see GPU compute). |
meshStore, tex, targets, particleBufs | stores | The focused modules the renderer delegates to (MeshStore, TextureStore, RenderTargets, ParticleBuffers). |
Render textures, cameras and Simulations
| Method | Signature | Description |
|---|---|---|
setRenderTextures | (descs: ReadonlyMap<string, RenderTextureDesc>) => void | The project's render textures. Called every frame; a changed desc frees its GPU texture so the next reference allocates the new one. |
setCameraTargets | (passes: TargetCameraPass[]) => void | The cameras drawing into textures this frame, in draw order. Requests a draw only when a pass changed. |
setUpdateShaders | (shaders) => void | The compiled update graphs Simulation steps run. |
setSimulations | (runs: SimulationRun[]) => void | The Simulations to advance this frame (by their host's fixed clock). |
setProbes / probeWindow / probeLanded | (probes) / (key, step) / (runKey) | Texture-probe readback requests, and the windows that have arrived. |
simulationProgress / simulationStepGpuMs | (key) / () | Steps a run has done and its GPU ms per step. |
readRenderTexture | (id) => Promise<RenderTextureReadback | null> | Read a render texture's front half back (rows padded to 256 bytes). |
Configuration & overlays
| Method / Field | Type | Description |
|---|---|---|
setRenderSettings | (s: RenderSettings) => void | Apply the settings bag: shadows, batching, GPU cull, depth prepass, clustering, MSAA, render scale, frame cap, and the effect stack. |
setSelection | (entities: Entity[]) => void | Which entities draw the selection outline (editor kit). |
setGizmo / setOverlay / setToolOverlay | (Float32Array | null) => void | Gizmo triangles, line overlays (camera frustums, collider wireframes), and translucent tool previews (a terrain brush footprint). |
setPreview | ({ view, proj, x, y, w, h, mask? } | null) => void | A camera-preview inset in a swapchain sub-rect (editor kit). |
setPreviewTexture | ({ id, x, y, w, h } | null) => void | Show a render texture in a swapchain rect (editor kit). |
showGrid | boolean | The editor ground grid (hidden in Game/Play). |
outlineColor / outlineThickness | [r,g,b] / number | Selection-outline appearance. |
compressTextures | boolean | Compress RGBA textures to BC at upload when the GPU supports it. |
useGpuCull | boolean | Opt-in GPU-driven frustum culling (needs indirect-first-instance). |
materialTime / materialAnim | number | The clock hook WGSL reads as globals.time, and its speed. |
pointShadowStats | PointShadowStats | Point-shadow slots used and cubes baked this frame. |
render (settings & effects)
Render settings are split into always-present engine config and an add/remove effect stack modelled on Unity's post-process Volume: an absent effect is not applied, so no default fog or bloom leaks into an ungraded import.
| Symbol | Signature / Shape | Description |
|---|---|---|
RenderSettings | interface | shadowStrength, cascadeCount, shadowDistance, shadowCache, staticBatching, staticMergeMaxUses, staticMergeBudgetM, useGpuCull, depthPrepass, clusteredLighting, physicalLightFalloff, drawDistanceScale, msaaSamples, renderScale, maxFps, maxRenderPixels, uiReferenceHeight, and effects. |
defaultRenderSettings | () => RenderSettings | Shadow strength 0.85, 3 cascades, 120 m shadow distance, shadow cache on, batching on (8 uses, 8 M-vertex budget), GPU cull, depth prepass, clustering and physical falloff off, MSAA 1, render scale 1, maxFps 0 (display rate), no pixel budget, uiReferenceHeight 0, and the sky + ambient effects. |
RenderEffects | interface | Base modes tonemap and dither, plus the optional cards sky, ambient, fog, colorGrade, liftGammaGain, shadowMidHigh, bloom, vignette, ssao. |
DEFAULT_TONEMAP | "aces" | What an unset tonemap renders as. |
EFFECT_KEYS | readonly tuple | The add-menu order: ["sky","ambient","fog","colorGrade","liftGammaGain","shadowMidHigh","bloom","vignette","ssao"]. |
EFFECT_LABELS | Record<EffectKey,string> | Display labels ("Color Adjustments", "Ambient Occlusion (SSAO)", …). |
defaultEffect | (key) => Effect | The neutral value for a freshly added effect. |
defaultEffects | () => RenderEffects | A blank scene's stack: sky + ambient (intensity 0.29). |
effectsFromFlat | (FlatRender) => RenderEffects | Convert the flat render bag the Godot/Unreal loaders produce into effects (only the fields the source set). |
SkyEffect | interface | zenith, horizon, ground, optional cube, stars (StarsEffect), sun and moon (SkyBody, with a phase), and sunSquare (0 a disc, 1 a square). |
AmbientEffect, FogEffect, ColorGradeEffect, LiftGammaGainEffect, ShadowMidHighEffect, VignetteEffect, SsaoEffect | interfaces | Per-effect parameter shapes. |
BloomEffect | interface | intensity, threshold, scatter (stored, read by neither mode), tint, and mode. |
tonemap is "linear" (hard clamp, Godot), "aces" (Narkowicz fit, the default) or "acesHill" (Stephen Hill's ACES RRT + ODT fit, then the piecewise sRGB curve). dither: true adds up to one 8-bit code value of noise after the grade, re-rolled every frame. See Post-processing and Render Settings.
bloomChain
| Symbol | Signature | Description |
|---|---|---|
BloomMode | "gaussian" | "mipChain" | gaussian (absent mode): a bright pass and one 5 × 5 blur at half resolution. mipChain: a 13-tap Karis-weighted prefilter, a 13-tap downsample per level and a tent upsample back up (Jimenez 2014). |
MAX_BLOOM_LEVELS / bloomLevels | 7 / (w, h) => number | Mip-chain depth by frame size, 2 to 7 levels. |
effectiveBloomIntensity | (intensity, mode, levels) => number | The intensity shared out over the chain's levels. |
BloomChain / chainPasses | class / (levels) => ChainPass[] | The chain's GPU resources and its pass list. |
volume
| Symbol | Signature | Description |
|---|---|---|
Volume | ComponentType + interface | A post-process volume object: mode (local/global), shape (box/sphere), size, radius, priority, weight, blendDistance, effects, overrides. Fields: Component Reference. |
VolumeZone / EffectOverrides | interfaces | A resolved world-space volume, and per-effect lists of the fields that blend (Unity's m_OverrideState). |
gatherVolumeZones / volumeZoneOf | (world) / (world, e) | Resolve Volume components to zones. |
blendVolumes | (base, zones, eye) => RenderEffects | Blend every zone's effects over the base stack at the camera position, in ascending priority. |
zoneInfluence / zoneContains / zoneDistanceSq | helpers | The weight a zone has at a point. |
migrateZonesIntoScene / zoneToEntityJSON | helpers | Turn a legacy project's flat per-scene volume list into Volume entities. |
camera & orbit
| Symbol | Signature | Description |
|---|---|---|
Camera | ComponentType + interface | Projection (perspective/orthographic), fov, orthoSize, fit, fitAspect, turn, near, far, and the render-texture fields targetTexture, cullingMask, clear, clearColor, order, overrideMaterial. Fields: Component Reference. |
activeCamera | (world) => Entity | null | The screen camera: the first active, enabled camera with no targetTexture. |
cameraMatrices | (world, entity, mats, aspect, view?) => { view, proj } | View + projection for a Camera entity, applying Fit and the portrait turn. |
orthoBounds / cameraTurned / turnedView / turnClockwise | helpers | The orthographic rect after Fit, and the quarter-turn for turn: "portrait". |
perspectiveZO | (out, fovyRad, aspect, near, far) => Mat4 | Perspective projection, WebGPU clip space. |
orthographicZO | (out, left, right, bottom, top, near, far) => Mat4 | Orthographic projection, same view space and depth direction as perspectiveZO. |
lookAt | (out, eye, target, up) => Mat4 | Right-handed view matrix. |
cameraPositionFromView / transformPoint | helpers | World camera position from a view matrix; apply a matrix to a point with perspective divide. |
fitFarPlane | (eye, bounds, min = 1000, max?) => number | A far plane that reaches the scene's bounding sphere, clamped between min and max to keep depth precision. |
OrbitCamera | class | The editor's orbit/pan/zoom viewport camera. |
renderLayers & cameraTargets
| Symbol | Signature | Description |
|---|---|---|
RENDER_LAYER_COUNT | 32 | Layers, named in Project Settings (index 0 "Default"). |
ALL_RENDER_LAYERS / DEFAULT_RENDER_LAYERS | 0xffffffff / 1 | A camera's default mask; an object's default layer bits (layer 0). |
renderLayersOf / cullingMaskOf | (v) => number | Authored values to the u32 the cull compares. |
filterByLayerMask | (visible, layers, mask) => number[] | Drop objects that share no bit with the mask. |
TargetCameraPass | interface | One camera drawing into a texture: entity, target, width, height, view, proj, mask, clear, clearColor, order, overrideMaterial. |
gatherTargetCameras | (world, mats, descs) => TargetCameraPass[] | Every active, enabled camera whose target exists, by order then entity id. |
screenCullingMask / sameTargets | helpers | The screen camera's mask; whether two pass lists draw the same. |
Render layers decide what a camera draws, not what casts shadows. A target pass is the forward colour pass only: no sky, particles, shadow passes, SSAO, post or tonemap. See Render Textures.
renderTexture & renderTargets
| Symbol | Signature | Description |
|---|---|---|
RenderTextureDesc | interface | { name, width, height, format, filter, address, doubleBuffered, clearColor }. |
RenderTextureFormat / RENDER_TEXTURE_FORMATS | union | rgba8unorm, rgba16float, rg16float, r16float, r32float, rgba32float. The two 32-bit float formats are neither filterable nor blendable (rtSampleable, rtBlendable, rtReadError). |
RenderTextureFilter / RenderTextureAddress | unions | linear | nearest; clamp | repeat | mirror. |
RT_DEFAULT_SIZE / RT_MAX_SIZE | 256 / 4096 | Default and largest edge. |
RT_PREFIX / rtTextureId / rtIdOf | "rt:" | A render texture is sampled as texture id rt:<id>. |
normalizeRenderTexture / renderTextureFormatError | helpers | Any input to a valid desc. |
RenderTargets / RenderTarget | class | Allocates a texture on first reference; a double-buffered target keeps a front and a back half. |
selfSampleFilter / encodeTargetDraws | helpers | A pass never samples the texture it writes: a single-buffered target skips those draws, a double-buffered one reads its previous frame. |
simulation, simulationComponent & quality
| Symbol | Signature | Description |
|---|---|---|
SimulationDesc | { name; textures; cameraSlots; steps: SimStep[] } | A Simulation asset: an ordered list of GPU steps. |
SimStep | { kind; enabled; when; graph?; target?; source?; slot?; repeat? } | kind is update (run an update graph into its target, repeat passes, swapping a double-buffered target after each), camera (a bound camera draws its target), clear or copy. when is step (every fixed step) or reset (once after a Reset). |
SIM_MAX_REPEAT | 256 | Most passes one update step runs. |
normalizeSimulation / normalizeSimStep | helpers | Any input to a valid desc; an unknown kind becomes a disabled update step. |
RenderUpdateShader / packUpdatePassUniforms / updatePassLayoutEntries / updateSamplerDesc | types + helpers | The compiled update pass the renderer runs and its uniform and binding layout. |
Simulation | ComponentType | Runs a Simulation asset on its object: simulation, simulateInScene, paused, cameras. Fields: Component Reference. |
SimulationStates / advanceSimulations / gatherSimulationRuns / simulationEntities | class + helpers | Per-entity step counts on the fixed clock, and the runs handed to Renderer.setSimulations. |
SIM_CATCHUP_PER_FRAME / SIM_SKIP_AHEAD | 20 / 600 | A renderer's copy of a run that fell behind (a pipeline compiling, a hidden view) runs at most 20 steps a frame; more than 600 behind, it jumps ahead instead of replaying. |
QualityLevel / QualitySettings | interfaces | Project Settings, Quality: named levels that scale render texture sizes (textures), update-step passes (repeats) and renderScale. |
normalizeQuality / qualityLevel / chosenQualityLevel | helpers | Which level runs: the URL's awaken-quality=<name>, else the one the game saved (api.quality.set), else the default. |
qualityRenderTextures / qualitySimulations | helpers | Apply a level to the descs. |
See Simulations and the Simulation panel.
textureProbe
| Symbol | Signature | Description |
|---|---|---|
TextureProbe | ComponentType | Reads a render texture at its object's position: texture, window (default 24, PROBE_MIN_WINDOW 4 to PROBE_MAX_WINDOW 128), bounds (the world rectangle the texture covers). |
ProbeRequest / ProbeWindow | interfaces | One readback of a texel window around an object, and the floats that came back. |
gatherProbeRequests / probeRequest / worldToTexel | helpers | Requests for every probe after a fixed step. |
sampleProbeWindow / decodeProbeTexels | helpers | Sample a window in world units; decode the readback bytes per format. |
probeHandle / probeOwner / probeGate | helpers | api.probe(entity)'s sample(x, y); which Simulation writes a texture; how many fixed steps may run before a probe's window must land (Project Settings, Time, Probe delay). |
light & shadow
| Symbol | Signature | Description |
|---|---|---|
Light | ComponentType + interface | { kind: "directional" | "point" | "spot", color, intensity, range, spotAngle, layers, castShadows, shadowedLayers }. |
gatherLights | (world, mats) => PackedLight[] | Collect active lights into GPU-packed records. |
lightDrawOrder | (lights, eye) => number[] | Which lights the fixed per-fragment budget keeps: directional first, then by brightness × range over distance. |
LIGHT_FLOATS / writeLightRecord / PackedLight | 16 / helpers | The 64-byte light record. |
ALL_LIGHT_LAYERS | 0xffffffff | Every light layer: the default for Light.layers, Light.shadowedLayers and MeshRenderer.lightLayers. |
lightLayerMask | (v?) => number | An authored mask as the u32 the GPU compares: absent or non-finite is every layer. |
NO_SHADOW_SLOT | 0xffffffff | A light record's "no shadow cube" slot. |
POINT_SHADOW_BUDGET / POINT_SHADOW_HYSTERESIS / POINT_SHADOW_SIZE / POINT_SHADOW_REBAKES_PER_FRAME / POINT_SHADOW_NEAR | 16 / 4 / 256 / 4 / 0.05 | Point and spot shadow cubes: slots per frame, rank slack before a light loses its slot, texels per face, static re-bakes per frame, near plane. |
pickShadowSlots / casterSignature / cubeFaceViewProj | helpers | Slot assignment, the static-caster signature that decides a re-bake, and per-face matrices. |
computeCascadeMatrices | (view, proj, sunDir, count, nearD?, farD?, shadowMapSize?) => { mats, splits } | Cascaded-shadow-map light matrices + split distances. |
directionalLightMatrix | (dir, center, radius) => Mat4 | A single directional light's ortho view-proj. |
holdSunDir / sunHoldThresholdDeg | helpers | Hold the cascade basis until the sun has turned far enough to matter, so a slow day cycle does not re-fit every frame. |
shadowCasterKind | (o) => "none" | "dynamic" | "static" | Which shadow cache a caster belongs in. |
Cascades: up to 4, with static-caster caching. Point and spot lights with castShadows get a cube map while they hold one of 16 slots. See Shadows and PBR & Lighting.
primitives & shape2d
Procedural MeshData generators, used for built-in shapes and collider previews.
| Symbol | Signature | Description |
|---|---|---|
MeshData | interface | { positions, normals, uvs, indices, colors? }: the renderer's canonical mesh shape. |
cubeMesh | (size = 1) => MeshData | Unit cube, per-face normals. |
sphereMesh | (radius = 0.5, seg = 24) => MeshData | UV sphere. |
planeMesh | (size = 1, seg = 1) => MeshData | XZ plane facing +Y (seg subdivides it for vertex-stage hooks). |
quadMesh | (size = 1) => MeshData | Unit quad in the XY plane facing +Z: the sprite/2D primitive (quad builtin id). |
cylinderMesh | (radius = 0.5, height = 1, seg = 24) => MeshData | Capped cylinder along Y. |
capsuleMesh | (radius = 0.5, height = 2, seg = 24, capRings = 8) => MeshData | Capsule (cylinder + hemisphere caps). |
gridLines | (halfExtent, step) => Float32Array | Endpoint positions for an XZ grid. |
Shape2D | ComponentType | A rounded box, circle or capsule in the object's XY plane that builds its own quad and doubles as a 2D collider shape. |
shape2dMesh / shape2dMeshId / shape2dDistance / syncShapes2D | helpers | The quad (shape size carried in its vertex data, so a material can rebuild the signed distance), its mesh id, the CPU distance, and the per-frame mesh sync. |
VERTEX_BYTES / interleaveMesh / computeNormals | 28 / helpers | The interleaved vertex layout. See Mesh format. |
material
Hook-based materials: authored WGSL snippets (vertexPosition, discard, surfaceNormal, surfaceColor hooks, in execution order) plus a typed parameter schema, composed into the base mesh shader at pipeline-build time. A shader that fails to compile falls back to the default pipeline rather than breaking the frame.
| Symbol | Signature / Shape | Description |
|---|---|---|
Material | interface | { version, id, name, hooks, params, unlit?, unfogged?, blend?, interpolators?, globals?, extends?, metadata? }. unlit skips lighting but keeps fog; unfogged skips fog (sky domes, additive FX); extends names a material whose params, globals and hooks this one inherits and overrides. |
MaterialParam | { name, type: ParamType, default, perObject, … } | One parameter. perObject params can be overridden per entity via MeshMaterial.overrides. |
ParamType / PARAM_TYPES | union | "float" | "vec2" | "vec3" | "vec4" | "color" | "bool" | "texture" | "buffer". |
MaterialHooks | { vertexPosition?, discard?, surfaceNormal?, surfaceColor? } | WGSL hook bodies. vertexPosition mutates world, surfaceNormal mutates N, surfaceColor mutates albedo + outAlpha; discard runs before the albedo sample. |
MaterialBlend / MATERIAL_BLENDS | union | alpha (default), additive, premultiplied, min. Pipeline state only; it never changes the composed WGSL (blendStateFor, drawsTransparent). |
MaterialGlobal | interface | A global value a material reads by name (globals.<name>), set at runtime, shared by every material declaring it. GLOBAL_PARAM_SLOTS = 16 lanes. |
flattenMaterials | (list) => Material[] | Resolve extends chains. |
composeShader / composeShaderMapped | (baseTemplate, m, table?) => string | ComposedShader | Compose final WGSL from a template + hooks + generated structs. A pure string splice: it does not compile and cannot fail. The mapped form also returns spans: HookSpan[] so a compiler error routes back to its hook. |
MAX_MATERIAL_TEXTURES / MAX_MATERIAL_BUFFERS | 4 / 2 | Texture and storage-buffer params per material. |
materialReadsClock / materialDisplaces / materialNeedsScenePos | (m) => boolean | Whether hooks read globals.time (keeps the player drawing every frame), displace vertices, or read the scene-position prepass. |
packMaterialParams / materialParamFloats / MATERIAL_PARAM_FLOATS | helpers / 64 | Pack a material's params into a 256-byte per-object slot. |
materialValidationError | (m) => string | null | Reject a malformed schema before compile. |
MaterialCache<P> | class | Dedups compiled pipelines by composed-shader hash; async compile with a fallback. |
There is no built-in material registry: every material comes from the project's materials (authored in the editor or imported from a .awakenmat) and is registered with Renderer.setMaterials. Starter content ships Water.awakenmat, Wind.awakenmat, Water-Graph.awakenmat and Wind-Graph.awakenmat under starter-content/materials/. See the Shader Editor, Shader Graph and Materials.
GPU compute
| Symbol | Signature | Description |
|---|---|---|
GpuCompute | class | The executor behind api.gpu: content declares its own textures (texture), buffers (buffer) and WGSL compute shader assets, then queues write, clear, copy, dispatch and read. A material samples a resource as gpu:<name>. No renderer pass, pipeline or frame binding is exposed. |
GpuTextureFormat / GpuBinding | types | rgba16float, rg16float, r16float, r32float, rg32float, rgba8unorm, r32uint; one binding of a dispatch. |
Shared types
| Symbol | Description |
|---|---|
MeshRenderer | ComponentType + interface: mesh, colour, metallic, roughness, texture, opacity, transparency and sortOrder, shadows, doubleSided, alphaCutoff, emissive, normalTexture, dataVertexColors, vertexColorTint, lightLayers, renderLayers, and instanceTexture / instanceCount (one draw of N instances placed by a render texture's texels). Fields: Component Reference. |
MeshMaterial | ComponentType + interface: { material: string, overrides }. overrides (materialParams) is a sparse map of this object's values for the material's perObject params. |
LodGroup / updateLods / lodLevelFor | Per-object mesh switching by camera distance; updateLods runs per frame in the editor and player. |
MeshPlacer | Puts runtime-generated meshes in the scene for api.mesh.place: pools entities, so a chunk streamer does not bump structureRev per chunk. |
TextureRole / TextureFormat | "albedo" | "normal" | "mask" (drives format + colour space) / "rgba8" | "bc1" | "bc3" | "bc4" | "bc5". |
pickTextureFormat, FORMAT_GPU, shouldCompressTextures, TEXTURE_MEMORY_BUDGET | Format selection by role/content/device. Without an explicit choice, shouldCompressTextures compresses when the textures' uncompressed RGBA with mips exceeds 256 MB. |
encodeBC1 / encodeBC3 / encodeBC4 / encodeBC5 | CPU block encoders used at upload. |
createEditorKit / EditorKit | The editor-only furniture factory passed to the constructor. |
See also
- Rendering Pipeline Overview - how a frame is drawn end to end.
- Render Textures and Simulations - cameras that draw into textures, and GPU steps on the fixed clock.
- PBR & Lighting, Shadows, Post-processing - the feature pages.
- Render Settings - the UI over
RenderSettings+ effects. - Component Reference -
MeshRenderer,Light,Camera,Simulation,TextureProbefields.