Engine effects: cards, flipbooks and blend modes#
Note. The command is
venin today's builds and becomesfrostat launch, and so do the names built from it.
Coming next. This feature is not in
frostyet. The page is written ahead so you can plan for it; until it ships, nothing here works in thefrostyou have.
Fire, smoke, sparks and glows made from pictures on cards, without writing a shader. Three components and two fields of Mesh, in every 3D game.
Cards#
Billboard = { picture = "art/flame.png", facing = "up", blend = "additive" } is a picture on a card turned to the eye. Every card of one picture is one draw, however many there are.
Flipbook = { cols = 4, rows = 4, fps = 12 } beside a Billboard (or a Mesh) plays a grid of frames from its picture; which frame a card shows is a number of its own, so a hundred flames need not flicker together.
Stretch lengthens a card along its thing's motion: a spark that streaks.
Blend modes on a mesh#
Mesh.blend takes "alpha" (the same as today's "blend"), and three new ones: "additive", "multiply" and "premultiplied". Those three are drawn among the see-through things, the farthest first, write no depth and cast no shadow; what an additive one writes into a blooming frame blooms.
Mesh.shadows = false makes a thing cast no shadow: a glow, a ghost, a light's bulb.
Materials get time and pictures#
A material's functions may read time (the game's steps, in seconds: still the simulation's clock, so a frame put back is the same picture) and call picture(uv) and second(uv). And the alpha a material's fragment returns is honoured: it cuts a masked part and covers by a see-through one.
If you already have a game#
- A game's own component named
Billboard,FlipbookorStretchmust be renamed. - A material that named its own
time,picture,second, or anything beginningfx_orFX_, must rename it. - A
fragmentthat returns an alpha other thancolor.aon a masked or see-through part draws differently: returncolor.athere for the old picture. - A
[stream]game's checksum moves once, as its kept rows leave out a field the engine added later: play it, thenfrost test --write.
No other game behaves differently and no other checksum moves. When it ships, a campfire sample shows it and 3D rendering gets a section on it.