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:



<
August 2012
>
doodling
2012-08-30
most of the times you start drawing with an idea in mind, with a target. sure thing there is always room for improvisation, but still, is not very often that you start from a completely white paper and proceed doodling and exploring weird ideas.

today i gave myself 30 minutes (well, basically the computer was busy for 30 minutes so i couldn't use its CPUs anyway) to start from scratch (that includes writing a noise and a voronoi primitive functions) and see if i would hit any reasonably interesting patterns and look. i sort of did, the bottom line being that sometimes it's worth exercising unplanned exploration and roaming unexplored territory for a prefixed short interval of time. planning too much can kill the magic sometimes!

anyway, today's doodle:

oh no
2012-08-28
given that the movement detector in my office most of the times does not detect me (forcing me to switch the lights by hand) and that most of the infrared tap and driers in public restrooms simply don't detect my presence at all, i'm really scared of the incoming fingerprint detection technology for mobile phones. i'm sure i'll be unable to make and respond calls!
a sunny, warm, bright morning
2012-08-26
it's a sunny, warm, bright morning. or noon. or something, it doesn't matter - one of the things i do when i wake up in such gorgeous mornings is to not care about time. that means i don't look to the clock, i only listen to how things feel and go from there. and, things certainly feel good under this sun rays.

just a few minutes ago (oh well, hours) i opened the windows of my bedroom and let the world welcome me to this fantastic day. in return, i shared my morning with the world by playing my favorite movie soundtrack aloud and walking around my apartment doing my morning household chores with those same windows open big. at some point during the soundtrack i decided to jump to the streets and start heading to work. there had not been any particular reason for it to happen at that precise moment instead of any other. it just felt right to do it at that one moment. perhaps a specific chord in the soundtrack had triggered something in my brain and made me take the decision to go out. or it could have been just some purely internal process of my mind. who cares. thing is it felt right to do it then. that's what matters. or well, that's what no-matters, i'd say.

so here i am, in this sunny, warm, bright morning (or noon) walking the streets. everything i see in the world out there, everything i feel in my internal world in here, is all calm, promising, beautiful, easy. just right. i walk relaxed, hands in pockets, with a small grin in my face, and a huge one in my heart. for no other reason than the beauty of this morning (or noon?). indeed i don't recall having to celebrate anything special today. that makes me celebrate this moment of happiness in itself, and life by extension. i think that if i can just celebrate life in its most simple and profound way, then i do have something big worth being happy for.

the sun rays in fall mornings are the sweetest of all sun rays. they delightful cares your cheek, neck and shoulders like no other sun rays of any other season do. they also bounce joyfully on the streets, facades, trees. i walk slowly so i can catch as many of these cheerful rays as i can. for some reason the streets feel pretty empty today. i like it, it almost makes me feel like this rays were reserved for me, like somebody had ordered this sunny, warm, bright morning for me.

or is it noon? i don't know

once upon a time
2012-08-24
i just realized that when Japan and the USA were fighting during second world war, that ocean between them... wasn't exactly the most pacific of the oceans
polysemy in the morning
2012-08-23
i am distracted, as usual when in my morning train ride to the office, thinking of too many things at the same time at a too low intensity for any of them to stand out and bring me back to focus. as all these ideas gamble in front of my consciousness, my eyes do the same with the environment, jumping from one place to another, seeing too many things with a very low level of attention. one of the places where they pose for a fraction of a second is an ad that reads "train for success". if i had read it for a longer time or i hadn't been so distracted i'd have realized this was an ad for an arts school, but instead my brain decides to assume there must be a town called "success" cause the image i have in my mind for a few seconds is this:


a train leaving to Success
oral tradition, still kicking
2012-08-21
one would think that the amount of oral tradition these days is reduced to a few incidental and anecdotal cases, and that since the times of Homer (the greek poet, not the Simpson), about 2800 years ago, the amount of knowledge passed along that is not documented has been reduced to a minimum, if not completely eliminated. for how in a world of infinite media, endless information, regulated education and obsessive systematized could any bit of undocumented product of culture have possibly gone unnoticed?

yet there are niches of such cultural dynamics, sort of living fossils of ancient inefficient and obsoleted human habits. but what these fossils teach us is that in human nature there's still a powerful and authentic desire to learn. so powerful actually that i can't be stopped and sometimes, indeed, it doesn't need protection in any form of normalized education or structured documentation.

in particular, i'm thinking of kid's games. no kidding (well, technically, yes kidding) - i recall tons of games that we kids used to play in our school breaks, or while in the bus to school, during out free evenings after school or during vacations. these were incredibly fun games, pretty damn well designed too, that often had a handful of interesting rules, and that as far as i can remember were never taught in school or by parents or any adults in general, nor described in any book.

instead, all of those games were learnt from playing with other kids. probably during a school break, we would see the "elders" (those two years older than us) play. we would approach them and ask about the game and how it worked. we would even naively ask them if we could play with them, which of course they would never allow to happen. but we would listen and absorb the information about the dynamics and rules, then transfer it to the rest of our own friends and class mates. one day, we would be the school elders ourselves and we would teach those games to younger generations. of course we'd never allow them play with us.

all of this, as far as i can tell from my experience, happened in a parallel world to that of adults, school, television or books. and to me this is an example of very genuine oral tradition, one that kids kept alive for centuries because it was important to them. indeed kids can't help but play all day, and they like it so badly that even the weaknesses of a mouth to mouth system where not enough to need for a better mechanism. so yes, oral tradition in it's purest form can still be seen.
on formulanimations (I)
2012-08-19
level number 1 (the canvas)

memory, algorithm, variable, entropy, thread, bit, instruction api, recursive, register, architecture, inheritance, shader, pointer, hack, compression, compiler, function, pool, xml, factory, mutex, code, alignment, C, coherence, optimization, opcodes, assembler, stack, design, huffman, buffer.

level number 2 (the brush):

polynomials, filter, trigonometry, fourier, derivative, matrix, ramps, vector, interpolation, extrusion, exponential, bending, modulation, logarithm, determinant, quaternion, singularity, rotation, reflection, geometry, base, integral, sampling, square root, attenuation, laplacian, transformation, spectrum, limit, algebra, parabola, gradient.

level number 3 (the elements):

rock, birch, scratch, penumbra, sun, branch, foam, leaf, needles, grass, bark, ripple, highlight, lichen, pine, wind, bump, moss, root, water, shadow, flower, stem, bush.

level number 4 (the piece):

color, composition, lighting, shape, texture, grouping, framing, saturation.





When you do all these four types of thinking at the same time, you get a formulanimation - something that looks for example like a forest, but that it's just one huge mathematical formula:



realistic
2012-08-17
"the other side of the planet" is a really far away place
here we go
2012-08-15
you know when you feel like staying where you are, peacefully, relaxed, safe, happy, cosy, secure... where things are easy and simple, predictable and feel just fine? basically, when you are in your comfort zone? do you also know the famous memo that says that magic happens when you leave that zone? okey, today is one of those days that i gotta follow the memo. so, here we go!
surprisingly inconsistent
2012-08-14
as you know i get quite a few emails everyday from fans, students, followers, admirers and random people asking about everything from how's my piano doing to why their code doesn't work or if i can help them with some formulas or can point them to a good book on wavelet transforms. now, when it comes to the most academic emails and questions, i noticed there is a huge inconsistency in knowledge levels among the different schools/universities in the states. i get questions from college students which are better formulated, more self-consistent and more elevated in form and especially in content that some of the questions i get from certain postdoctoral researches and phd candidates. see to believe!

on another topic, sometimes i don't even know how to answer. "i have a live, i can't go fix your code" or "c'mon man, do your homework and learn that other thing first" are too impolite of course. but not replying to an email is too, so in the end i have to be as diplomatic as possible. oh boy, not easy.
fantastic(k)
2012-08-12
oh, speaking of fantastic things:



i cannot help but doing these
yes it is
2012-08-11
oh, i forgot to say it aloud lately - life . is . fantastic .
bathroom / mathroom
2012-08-10
i noticed that i usually don't have time to think about maths anymore, not during the day at least, and that if i do it's more often than not while in the bathroom (especially in the shower). that's why now i call it the mathroom.
red traffic lights
2012-08-09
as usual, red traffic lights are a source of experiences.

i'm relaxed waiting for the light to change, thinking on something transcendental, like why doesn't "beautiful" spell with two l-s instead of just one.

at that moment, the right window of the car to my left opens, and the driver gives me the following gift: "Jesus loves you, man". i look at him, laugh a bit, softly, and start pedaling as the green lights indicates the end of our ephemeral relationship.

few meters ahead, still pedaling, i wonder what motivated the man to tell me such a thing. pity or compassion towards me cause i'm cycling instead of driving? from my perspective that would be paradoxically funny. in the other hand, today i had a good day, i'm sure i'm irradiating energy all around me, so i can't be he saw me in need of compassion. i don't know.

anyway, where was i...?, ah, yes, "beautiful", the issue with the missing second l.
le moulin
2012-08-07
i like it when it's cold. it makes me feel alive. and it also reminds me of other places, other myselves, some that i was, some that i fear i left behind. it's so difficult to be all the yourselves you've ever been, to even remember them all. but this cold and gentle breeze of today helps me brings many of those myselves back, if only as memories.

if i close my eyes and dive a little bit into what i feel, images come to my mind. i'm getting out of a magnificent and ancient building after a dance performance show. it's dark, and beautiful. the orange lamps lit the cobbles, which are old as only cobbles and some trees can get to be. i wear my scarf and my long winter coat. i like the feel of its weight in my shoulders. it sort of grounds me to the earth, here, it makes me feel attached to this place. the yellow glow of all the libraries, candy shops, coffees, restaurants and fashion shops make these streets look magical, and the city a huge christmas tree. noise, music and smells. "bonjour monsieur!, est ce que vous voulez des marrons chauds?". it's the perfect time to buy chestnut or doughs, and walk around inspect the window of all those shops from which i'll never be able to afford buying. i like getting lost within these streets and alleys.

i open my eyes again. i have mixed feelings. i like what i see around me, but i also like what i see when i close them. i plug the headphones, play Tiersen's "Le Moulin", smile gently, and i keep walking.

what else can i do
i love words too
2012-08-05
you love words.

words are everything for you. you say them with great care. not only you like their meaning, their origins and their sound, but also you like giving them all a chance to shine, or i'd say, an opportunity. you bring them to your lips in the right moment, in the perfect context. you master them, you are indeed more agile than most people are when it comes to picking the right word, that one word that has many synonyms yet it carries some special subtle difference in its meaning that makes it worth being brought to that one sentence. you won't stop utilizing them, nor just saying them. you love words so much.

i love silence. sometimes i wish that after a long silence, one of those conspirational silences we have, we were allowed to say only one word, one each of us. we should make a deal, or a game. only one word after a long silence. i wouldn't matter if we had carefully selected that word during our silence, or it just had naturally came to us in a fraction of a second right before we would finally decided to break the silence. thing is i always thought, that would give silence a voice, a meaning. for how can a silence feel special if random words, sentences and topics would follow it? no - the only way for silence to shine is to honor its presence by saying a meaningful word after it.

picking the right word is important. picking the right silence is too. not all silences last the same, not all feel the same. they have a rhythm, a meaning, a color. they are a chance to listen differently.

gratefully, you love silences too. you look down when you are in silence, as if you were inspecting inside yourself. your black hair falls vertically and covers part of your face. i look at you, i don't know if you notice it, or if you pretend you don't. i still stare at you, relaxed, i can do this endlessly. finally, you glance at me, smile, and say something. not one single word as i wish you did, but quite a few.

i smile back. i love words too.
many think they know, but... do they?
2012-08-03
i sometimes realize that no matter how much people work on something, there will always be some who don't really "understand" what they are doing. this can happen to professionals too, which often use well known facts or tricks without knowing how they really work, and without actually questioning why they work in the first place. some, however, keep asking and trying to understand fully what they do. i have put some examples of such well known but rarely understood tricks here in this blog before. today i got to answer a question about another one of those tricks. here i won't show why it works, but how it works. you do the rest of the homework.

so, the situation is this. you need some linear eye space z values or some eye space 3d point from a regular hardware zbuffer to implement your effect. like depth of field or ssao. say you couldn't indeed afford rendering nor storing an extra linear eyespace zbuffer in your gbuffers or forwards engine, so you are going to try to recover those eye space z values and points directly from the regular hardware 24 bit zbuffer.

good graphics programmer as you are, you will tell me to read from the zbuffer, transform back the point to eye space with the inverse of the projection matrix, and then do a division by w. that's the correct answer, indeed. furthermore, perhaps you even understand why this works. or perhaps you have learnt this by heart... cause, why does the division by w happen after the transformation. furthermore, why a division? shouldn't we be undoing a perspective division??

thing is, if you think about it, despite it works, the process doesn't really make that much sense at first glance. bear with me, and let's go through the regular rasterization/rendering process:

we start with an arbitrary point p in eye space with coordinates (x,y,z), and a projection matrix M, which implements a regular perspective projection conditioning,



first thing we do in our (vertex, tesselation or geometry) shader is to transform p by M to get our point in clip space:



perhaps you are wondering now why on earth should we use an actual expensive matrix multiplication when you can transform your point with a single fma() instruction. if you are making that question to yourself, it simply means you are not into 4 or 1 kilobyte intro coding.

anyway, at this stage the hardware can do polygon clipping against the (-w,-w,-w,+w,+w,+w) frustum cube. once that's done, and before the rasterization can proceed, the perspective division happens. that's the one responsible for making the far distant polygons look smaller than those near by (the projection matrix isn't). note how indeed the w component has been conveniently set to the eye linear z (signed) distance. after the perspective division, we get our point p in ndc space, ranging from -1 to 1 (hence the name normalized device coordinates):



indeed the x and y components follow a simple proportion rule with eye z that produces the intended perspective effect of pinhole cameras. in the other hand, the z component encodes an inverse distance shape, which compresses more eye z values near the camera and less far from it. again, how convenient, huh.

so far so good, all old news. now the real deal, proceeding backwards:

we start from a pixel in our zbuffer, which has coordinates 0 to 1. you sample the zbuffer, and store it in z, such that we build a point (u,v,zbuffer(u,v)), which we rescale and bias it to map into the -1..1, meaning we got our 3D point already in ndc space. sweet, and easy.

to get to clip space, you would have to undo the perspective division now. and that's where the problem arises, cause we don't have w at this stage. the original pre-perspective division w has never been stored in the hardware's zbuffer, so just don't have enought information to proceed. panic.

the trick we all use, which most people don't seem to understand of even question why it works, is to proceed as if nothing: just transform back directly by using inverse projection matrix into some sort of weird space, and performing a perspective (un)division afterwards... what? i know! why on earth would that works at all, right? ok, see this:

let's assume that w was just 1, and so effectively build a fake clip space point with (-1+2u, -1+2v, -1+2zbuffer(u,v), 1 ). this must match the point we had rasterized to the zbuffer before:



now, if we transform it the with inverse projection matrix...



...without first performing any perspective (un)division, we get p in some sort of weird space



now the "magic happens": we can divide the whole vector by its w component (negative one over z), to get



which is nothing but our original point p in eye space! ta-daaaaaa, magic!
challenging fears
2012-08-01
we all hate our own voice. but when you cannot avoid having to listen to it, then the sooner you get used to it the better. i suppose. so, i'll try to add narration to the coming live coding video, if only for that