Category Archives: Uncategorized

Archival of formspring answers

From June 2012 to August 2013, I had a ask me anything kinda page on Formspring, a social network/website that hosted such pages (similar to, which I believe came in later). I didn’t realize that it was regarded as a pretty crappy site, so I stuck with it for more than a year… and later in 2013, it was sold and re-branded as, started getting flooded with spam, and finally died last week, in September 2015.

Thankfully, I did export the answers I had written in March 2013, since Formspring added a tool to do so when they announced that they would close or rebrand. It’s a shame that I lost everything between March and August, but here’s what I saved anyway :

Edit : Thanks to Reddit /r/fez user utter_bodge, I was able to recover the text of the few Q&A that I was missing! The answering dates are wrong though, so disregard that.

Collected Formspring Answers


Point Source Energy Decay

When playing with explosions, I was trying to determine how much an explosion’s energy or force is lost as you move away from the source. After Googling a bit, I found out that as per Coulomb’s Law (which relates more to electric forces, but makes sense for pretty much any point energy source), the energy is inversely proportional to the square of the distance. Kudos to Matthew for helping me find that information.

I intuitively knew that this made sense, probably seen it in other places… but I couldn’t explain it. Why 1 / d²?

After thinking a bit more about it, I managed to pull off a simple yet formal proof to this for any point energy source like sound and light… and explosions!

Circles on the water

You have to imagine an infinitely small, even null-sized energy source, like a point light in graphics programming. This point energy source emits energy in all directions equally. So let’s say it emits a single pulse at 0-time.

This source emits a 3D sphere around it, which is very dense and concentrated at first (infinitely dense at t=0) but the same energy spreads and becomes less and less dense. This energy “density” defines how much actually hits a surface or object at any distance.

The energy “particles” (that doesn’t sound right, but it’s conceptual) that form that expanding ring are traveling away from the center at constant speed, we’re assuming no friction or resistance in the surrounding medium. It’s a vacuum.

We know that the area of a sphere’s surface is 4πr², where r is the radius of that sphere. Let’s calculate its area at different times, considering that it grows in radius linearly through time :

t0 : r = 0, a = 0
t1 : r = 1, a = 4π
t2 : r = 2, a = 16π
t3 : r = 3, a = 36π

ti : r = i, a = 4πi

So, now that we know the area, I ask the question : How much “energy density” is contained in one square unit of that sphere’s surface at any given time?

Simply put, that’s the inverse of its area. Since we know that the entire area contains all the initial pulse’s energy, one square unit divided by this entire area corresponds to the amount of energy it contains.

And we want to remove all units here, so let’s calculate the ratio to the size at t=1. That gives… :

t0 : a’ = +∞, ratio = +∞
t1 : a’ = 1/4π, ratio = 1
t2 : a’ = 1/16π, ratio = 1/4
t3 : a’ = 1/36π, ratio = 1/9

ti : a’ = 1/4πi, ratio = 1/i²

There you have it. The amount of energy at time t and an equal distance, is the inverse of the square of that value. That is to say… 1 / d²!

I rest my case. :D

Back up!

After a couple of weeks of downtime, my blog and file server is back up, to my great joy and relief. :D

I have at least two subjects to blog about since I went down :

  • I made a comparison of 5 isotropic specular lighting models to find out which looked best, was most versatile, runs faster, etc. I already relased a PDF with my comparison results, but I’ll make a proper blog article too.
  • And I’ve made a static ambient occlusion sample, which pre-calculates the ambient occlusion values for each vertex of a model, saves it into the vertex colors, and made a simple shader that uses that value to filter out ambient lighting.The intuitive way for that is to use ray casting, but it’s quite slow using TV3D collision. So I’m currently making another implementation that uses GPU-accelerated hemicube rendering at each vertex to get the average luminance at this point, kind of like radiosity. My tests showed that the hemicubes implementation is 10.2 times faster while being more accurate.

I will detail my findings soon!