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:



<
April 2011
>
impulse
2011-04-27
when something grows strong first, and then fades out and dies - cuando algo empieza con ímpetu, y luego se desvanece.

float impulse( float b, float x )
{
const float h = b*x;
return h*expf(1.0f-h);
}


hacerlo pa ná es tontería... ¿no?
2011-04-25
cuando alquien coloca anuncios por la calle de "Se busca gatita perdida, despareció hace una semana. Su nombre es Nina, es negra con franjas blancas sobre la espalda, y es muy mimosa. Si la has encontrado, llama por favor al número de telefono 123-456-6789. Gracias", mediante una fotocopia con una calidad de imagen que apenas deja reconocer una forma felina en la fotografía, en la estación de metro de un barrio suburbano lleno de carreteras... ¿de verdad esperan que alguien vea un gato, se preocupe de mirar si tiene franjas blancas, si las tiene sea capaz de reconcerlas como inequívocamente las características de Nina gracias a la fotocopia de contrate saturado, la recoja, la gata se deje, y llame al número de teléfono, y sobre todo de que Nina no fuera atropeyada y barrida a una cuneta hace una semana? Ya sé que no, que el dueño de Nina es tan consciente de esto como el resto de nosotros, pero ¿qué otra cosa puede hacer?

r.i.p. Nina

live coding
2011-04-24
sometimes you have been procrastinating something, say a project, for as much as 3 years. sometimes, you decide to take a couple of days and finally get started with it. and even if it all starts simple and minimal, and it's not even close to what you want it to be, at least it is a beginning. the point is, the wheel is spinning, finally.



the video shows some realtime live coding while i was testing the text editor and live coding framework i have been preparing as part of the next sexyvisuals show. the coding itself is pretty simple (a julia set and some plane deformations), but at least it shows the idea. let's see if this rocks on the big screen!
whenever i need a small rotation matrix
2011-04-20
cause, say i'm computing some fbm() and want to rotate the octaves, or for whatever other reason, i always go with this one, which is indeed a orthonormal matrix and it's very easy to write.

    /  0.00  0.80  0.60 \
A = | -0.80 0.36 -0.48 |
\ -0.60 -0.48 0.64 /


you can see that indeed |A|=1 and that the three axes (0 0.8 0.6), (-0.8, 0.36, -0.48) and (-0.6, -0.48, 0.64) are orthogonal to each other.
dos reflexiones de golpe
2011-04-18
hoy iba en el b.a.r.t. dándole vueltas a dos temas al mismo tiempo. ambos originados por un mismo acontecimiento.

ya dice la sabiduria popular, y queda bien sintetizado en forma de refrán, que quien camina se tropieza. a veces estos refranes no son tan figurados en su significado como uno pudiera pensar, sino que también guardan una verdad brutalmente literal. por ejemplo, la frase podría significar simple y llanamente que quien bicicletea, al final se da el piñazo.

efectivamente, hoy me he dado el primer morrazo en bicicleta de mi vida (sí, sí, ni cuando niño). la verdad es que ha sido un hostiazo épico, con vuelo parabólico y muchedumbre mirando incluídos (no en vano me he rijostiado en la calle más concurrida de la ciudad). milagrosamente he salido con poco más que unos rasgonazos y dolor en el codo (¿seré un gato?), y mi querida iñicleta no se ha llevado mucha peor parte, aunque haya quedado cicatrizada. sobre la caída, la combinación de lluvia, raíl cabronator de tranvía y cuesta empinada (tres elementos insignia de San Paco) ha sido los culpables. pero no es esto de lo que quiero hablar.

la caída me ha recordado al par o tres de morrazos que recuerdo haberme dado sobre eskís cuando era crío, en aquellos tiempos en los que mi cerebro aún no había desarrollado el mecanismo de supervivencia ese que llaman "miedo", y osaba tentar a la suerte y arriesgaba en mis maniobras. y recuerdo que cuando la suerte ya estaba echada, y la suerte había determinado que el trompazo era inminente, mi cerebro se ponía en modo acelerado, y de pronto los 2 segundos que duraba el tortazo se convertían en 20. todo iba a cámara lenta, de tal manera que me daba tiempo de hacer los movimientos que minimizarían las consecuencias del impacto. hoy me ha pasado lo mismo durante el vuelo clásico de balística, y he pensado, juraría que conscientemente, que debía levantar el brazo para protegerme el cuerpo y la cara, y levantar la cabeza para evitar que pegara en el suelo. suponiendo que esto no haya sido una artimaña parasimpática, sino efectivamente algo tan consciente como yo lo he percibido, la pregunta es, ¿qué es exactamente esa sensación de dilatación temporal? es algún mecanismo de defensa, en el que el cerebro se pone en modo supercerebro, y procesa información más rápidamente que de costumbre? ¿estamos por lo general en modo eco, y en esos momentos se ponen las neuronas en modo turbo? ¿cómo sería la vida si estubíeramos siempre viendo las cosas así, a esa velocidad? ¿seríamos super hombres con super poderes? y si ha sido todo inconsciente, la sensación de dilatación del tiempo, que estaba ahí igualmente, ¿es la misma que hace que los sueños se perciban en tiempo real en vez de en el (escaso) tiempo en que son creados?

la segunda reflexión bart-iana de hoy, era que si yo ya sabía de antemano, por ser buen conocedor del refrán popular, que un día caería el castañazo, ¿no será tal vez también un mecanismo de desfensa del cerebro el obviar tal información?. porque si no fuera así, si cada día por la mañana no saliera de casa con esa consciente despreocupación, y no me pusiera a pedalear con esa ingenuidad, dando por sentado que ese día no iba a ser el dia trágico, ¿no sería entonces mi vida una pesadilla constante?

en fin.
algunos momentos mágicos
2011-04-14
cuando de niño descubres el principio por el cual los engranajes pueden ir a diferentes velocidades, y sus equivalencias

cuando de adolescenete te muestran que las ecuaciones se pueden resolver de manera gráfica y construyes toda una nueva interpretación sobre lo que son las ecuaciones,

cuando de jóven comprendes la naturaleza profunda del producto escalar en todas sus interpretaciones a través de diferentes disciplinas.

o cuando te enseñan a pensar en frecuencias en vez de en espacio, o te presentan con el multiplexor...

y aunque momentos mágicos vivo aún muchos, que son sobre todo por el placer de crear lo que no existía antes, me pregunto cuándo fue la última vez que viví un momento mágico de éstos que menciono, de los de descubrir.
vamos a la cama
2011-04-12
this animation is much older than i am, but still very useful and appropriate for me. i should put it as an automatic alarm in my computer.


it's all about the attitude
2011-04-10
i was speaking with a new friend about the classic Disney movies of my childhood, ie, those between The Little Mermaid and Tarzan, and about my preferred characters. and i realized that despite being a boy i never had trouble relating to any of the female characters. so in that regard, my preferences were never biased. however, there is a strong line between the characters i like and those that i don't so much. the separation in based on their attitude. for example, Pocahontas, Mulan or Belle have always been my favorites, cause unlike Ariel's or Jasmine's attitude for escaping their world, the formers take decisions and act based on seeking for something.

yep, i like people who look for things, not people who escape from things.
real pixel coding
2011-04-08
during the last 5 years i've been explaining people that it takes less space to write a 3 minutes HD animated video and music clip than than it takes to store a 32x32 pixel icon. it's all about replacing content by algorithms. i often have shown binary/disassembled code of such animations in an attempt to prove it, but never I really managed to find a way to make my point ridiculously obvious to understand (at least for programmers).

the other day my friend sent me a link to this funny video, where somebody was writing a text file (with some C++ code as content) by drawing pixels in an image file.

so i thought i could kill two births with one stone if i applied the "build content by putting color pixels" idea. for one hand, i would go beyond writing source code (which btw wouldn't compile due the header of the bitmap being interpreted as garbage by the source parser of the compiler) and write actual native x86 executable binary code, that would actually run in the computer as any other application. in the other hand, i would show that indeed, couple of hundred bytes are enough to build a realtime animation (who needs C++, DirectX or OpenGL?).

anyway, this is the video. what you can see is: (1) the creation of an empty 9x9 image. (2) the filling of the pixels with carefully chosen colors. (3) saving the file in raw format (ie, without header). (4) renaming it to .com, so that Windows (XP) recognizes it as an executable file (as an application). (6) running the executable/application, which opens a window and runs an infinite moving tunnel with a gray colored texture.

the binary content itself is a x86 real mode com file that basically opens the oldschool 13h graphics mode (320x200 pixels, 256 colors - remember monkey island and those old games?), creates a texture with an XOR pattern, blurs it, and uses a plane deformation technique to produce the animation.


This is the image, upscaled 10 times in each direction: