EFFECTS // THREE.JS
How to make a fire whirl in three.js
In three.js, you can play a fire whirl that spins flames into a 7 m column and loops every 2 seconds. A snippet loads the packed RGBA sprite sheet on a THREE.Sprite, sets the texture repeat to one eighth, and wraps back to frame 0. Godot 4 gets a ready scene that relights the smoke.
- Godot 4 Available
- Unity Manual setup
- Unreal Engine Manual setup
- Roblox Studio Manual setup
- three.js Available
A draft compile is from $0.05, and new accounts start with $5 of usage.
01 // WHAT YOU GET
What you get for fire whirl in three.js
The fire whirl spins its flames into a tall column. A vortex force in the spec does the spinning, so the twist comes from the simulation and not from rotating a sprite. The column is about 4.4 m wide and 7.1 m tall, and it loops every 2 seconds.
You get four PNG sheets of 64 frames, a layout.json with the timing, and previews, which three.js plays through a small material.
02 // HOW TO
Play the fire whirl in three.js
- Ask your agent for the effect (for example "a fire whirl like the example with a slower spin") with
export.packwriting the light from above into RGB and opacity into alpha, so one PNG holds gray shading you can tint. (main_pos.pngas it comes holds three light directions in RGB, not a color.) Load it withTextureLoaderand settexture.repeat.set(1 / 8, 1 / 8). - Put it on a
THREE.Spritewith aSpriteMaterial(transparent: true,depthWrite: false) so it always faces the camera. For the flame, make a second texture in an image editor,main_colour.pngmultiplied by the alpha ofmain_neg.pngsquared, and draw it on a second sprite withTHREE.AdditiveBlending. That texture is normalized, so restore the peak on the flame sprite withmaterial.color.setScalar(emitMax), whereemitMaxisscales.emit_max_hdr. - Each frame, pick the tile: column
i % 8and rowMath.floor(i / 8), then settexture.offset.set(col / 8, 1 - (row + 1) / 8). - Advance
iby 32 frames a second, the fire whirl's real speed (64 frames in 2 s), and wrap it withi % 64so it loops. - Set
sprite.scale.set(s, s, 1)withsthe meters per tile fromlayout.json, a little over 7.1 m for the fire whirl, so it shows at its real size.
03 // ADJUST IT
Adjust the fire whirl for your scene
It works as a set piece: a burning field, a spell gone wrong, a boss arena. Ask your agent for a slower spin, a thinner column or more smoke at the top, and it changes the vortex and the source in the spec.
04 // SETTINGS
Settings in the fire whirl spec
A vortex force along the column spins the gas, and the fire at its base feeds it. A weaker vortex gives a slower, wider whirl.
Ask your agent to change these and compile again; the full fire_whirl spec lists every value.
Is there a fire whirl effect for three.js?
Yes. Ask your agent for a fire whirl with a slower spin, starting from the fire_whirl example and playing the packed sheet.
How do I loop a fire whirl sprite sheet in three.js?
Advance a frame counter at 64 frames per 2 seconds, wrap it modulo 64 and set texture.offset from the column and row.
How do I make a realistic fire whirl in three.js?
Start from a simulated whirl instead of manual particles. A vortex force spins the gas while the fire at its base feeds it.
How do I keep a fire whirl in proportion in three.js?
Keep the Sprite square because every tile is square. Set sprite.scale.set(s, s, 1) using the meters per tile from layout.json.
Should the first and last frames of a fire whirl loop match?
Yes. The fire whirl compile blends its last 12 frames into its first, so frame 64 leads straight back to frame 1 every 2 seconds.
Compile your first effect
You pay per compile and see the price before it runs. New accounts start with $5 of usage.