Tags / Posts

Ray-tracing like Bokeh in Unity

developing a GPU compute shader to do stochastic samping focus blur

Focus blur is a technique in computer graphics to create the bokeh affect that occurs in photography when real lenses with (inevitably) non-zero sized apertures are used. The lens must be focused at a specific distance and any objects either in-front or behind that focus distance will be progressively blurred. The kind of bokeh that occurs depends upon the many tradeoffs that went into the design of the lens. [Read More]

Logic Pro Scripter Library

8bit sound effects, modal transposition, tempo ramps, and randomized MIDI delay

I’ve just put up a small library of Logic Pro MIDI Scripter scripts. I created these because I couldn’t find this functionality elsewhere. Hopefully you find these useful. All scripts are on GitLab. BBC Envelope BBC Envelope recreates the retro 8-bit envelope sound control approach used by the BBC Micro and many others back in the ‘80s. This script works by breaking down each input note into a sequence of sub-notes in a similar way to an arpeggiator. [Read More]

Like Kubernetes but Sqwished!

what would it be if I fixed all the things I don't like about Kubernetes?

Last April, as Covid took hold, and as we were locked away in our homes, many took to baking. Instead I decided to re-implement Kubernetes. Those that gave me incredulous looks and suggested i’d gone of the rails - you were probably right. But the thing is, there was so much that frustrated me about it. I know technologies for building distributed, scalable, fault tolerant systems are intrinsically complex. But if there’s one thing i’ve learned in the last decade it’s that it’s important to distinguish between intrinsic and extrinsic complexity. [Read More]

Caustics Simulation in Unity

Part 4 in a series about creating a realistic water simulation and rendering

Caustics are ripples of light projected onto surfaces behind the refracting surface when light shines through. Caustics have the effect of concentrating light in very distinctive bands because when the refracting surface deforms it acts like a complex lens dynamically bending and focusing the light. Like the refraction, caustics are relatively straightforward to implement in ray-tracing though very computationally expensive. I could find no implementations of real caustics in Unity. The approaches I found use some kind of animation with static baked caustic textures that are warped in a wave-like fashion. [Read More]

Refracting Water Surface in Unity

Part 3 in a series about creating a realistic water simulation and rendering

Refraction is the physical phenomena that distorts views through the boundary between two transparent materials that have differing refractive indices. Common examples are looking into water or through a lens. This is very easy to achieve with ray-tracing because it closely simulates the physical process of light moving around a scene. Today (2021) ray-tracing can only be done offline or with limited complexity scenes on the latest hardware. Most games today use a technique called rasterization which is much faster but has many limitations. [Read More]

Creating the Physics of Water Movement

Part 2 in a series about creating a realistic water simulation and rendering

In this section we are going to look at simulating the movement of the water surface. We model the surface as a 2D grid of particles. These particles then form the basis of a mesh by rendering triangles between them. A particle is modelled as a point in space with a mass and velocity vector. Each particle is connected to each of its immediate eight neighbours. That is four to the left, right, in-front, and behind, then the diagonals. [Read More]

Physical Simulation of Water

creating a realistic simulation of water with refraction and caustics in Unity

Simulating water has been a nerdy hobby of mine for a long time now. My first attempts were on the game Downstream Danger back in 1985. There were a few pre-defined animations for waterfalls and streams. In 1999 I got into DirectX and 3D games development on Windows. I started a game with the working title of Microcosm, but unfortunately I never got it completed. It had landscapes comprised of fractal mountains with simulated erosion. [Read More]

Getting Random

Searching for and finding randomess

Getting real randomness in computers is quite hard. Most randomness is pseudo-random using some algorithm to create predictable but random looking output. In the early days these could be simple linear-feedback shift register approaches such as those used in early 8-bit computer sound chips like the Texas Instruments SN76489 that I used on the Memotech MTX. Nowadays we use more complex approaches but without some real randomness they are still predictable. [Read More]

Fractal Nature of Life

What are the properties of life?

I do a lot of walking in the countryside, and it was on one such walk earlier this year, that I stopped to take in the vista shown below. It was late autumn/fall, and due to a combination of a hot summer, and recent fine weather, the golden foliage had not fallen as yet. As I allowed myself to become absorbed in the structure around me, I was thinking about how nature creates such rich and beautiful scenes. [Read More]

Frequency Analysis of Fractals with Fourier Transforms

Exploring the characteristics of various fractals using frequency analysis techniques.

Fractals, by definition, have patterns that occur on many scales. This scaling can be in either the time or spatial dimensions. Because patterns repeat, and those patterns occur with different frequencies, due to their scale, they ought to be amenable to analysis by Fourier transforms. Fourier transforms are an efficient technique for decomposing a signal in the time or spatial domain into the frequency domain. So, for example, if a recording of music were put through a Fourier transform, the result would be the musical notes that constituted it, as well as all the harmonics of the instruments that played it. [Read More]

FitBark / Comb9 Integration

How to get a low battery notification, activity tracking, and more...

I recently purchased a FitBark dog activity tracker. I always check now to see if there is some kind of API available with products like these, so that you can capture and use the data in ways other than the manufacturer intended - it turns out with FitBark there is. Although you might think the primary purpose of a device like this is to see just how much running around your dog does, you kind of already know that - though the ability to compare that to other dogs can either make you feel smug, or guilty. [Read More]

Extreme Aquarium Automation

Exposé on home-made, handmade, aquarium automation setup

This post describes my current aquarium setup, in particular, the technical, custom designed parts of it. There is a lot of monitoring and control going on; though virtually all of it is hidden behind the scenes, as my aim has always to create a natural looking environment. An aquarium is an eco-system, some aspects of it can stay in natural balance with maintenance, and other parts require active control. Things are more complicated with plants - I recently have become more serious about growing plants. [Read More]