Computer Graphics · 2020

Lava

A lava sun made with a custom shader: two textures that warp each other and move over time, painted on a sphere in Three.js.

The trick

The lava doesn't move in a straight line: a cloud texture shifts the lava texture's coordinates, so it warps as if it were flowing. Time pushes the two in different directions.

Hot spots

The clouds' transparency multiplies the lava's brightness. Where red goes past a certain value, the shader lowers the red and raises green and blue: those spots look more yellow, like hotter lava.

Made with

Three.js with a ShaderMaterial: a vertex shader that scales the UVs and a GLSL fragment shader that blends a cloud texture with a lava texture.