Inigo Quilez   ::     ::  
1402 blog posts, written between 2008 and 2016. These are mostly short observations, funny thoughts and word playing. Some are embarrasingly corny, some more deep. I keep it here mostly a little time capsule for myself, organized by month:

July 2015
enough of a reason
besides my office where xmas lights (which are always on) and the glowing xmas tree in the living room (which is a constant), now the balcony has permanent xmas lights as well.

because it's pretty. and that should be enough of a reason!
scientists: "we don't know what it is, but it's most likely dust, comets and asteroids"

reporters: "scientists think it could be aliens!"

scientists: "wait, no, no. it could be anything. as said, probably dust, comets and asteroids"

people: "scientists believe they've found aliens!"
not a render
This is not a render, but a real photograph. However it looks like a render of an incomplete shot - an untextured model with a temporary lighting rig of two diffuse bounces of a blue dome and yellow key. Reality is sometimes cheap and disappointing.

why a princess
There's a new animated Disney movie. And in it, a female protagonist. Regardless of her character (which can be a warrior, a cook, a scientist) the press automatically makes her a "Disney Princess". Why.

Same treatment is not applied to male protagonists, who are only a "Disney Princes" if he actually is to inherit a kingdom.
Why are there American Born Chinese, American Koreans, African American and American Italians, but there are not American French or American Born Swedish?

america - a nation of people of all ethnicities and ancestries...

...properly labeled
what have you done to me
the internet is weird and amazing.

in the less ordinary and unexpected of the places of the internet, i just learnt that zoophilia is legal in Brazil. why anybody was talking about that, and why did we need to know that piece of information, i've no idea. but now it is in my brain, probably forever.

and i though i'd share that pain with you.
crazy trust
driving a freeway, as a concept, is pretty crazy. it means we are all in one of these 1 ton metallic boxes running at 110 km/h. and it also means it only works because we all count on each other's desire to be alive, on each other's survival instincts. and it works. which is crazy.
correct blurring
Quick reminder, if you are doing image blurring or downsizing (or some other linear pixel operation) and your image is a photograph, you probably want to make sure you (or your hardware) is performing inverse gamma correction before accumulating in the kernel and gamma correction after averaging. Otherwise you are going to lose brightness in the image. Well know fact, but usually ignored.

Wrong way to do it:
vec3 col = vec3(0.0);
for( int j=-w; j<=w; j++ )
for( int i=-w; i<=w; i++ )
col += src[x+i,y+j];
dst[x,y] = col / ((2*w+1)*(2*w+1));

Correct way to do it:
vec3 col = vec3(0.0);
for( int j=-w; j<=w; j++ )
for( int i=-w; i<=w; i++ )
col += DeGamma( src[x+i,y+j] );
dst[x,y] = Gamma( col / ((2*w+1)*(2*w+1)) );

Where Gamma() and DeGamma() can be just approximations, such as Gamma(x) = pow( x, 1.0/2.2 ) and DeGamma(x) = pow( x, 2.2 ), or even Gamma(x) = sqrt(x) and DeGamma(x) = x*x if you really are in a hurry.

The image bellow shows on the left side the wrong (and most common) way to blur an image, and the right side shows the result of correct blurring. Note how the correct version does not get darker but retains the original overall intensity after blurring, unlike the one in the left.

If you are in the CPU and need to do the de-gamma yourself, consider using a 256 entry LUT with 16bit fixed point values representing the degammaed domain so that you don't lose perceptual precision.

Reference code here:
internet fact
Internet Fact: every month somebody wants you to see the video of the octopus and the coconut.
nothing new
this morning, in the BART train, there was one person not looking at their phone.
she's not a dream
every night for 50 years he held her hand before falling asleep. once i asked him, "why do you do it", and he replied "to make sure she's not a dream"
mathematical Eve
I sketched some rough mathematical image of Eve, a landscape and some lighting this weekend, inspired by the first shot we see her in Wall-E.

She's made with some ellipsoids and spheres smoothly intersecting each other, described with distance functions. Coloring and lighting is done with some dot products as usual. Shadows are captured by raymarching the distance functions, fade is done with ellipses, reflections are faked with a gradient, the terrain is two sine waves and a texture, fog is an exponential color gradient. All things together, make you think you are seeing Eve in a shot of the movie.

It's incomplete and not necessarily super efficient, but it's certainly real-time and runs on your web browser. I won't complain about the lack of time to do something better, but be grateful because it had been months with no time at all to doodled mathematical images, I finally got some time. And it felt really good!

Image, realtime animation, code and maths, here:

I was in a huge mansion in Beverly Hills the other day. Like those you see in the movies. Pretentious, glamorous, ostentatious, luxurious. Made to awe, made to be desired? I wonder. Maybe.

But I was totally unimpressed.

Many people are successful. Some of them have extraordinary lives but mundane lifestyles. I know some. Others, however, decide to print their success in form of cars, clothes and mansions like this one. And even more surprisingly, this captivates many ordinary people's imagination and fantasies.

I didn't feel whatever chills and tickles these people feel. I must have missed the Sesame Street episode were they teach to admire luxury.
need to take away
yesterday i got stolen my bike again. third time in 3 years. basically, each time i've locked my bike for longer than three hours in the street, it's been stolen.

which is a pretty high ratio but not infrequent here. this might surprise you. because indeed nowhere else in the first world i know of bikes been stolen at this rate. because nowhere in the first world there's this social inequality. because if it had, then it wouldn't be the first world.

basically, the problem is inequality, and the solution is not stronger locks or security or punishment. to many people in this city the few dollars they can get with my bike are totally worth the crime and the risk. which is really sad. i don't blame then. i blame those who think inequality is not a problem but a desirable feature of the system or at best a necessary side effect.
a present, not a job
why are handjob and blowjobs called, jobs? what about handgift and blowpresent?