Twister

Version 5 of 5

Raymarched twister.

GPU · SDF · today

This version

A real 3D box, twisted in space by rotating each point's xz-plane by its height, sphere-traced with diffuse, specular and rim light.

How this version works

This GPU version renders at a scale of 0.75 and traces perspective rays towards a rounded box twisted around its vertical axis. The twist rotates each sampled point's horizontal coordinates by an angle depending on height and time. Each ray takes up to 160 steps, using the distance estimate multiplied by 0.4, and surface normals come from neighbouring distance samples. The untwisted coordinates choose red or gold faces, while height adds horizontal stripes. Diffuse lighting, a sharp specular highlight and a purple rim contribution shade the surface against a purple gradient background.

The trick in this version

Unlike the scanline versions, this fragment shader evaluates a three-dimensional distance field for every pixel. Multiplying the twisted field's distance estimate by 0.4 reduces marching steps to help avoid stepping through the deformed surface.

Historical context · GPU

  1. 2020 · Nikos Papadopoulos (4rknova)

    The formula, published

    A blog article with live shader sets out the cross-section formula and the visible-edge test.

Platform
GPU · SDF
Era
GPU
Rendered on
GPU
Tags
raymarching · domain twist
Sources
The formula, published (2020)