Skip to content

@v12-engine/render ​

Interfaces ​

NameWhat
Batch betaOne geometry with one material at many places
BatchOptions betaHow a batch is drawn beside its geometry, material and copies (Renderer.batch)
CameraState betaA view's camera, written in place by the game and read each frame
Capture betaA picture read back from the card: its pixels and its size
CaptureOptions betaHow the main view is captured (Renderer.capture)
Card betaThe renderer's things as the card has them (Renderer.card)
Caster betaA thing that would cast the sun's shadow into a cascade, as the game's code is asked of it (Renderer.casters.casts, the client's WorldShadows.casts): once a frame for each cascade it is in, so what decides should be quick
CasterTag betaWhat a batch says of its casters, for the game's code (BatchOptions.caster)
Cull betaWhat one pass culls by
DataRegion betaA rectangle of a level of a layer: the whole of level 0 of layer 0 where left out
DataTexture betaA texture of data the game writes, whole or a rectangle at a time, for a kind's bindings
DataTextureOptions betaHow a data texture is made (Renderer.texture): its size, its texels, its layers or depth, its mips
FrameStats betaWhat a frame drew
Geometry betaA mesh's points on the card, shared by every batch that draws it
GeometryData betaA mesh's points as they are sent to the card (Renderer.geometry)
GeometryParts betaThe parts of a merged geometry: where each starts in the indices (one more: the end), and its box (min, max)
GlowSettings betaThe glow, as a game sets it (the client's WorldGlow.frame works these out from its looks and the hour)
KindMaterialOptions betaWhat a kind's own material is made of
Lamp betaA lamp: every field written in place by who owns it, read each frame
LampOptions betaA lamp as it is added: where it stands, and what is left out taken as said beside each
Lamps betaThe renderer's lamps: lights at a place with a reach, none throwing a shadow, as many at once as max
Material betaWhat a batch is drawn with: a kind of material, its variant and what its bindings are bound to
MaterialKind betaA kind of material: the WGSL its draws run, what of a geometry's vertices and of a copy they read, and what its group of bindings holds. The renderer gives every kind the frame's group (0: Frame, the three cascades and their sampler in the view's pass; Cascade alone in a cascade's) and asks the kind for group 1. flags is a material's variant of the kind, a string the kind reads (cutout, tinted): a shader is made once for each that is used.
MaterialOptions betaA standard material (Renderer.material): a colour, a picture, how its alpha is taken, the sun and the sky
MistArea betaAn area of mist standing over a circle or a box of the map, thick at its base and thinning to its top
MistGround betaThe layer of mist on the ground: thick at its base, thinning to nothing at its top
MistState betaThe mist of the world: its layer on the ground and its areas, either left out for none
Outline betaA way of drawing an outline: written in place by who owns it, read each frame
OutlineLook betaHow an outline is drawn (the client's OutlineLook, less its pulse, which is its width written each frame)
Outlines betaThe renderer's outlines: the ways of drawing them, and what the last frame drew
Picture betaA picture on the card, with its mips
PictureHas betaWhat of a frame's stages is there beside the settings: each stage's targets made yet, and what the view drew
PictureLens betaWhat a cinematic asks of the lens (the client's WorldPicture.lens)
PictureSampling betaHow a picture is sampled (a glTF file's sampler, Babylon's texture's wrapU, wrapV, samplingMode, anisotropicFilteringLevel): what is left out is the renderer's own, repeating, linear between texels and mips, 4 times anisotropic
PictureSettings betaWhat the picture's passes do, each read every frame: the client's MapPictureLook and its quality's knobs
PictureStages betaWhich of the picture's passes a frame draws, and into what: what pictureStages decides of the settings
PostPass betaA game's own pass, once added (Renderer.post.addPass)
PostPassOptions betaHow a game's own pass is added (Renderer.post.addPass), beside its place and its WGSL
ReadView betaThe view as what reads the shadows is measured against it
Renderer betaThe renderer: a canvas, the world's geometries, pictures, materials and batches of copies, a camera, the sun and the sky, and a frame drawn from them
RendererOptions betaHow a renderer is made (createRenderer): what is left out taken as said beside each
ScreenFrame betaWhat the frame draws over the picture, as numbers (the client's ScreenState, its bars already shares by side)
ScreenPicture betaA picture another pass binds: a side view's (SideView.picture), one made of an image (Renderer.picture)
ScreenStages betaWhat the stages draw, written by the client and read every frame
ScreenTransition betaA transition being played. A new object is a new cut: the old shot is taken as the object is first seen, and for as long as it is the one given, its values are read every frame
ScreenVideo betaA video drawn into the picture: its element, and what to draw of it each frame (null: nothing this frame)
ScreenVideoBox betaWhat is drawn of a video in a frame: the client's VideoPlaneFrame, pixels of the page from its top left
SideView betaAnother view of things than the main one: its own camera, lights, batches and target, drawn when asked or with every frame
SkyState betaThe sky's light, from above and from below, written in place by the game and read each frame
Stream betaMany copies of a few vertices with no geometry, each a record of the caller's own, drawn by one instanced draw
StreamOptions betaHow a stream is made (Renderer.stream): its WGSL, its bindings, its record's layout, how many and how it blends
SunState betaThe sun: its light and its shadows, written in place by the game and read each frame
Sweep betaHow far shadows fall: the sun's way, the floor they fall to, and the farthest one is taken to reach
TextureBindingOptions betaHow a texture of group 1 is declared: one or an array of layers, and the kind of numbers it is sampled as
Uniforms betaA block of uniforms of a kind's own: its floats, kept and written in place by who owns it; write sends them
VertexStream betaA stream of a geometry's vertices beside their positions: its name in the geometry and its format. Four bytes or four shorts a vertex for what needs no more (uint8x4: a skin's joints, vec4u in a shader; unorm8x4: its weights, vec4f from 0 to 1; uint16x4: joints past 255): the geometry is then given a Uint8Array or a Uint16Array for the stream
ViewOptions betaHow a side view is made (Renderer.view): what it shows, its size, its camera, its shadows and passes
WorldState betaThe world's terms every material of the view applies after its own light

Functions ​

NameWhat
addPlane betaAdds a plane to a pass's; with a sweep, a shadow counts towards it as far as the sun's way goes into it
blendState betaThe card's state for a way of blending, as Babylon's engine had them: alpha (ALPHA_COMBINE), add (ALPHA_ADD: the source times its alpha, added), multiply (ALPHA_MULTIPLY), and premultiplied, which serves the first two from one shader: a fragment that writes rgb * a with a is laid over, with 0 it is added. untoned: laid over as premultiplied is, and the main view's alpha left the share of the pixel that is not its (a times less): the finish tone maps that share alone and leaves the rest as drawn (the words in the world: post/shaders.ts finish). For the main view alone, whose alpha is otherwise 1 throughout
boxOf betaThe box of a geometry's own points: least x, y, z, then greatest (none: zeros)
boxOut betaWhether a box is out of a pass, its shadow with it
captureSize betaHow big a picture at a scale is: the canvas's pixels times it, no wider or taller than most (the client's viewCaptureSize)
cascadeBias betaA cascade's matrix as the receivers read it (frame.cascades[c], at at in data), moved toward the sun by its bias: its rows are the light's axes scaled by the box's half width (x, y) and by its depth (z), so a world distance along the sun is that times the third row's length, and a texel is the box's width over the map's
copyOut betaWhether copy i of a batch is left out of a pass: its sphere (spheres, four floats a copy) out of the pass with margin more, or, where small things stop casting (castsTo, a cascade's), farther from the eye than its own distance, or, cast into most cascades at most (a cascade's: BatchOptions.cascadesMost), in as many nearer ones already (fallsBefore). What the renderer's keep asks of each copy; the test renderer (testing.ts) asks the same
copySpheres betaA sphere around each copy of a geometry (x, y, z, radius), from the copies' matrices and the geometry's own sphere
createCull betaA pass's planes with none in use, room for the most a pass has
createReadView betaA view to measure against, its planes, corners and axis zeros until setReadView sets them
createRenderer betaA renderer on a canvas: WebGPU's device asked for, the view's, the cascades' and the picture's targets made; not drawing until start
createScreenStages betaThe stages with nothing asked of them
cross betaThe way across both a and b, as long as the area between them (a × b)
debugDrawOf betaWhat Renderer.debug draws the view's batches as
debugPipeline betaWhat a debug draw changes of a kind's view pipeline: the wireframe its topology, the overdraw its blend and depth
dot betaa · b: how far one goes along the other, times the other's length
lookTo betaA view from eye looking along forward
multiply betaa then b
nearestRead betaThe nearest along the view any point of a box (its least and greatest corner) can be inside the view: Infinity where none of it is. Where the box cannot be nearer than below, something not less than below (its nearest corner), without working it out
normalized betaa made of length 1, a new array (one of length 0 stays 0)
orthographic betaA projection without perspective into out: the box from left, bottom, near to right, top, far onto the screen, depth 0 at near and 1 at far
paddedRow betaThe bytes a row takes in a buffer a texture is copied into: a multiple of 256
partRuns betaThe runs of a geometry's parts a pass sees, into out as pairs (the first index, how many): parts side by side are one run. castsTo: parts farther than this from the eye are left out (small things in the shadows), each by its own distance over the last fade. Returns how many runs
patternTurn betaHow far the ordered patterns are turned in frame frames (the frame's frameTurn() in WGSL): an eighth a frame while the frames are blended (blended: the temporal blend on), so a pixel a fade leaves out is on its share of eight frames; 0 where they are not, the pattern standing still (it would flicker). The client's levelFadeTurn
perspective betaA projection with perspective into out: fov the angle up and down in radians, aspect the width over the height, depth 0 at near and 1 at far
pictureStages betaWhich of the picture's passes run for settings, and into what, with what is there (PictureHas: a stage whose targets are not made yet is off that frame; the glow the layers drew is added by the finish). No card in it: what a chain's frame does each frame, and what a test asks of a look. A stage off draws nothing; the last that is on draws onto the screen (or the screen's stages); with none, the plain showing does
placeStale betaWhether the place slot of a pass's kept copies (data, stride floats a place, the matrix first) must be written with the copy whose matrix is at from in matrices: a copy that stands where the one kept there stood is taken as the same (what moved is written, what did not is not sent again), but a place past the kept of the last frame holds nothing to go by: never written, its zeros pass for a copy at the origin (a mesh made in the world's own places, the water's, culled its first frame and never drawn after), or written before a touch it did not see. What the renderer's keep asks of each copy it keeps, unless the batch was touched (then every one is written)
processesPicture betaWhether a look processes the picture: materials then give linear colours and the finish turns them to gamma
samplerBinding betaA sampler at a place of group 1
samplingKey betaA sampling's key: the same sampling, the same sampler; what is left out the renderer's own
screenTakes betaWhether the screen's stages take the picture this frame: something asked of them (a picture kept for a cut, a transition, a video, a blur, the frame). Where nothing is, there is no pass of theirs and the picture's last pass draws onto the screen (PictureHas.screen)
setReadView betaThe view of a camera with perspective at position, looking along z (of length 1), its right and up right, up (of length 1), half as wide as tanX and as high as tanY at a depth of 1, from near to far
sidePlanes betaThe four side planes of a view-projection (left, right, bottom, top; each a, b, c, d of length 1): what a pass culls by. Near and far are left out: nothing stands behind an RTS camera, and the far plane is past the map
sidesOf betaThe sides of a triangle list on the processor, as LINES_WGSL makes them on the card: for tests
smallCastsTo betaThe distance from the eye a small thing stops casting at: its own, between near - fade and near, the same every frame, so small things leave the shadows one by one and not along a line (the client's smallCastsTo)
sphereOf betaThe sphere around a geometry's own points
sphereOut betaWhether a sphere is out of a pass: behind one of its planes, its shadow with it
sweepLength betaHow far along the sun's way the shadow of what reaches up to top falls: to the floor, longest at most
textureBinding betaA texture at a place of group 1
uniformBinding betaA block of uniforms at a place of group 1 (var<uniform>)
unpackRows betaThe rows of a copy (row bytes each, the pixels first) as pixels one after the other, red first (swap: the copy's are blue first)

Values ​

NameWhat
CASCADES betaHow many parts the sun's shadows are in
DEBUG_OVERDRAW betaRenderer.debug: the overdraw
DEBUG_WIREFRAME betaRenderer.debug: the wireframe
FRAME betaWhat every kind's shader of the view's pass begins with: the frame's group (0) and what is read from it. The sun through its cascades (sunlit), the lamps (lamps), and the world's terms a kind applies in this order after its own light: worldHazeShare and the scene's fog, worldSpace, worldCloud, worldMist, worldFogOfWar. The light of a kind, as Babylon's standard material had it: the sky's and the sun's clamped to 1, the lamps' added after the clamp, all of it times the base colour: (clamp(hemi + sun) + lamps(at, normal)) * base. Colour spaces (the client's, spec-post-lights.md A.4). A kind lights with its colours as they are stored (gamma) and applies the scene's fog so. Then worldSpace turns the colour into the space the picture's passes work in: linear (pow 2.2) where the look processes the picture (tone mapping, exposure, contrast, a vignette: the finish turns it back), unchanged where it does not, as Babylon's materials did with and without its image processing. The clouds' shadows, the mist, the fog of war and whatever else a kind lays over (the ground's rings, the sky in the water) come after worldSpace, in the picture's space, their colours taken as that space's. worldOver(colour, at) is all of it in order for a kind with nothing of its own between.
FRAME_PARTS betaThe parts of the renderer's frame on the processor, in their order (FrameStats.cpu): the game's own frame (the callbacks of onFrame), the side views drawn with every frame, the main view's copies culled and kept, the picture's passes set up and the layers', the sun's cascades culled and kept, the frame's uniforms (the lamps binned with them), the copies sent to the card, and the frame graph encoded and submitted (Lite's)
LAYER betaWhat every kind's shader of a layer begins with: the layers' group (0). A kind's own group (1) is its material's, as in the view's pass. A layer's vertex stage places a vertex as the view's does, by layer.viewProjection.
LAYER_GLOW betaThe glow's: the batch's colour (Batch.glow), which the fragment returns, times whatever of its own says where it shines
LAYER_OUTLINE betaThe outline's: after a copy's own record its mark comes in one more location (a vec4f), which the fragment returns through outlineOut
LAYER_VELOCITY betaThe velocity's: after a copy's own record its matrix of the frame before comes in four more locations. The vertex stage gives the place now and the place then, both without the jitter (layer.plain * now, layer.last * then), and the fragment returns velocityOut(position, now, was).
OUTLINE_STYLES betaHow many ways of drawing an outline there are at once
PLAIN_PICTURE betaThe picture as drawn, nothing done to it but the two smoothings: what a map with no look of its own has (the client's PLAIN_PICTURE)
POST_PASS_VALUES betaHow many floats a pass's own values are: four vec4f
POST_PASSES_AT betaHow many of a game's passes one place draws in a frame: the rest are not drawn (said by PostPass.drawn)
POST_PLACES betaThe places, in their order in the chain
SCREEN_VIDEOS betaHow many videos are drawn into the picture at once
SHADOW_BIAS_TEXELS betaHow far in front of what it sees a cascade's depth is read, in its texels along the sun's way: about Babylon's bias for the client's sun (0.001 of a cascade's depth, which its depthClamp fits round the cascade: two texels of a map of 2048, with a normal bias of 0.005 besides; three here, which has none, for no acne on a pine's needles). A share of the cascade's depth as it was (0.0008, times the cascade's number) was six times that and more: the cascades reach CASCADE_BEHIND behind their sphere, so a share of their depth is a long way, and what lies near what shades it (the needles of a pine under the ones above them) was not shaded: a pine lighter and flatter
STANDARD betaThe kind most things are: a colour, a picture, the sun and the sky. Flags: cutout, tinted
TRANSITION_KINDS betaThe transitions the stages draw themselves, by the number their shader takes

Types ​

NameWhat
Binding betaA declaration of one binding of a kind's group
BlendMode betaHow a blended draw is laid over what is behind it
CastsHook betaWhether a thing casts its shadow, in code, over what the culling says (Caster.kept): nothing as it says
DataFormat betaWhat a texel of a data texture is: a byte, four bytes, a float or four floats
DebugDraw betaHow a debug view draws the view's batches: as its sides (lines), each draw added (count), or as they are ('')
LayerName betaThe WGSL of the layers (layers.ts): what a kind's shader of each begins with, and the standard kind's own.
Mat4 betaThe renderer's matrices: 16 floats, the translation at 12..14, a point a row vector times the matrix. The layout the engine's world and the game's files use, and the one WGSL reads unchanged (mat4x4f of the four rows as its columns, m * v). Left-handed, depth 0 at the near plane and 1 at the far.
PictureStage betaA pass after the view's, by its task's name, in their order
PostPlace betaWhere a game's pass goes among the picture's own: before which of them
StreamData betaA stream's values: floats, or bytes or shorts for a stream of that format (VertexStream.format)
Vec3 betaA point or a way: x, y and z, the first three of any array of numbers