Tap a texel, or use the arrow keys, to see the uv its function receives. uvruns from 0 to 1 across the texture from its top-left corner, and lands on the texel's centre, so no texel reads an edge.
Some textures are a function of position: a sunset behind the dominoes, food that a slime mould smells, a slider’s distance field, the shadows props cast on a floor. Computing such a function in every shader that reads it costs too much, so you bake it into a texture when its inputs change. baker.create takes the function and the texture, and writes every texel in your frame.
Allocates memory on the GPU, allows passing data between host and shader.
Read-only on the GPU, optimized for small data. For a general-purpose buffer,
use
TgpuRoot.createBuffer
.
@param ― typeSchema The type of data that this buffer will hold.
@param ― initial Either initial value of the buffer, or an initializer to execute on the mapped buffer. (optional)
Records the texels. A texture with storage usage fills in a compute pass, the pass given or
one of its own on the encoder. Another fills in a render pass per array layer on the encoder.
record(
frame:frames.Frame
frame.
Frame.encoder: TgpuCommandEncoder
Records commands for submission after the recorder returns. submit() replaces this encoder.
Read it at each call instead of keeping it, and let the frame submit it.
encoder);// after `sun` moves
});
texel receives uv from 0 to 1 across the texture from its top-left corner, at the centre of the texel it returns, and the array layer.
It can read buffers, uniforms and textures, and carry fills with pipe, as the jelly world’s floor reads its props: tgpu.fn(cast).pipe(world.inject()).
record writes the first mip level. Record mipmaps after it for the smaller ones.
A texture with storage usage fills in a compute pass, the one you give or one of its own on the encoder. A texture without it, such as an rgba8unorm-srgb one that no kernel can write, fills in a render pass per array layer, so record takes the encoder.