I've been working on a flow simulator to incorporate into 2D games. While a true fluid simulation would take into account density, viscosity etc., this simpler approximation uses a predefined grid of velocities that are multiplied with the current velocity of each particle.
Having control of the flow field allows flexibility in how this can be used - randomly placed pulses with textures applied to the particles can be used for floating/falling objects, or a static emitter can form a stream for water or lightning.
The following image uses the same Simplex noise algorithm but at a much more fine-grained scale. The values that created the angles in the previous image are represented here as a gradient between black and white. Creating a static image is fairly easy - 2D noise is needed, and you can use simple coordinates as the inputs for the noise. Looping the noise was a bit more difficult, ultimately needing 4D noise.
The noise that would make up the image had to be mapped to a cylinder first, so that the X coordinate would be circular (end up back where it started) Then, this cylinder had to be bent together at the end, creating a torus, to give a final image that can loop in any 2D direction.
The following image uses the same Simplex noise width an extra modifier added for the time dimensions. As you can see it doesn't loop cleanly - for now my workaround is to reverse the animation after some time. Currently the engine only supports up to 4D noise. The colour values here are clamped to give sharper edges.
Here's the noise in action:
Here I've added a point light source and a normal map to the tilemap. This makes a marked difference in the perceived quality of the graphics.
Moving on to something a little different - 3D raytracing.
I've been working through a wonderful course called Ray Tracing in One Weekend by Peter Shirley (see References tab). This is a very low level implementation - no textures or models are used, all objects in the scene are drawn using scattering and surface normals. I've been adapting the architechture to work with SFML (OpenGL) and plan on adding caustics before moving on to different shapes, lighting, and speed improvements.
-end of page-
I've been working on a flow simulator to incorporate into 2D games. While a true fluid simulation would take into account density, viscosity etc., this simpler approximation uses a predefined grid of velocities that are multiplied with the current velocity of each particle.
Having control of the flow field allows flexibility in how this can be used - randomly placed pulses with textures applied to the particles can be used for floating/falling objects, or a static emitter can form a stream for water or lightning.
The following image uses the same Simplex noise algorithm but at a much more fine-grained scale. The values that created the angles in the previous image are represented here as a gradient between black and white. Creating a static image is fairly easy - 2D noise is needed, and you can use simple coordinates as the inputs for the noise. Looping the noise was a bit more difficult, ultimately needing 4D noise.
The noise that would make up the image had to be mapped to a cylinder first, so that the X coordinate would be circular (end up back where it started) Then, this cylinder had to be bent together at the end, creating a torus, to give a final image that can loop in any 2D direction.
The following image uses the same Simplex noise width an extra modifier added for the time dimensions. As you can see it doesn't loop cleanly - for now my workaround is to reverse the animation after some time. Currently the engine only supports up to 4D noise. The colour values here are clamped to give sharper edges.
Here's the noise in action:
Here I've added a point light source and a normal map to the tilemap. This makes a marked difference in the perceived quality of the graphics.
Moving on to something a little different - 3D raytracing.
I've been working through a wonderful course called Ray Tracing in One Weekend by Peter Shirley (see References tab). This is a very low level implementation - no textures or models are used, all objects in the scene are drawn using scattering and surface normals. I've been adapting the architechture to work with SFML (OpenGL) and plan on adding caustics before moving on to different shapes, lighting, and speed improvements.
-end of page-
Hello! My name is
Bradley Aldridge
and I write