Posts

Caustics 2D

January 15, 2021

This is a 2D shader that uses a Monte Carlo method to render the scene. For every pixel, multiple samples are taken to determine the colour of the pixel. Each sample will have a random direction ray. We will then only check if the ray hits a light source, or misses a light source. If a light source is hit, then that lights colour will contribute to the pixel sample. ...

Iterated function systems

December 22, 2020

In this post I will explain a simple iterated function system, also called IFS. We will start of with explaining the basic transformations that we apply, and finally work our way up to get a result like this. I have also included a live demo below that is hosted on ShaderToy. Click play to run the shader. You can change the scaling parameter with the $y$ value of the mouse, and the rotation parameter can be changed with the $x$ value of the mouse. ...

Nova fractals

December 20, 2020

In the previous post we looked at creating Newton fractals at arrived at the generalized Newton’s method. The method can be generalized even further, which is then known as a Nova fractal. Mandelbrot version of the Nova fractal, with $f(z) = z^3 - 1$, and $z=1$. The Nova fractal is created by using Newton’s method, and adding a parameter $c$ to the end: $$ z_{n+1} = z - \frac{f(z)}{f’(z)} + c. ...

Newton fractals

December 20, 2020

Another interesting set of fractals, are Newton fractals. Newton fractals are created by applying Newton's method to complex function $f(z)$. The method uses the iterated equation $$ z_{n+1} = z - \frac{f(z_n)}{f'(z_n)}. $$ If we want to apply Newton's method, we also need to find the derivative of the function $f(z)$. Since Newton's method is used to find the zero's of a function, if we repeatedly apply it to a point $z$, then $f(z_{n\rightarrow\infty}) = 0$, meaning that every point converges to a root of the complex function. ...

Julia set explorer

December 19, 2020

A live demo of this shader is available on ShaderToy. You can select a point on the Mandelbrot set to see the corresponding Julia set. If the mouse is not used, the point follows a path along the main cardioid. The selected point is displayed in red. Everyone who starts making fractals, usually starts with rendering the Mandelbrot set. If this is rendered on the CPU, per pixel, it will usually take quite some time to render the image. ...

Cracking padded XOR encryption

November 27, 2020

A method for unbreakable encryption, is the one-time pad. To encrypt a message with this method, we need a list of truly random integers with the same length as the message. If we then XOR the ASCII values of the letters in the message, with the list of random integers, the resulting ciphertext is unbreakable. However, most of the time people use a password to encrypt a message. If for example, the password is $\text{code}$, then the letters are used multiple times to encrypt the message. ...

Compartment model for epidemiology

March 14, 2020

This post looks at a compartment model for epidemiology and analyzes the different relationships between the variables in the model. Finally, it draws conclusions about the impact the variables have on the model. SEIRD-model # The population is divided into compartments, with the assumption that every individual has the same characteristics. There are a total of five compartments: Susceptible ($S$) Exposed ($E$) Infected ($I$) Recovered ($R$) Diseased ($D$) The population flows in the following direction between the compartments. ...


© 2022 Lars Rotgers
All rights reserved