Eine kleine Studie über Reaktionsdiffusion-Shader. Zwei sehr beeindruckende Shadertoys.
Das "Feuer" ist vom Shadertoy FireReaction ( https://www.shadertoy.com/view/wtSGRc von wyatt). Hier werden Treibstoff, Sauerstoff, Flame und "Nichts" (Kohlendioxid) in den RGB-Werten in den vier Buffern zu einem beeindruckenden Flammenspektakel berechnet.
Das "Wasser" ist vom Shadertoy PaintStreams ( https://www.shadertoy.com/view/WtfyDj von michael0884). Hier werden für die Partikel die Position, die Geschwindigkeit und das Gewicht in den drei Buffern zu einer tollen Flüssigkeitssimulation berechnet. Da die drei Größen jeweils zwei Werte beinhalten ( XY-Werte, bzw 2 Gewichtstypen), aber ein Image nur aus 4 Float-Werten besteht ( RGBA ) hat sich der Autor einen tollen Trick einfallen lassen. So werden die Position und die Geschwindigkeitswerte in ein Float "gepackt". In Shadertoy wird für die Kodierung und Dekodierung die beiden Funktionen floatBitsToUint() und uintBitsToFloat() verwendet. Diese existieren aber in DCTL nicht. Ferner mußte eine Lösung für texelfetch() -Funktion gefunden werden. Im Nachhinein ist die Lösung sehr einfach. Ich habe hier aber sehr lange einem Fehlerbild hinterhergejagt, das so gar nicht existierte. Die fehlende Debugmöglichkeit hätte mich hier fast aufgeben lassen. Schließlich hat's aber funktioniert.
Eine tolle Spielwiese
Das Intro ist vom Shadertoy TextCandy ( https://www.shadertoy.com/view/4sfGRH von CPU) konvertiert.
---------------------------------- English ------------------------------------
A little study of reaction diffusion shaders. Two very impressive shadertoys.
The "fire" is from Shadertoy FireREaction (https://www.shadertoy.com/view/wtSGRc from wyatt). Here, fuel, oxygen, flame and "nothing" (carbon dioxide) are calculated in the RGB values in the four buffers to create an impressive spectacle of flames.
The "water" is from Shadertoy PaintStreams (https://www.shadertoy.com/view/WtfyDj from michael0884). Here, the position, speed and weight of the particles in the three buffers are calculated for a great liquid simulation. Since the three sizes each contain two values (XY values, or 2 weight types), but an image only consists of 4 float values (RGBA), the author came up with a great trick. The position and the speed values are "packed" into a float. In Shadertoy, the two functions floatBitsToUint () and uintBitsToFloat () are used for coding and decoding. However, these do not exist in DCTL. We also had to find a solution for the texelfetch () function. In retrospect, the solution is very simple. But for a long time I chased a bug that didn't even exist. The lack of a debugging facility almost made me give up here. But in the end it worked.
A great playground
The intro is converted from the Shadertoy TextCandy (https://www.shadertoy.com/view/4sfGRH from CPU).