Archive for the 'General' Category

WebGL: Day 1

Thursday, July 8th, 2010

I like to code in OpenGL, andI like to code javascript, and now WebGL allows me to do both things at the same time!.

WebGL is a Javascript binding to access all the OpenGL ES features right from the browser. The idea is not bad, it allows to create true hardware accelerated 3D apps embeded on the sites, and it blends perfectly with the rest of web technologies (like HTML+CSS, Ajax, etc).

Unfortunately WebGL is not mature enough and It is kind of hard to start even for a experienced programmer.

The first big problem I found is that Javascript was never meant to be used with binary data, and 3D graphics needs binary data to save all the information (textures, meshes). WebGL can do the ugly work to convert from regular non-typed arrays to low-level streams, but sometimes it is confusing, or just it looks slow, and hard to optimize, but if we agree that a 3d app in a browser is not meant to have Crysis quality we can keep going.

Usually working with OpenGL from scratch tends to be annoying, because there are lots of actions you have to do to create and transform simple things like meshes or textures, things that usually are wrapped in classes to speed up the developing process, and here we have the non-binary data issue that can make the wrapping harder.

For starters all the geometry calculations (projections, transformations, vector operations, etc) should be coded from scratch because JS libraries tend to be focus on HTML and web interaction, no in 3D. Now with WebGL some libraries are emerging for 3D calculations but they do the calculations in JS, which is slow for intensive computation.

Also JS doesnt support operands so you can do V1 + V2, you end up with sum(V1,V2) which is annoying for long formulas.

So thats when you realize you are touching the limits of the technology, JS was never meant for this and WebGL wont solve this issues, it is just a wrapper of a library.

Anyway, I decided to switch to a framework build uppon WebGL, because working straight to WebGL is slow and tedious.

So I chose SpiderGL as that middle-ware, and it looks nice but it is not documented at all!!, gaaagh. I have to read the source code to discover most of its usefull features, and found some bugs too…

But after sorting all the problems, it works, I have coded several shaders, do PostFX in scenes and some intensive mathmatics and it looks nice in a browser.

Sadly I havent figured out how to export meshes in a binary format…

Anyway, If I have time I will upload some of the examples I coded, but remember that you need a WebGL capable browser.

Previously on 2009

Sunday, February 14th, 2010

Brief list of good things and bad things that happened to me this last year:

  • Gla finally decided to visit me, and I had the chance to show her all the things I’ve been talking about during all these years. I was glad to see her here, to have the oportunity to spend time with her and create good moments to remember, sitting next to each other, showing our own little worlds.
  • Encouraged by my friends and co-workers I started playing in a heavy metal band. They needed a bass guitar player and I had too much spare time and some guitar skills, so I went every friday to play with them in a rented-by-hours local, and a couple of months later my skills as a bass player were surprisingly enhaced. Now even my good friend Pau come with us as the lead singer, and the “metal friday evenings” had become one of the best moments of the week, surrounded by great people, playing cool songs and having fun all together. Funny taking into account that I wasn’t a big fan of metal music till now. And If you want to know which songs we play they are mostly Iron Maiden, Judas Priest and Guns’n Roses, but we also play songs from Wolfmother, Jet, Kiss, or some oldies like The Shadows.
  • Anton pushed me to go with him to learn french on a one-month course, where I remembered what was to study, and where I learnt a new language from scratch. One year later I’m studying french again two times per week and I can’t say I’m not enjoying it. And it helped me to make new good friends, like Marta :)
  • Encouraged by Ceci I took a one week course of 3D Computer Animation, my long time dream job. During the last years I learnt all the technical aspect about 3D Animation from the programming side but I never spend time animating a character, moving every bone along the timeline. After the course I realized that that wasn’t meant to be my future career. To animate doesnt have anything technical, it is only art, far away from anything I ever done, so I better stick to the technical parts of 3D Animation, like materials, lights, and so.
  • Ceci suggested me to travel with her to visit Santiago de Compostela, I don’t really like touristic trips, but this was the better I can remember. We spend a couple of days discovering the city and a couple more enjoying it. We met great people, we relax in nice parks, even the weather was perfect and the city wasn’t crowded at all being a touristic spot as it is. It couldn’t be better. Ceci was a great traveling partner, besides her obsession for taking macro pictures of every flower on the streets and parks.

There were bad things too:

  • That I am almost 30 and I still need the people to push me to do things (as you can deduce from the previous points), I never find reasons or strength to do them by myself. And the worse part is that when eventually I do something I’m usually pretty good, but anyway, I’m still a mixture of lazy and coward.
  • I stopped falling in love, after too many heart-broken moments, I realized that I stopped loving the people, and worse than that, I stopped caring about finding the true love, which for me was the main source of energy to wake me up everyday. Now I don’t know if I will ever find somebody to spend the rest of my life, but somehow it doesnt matter. I thought I was a romantic, but I guess that couldnt last forever.
  • Somehow I ruined my relationship with one of my best friends, the person that know me better and now I miss her every single day.
  • To run in a hurry to the hospital after a call telling me Elena had have a crash with her scooter, and to see her so scared, worried and ashamed. But after one year we can remember that and make fun of it, I even feel that after all she become a stronger person.

From 2009 I will carry with me the great days I had with Gla, all the rollerblading sundays with Ceci, the daily lunch with Miguel Angel and our geek conversations, the monday’s dinners with Pau and our nerdy moments, the metal evenings with the twins, my everyday chats about life and love with Julian, the working silly hours with Alun and Marco, the funny classes with Anton and Mikel, the yoga classes with Miriam, the drawing sessions with Ana, watching TV with Marta, hanging out with Graham, the unpredicted calls from Marcos to go eat somewhere, and all the supporting conversations with Magda and Elena. All of them helped me to bare this 2009. After all, it wasnt so bad.

Testing NVIDIA 3D Vision (Stereographic gaming)

Sunday, December 20th, 2009

I spend this weekend in my parents house, where my brother lives. This won’t have anything to do with the topic of the post if it wasnt that my brother is 35 and have a well paid job, under this circunstances he likes to waste the money in all kind of gadgets, even those who will never use, just for the pleassure of showing off in front of the people.

Sometime ago he decided to purchase a nice pack from NVidia that bundle a monitor, 3d card and stereographic glasses. They sell it as the next experience in videogames, and I wanted to know if this is really an improvement.

First of all I have to battle against the driver, using the latest it didnt work. The “NVidia Stereo Controller” driver was not found, I had to download a previous driver and install just the USB driver item (I document this beacuse maybe somebody find this useful).

Once it worked I tested some demos that look nice, but I wanted to see it on games, and I did, and I have some kind of contradictory impressions:

The technology itself is nothing new, the glasses are just LCD synchronized using a IR flashing device connected through USB. You know how it works, the computer shows the frame for the left eye on the screen and syncronize the glasses to block the right eye, and switches fast enough so the perception is that both eyes are watching different images.

This technology was easy with previous CRT Monitors, but TFTs can’t switch images so fast, so with current TFT monitors the other eye still can see the image that was rendered for the first eye.

This is the reason why this pack comes with a monitor, this monitor (Samsung) is able to work at 120Hz so there is no problem to work with the active glasses.

Amd about the glasses, I was hoping some improvement but no, all the glasses that uses LCDs have the same problems, and this ones are not an exception.

First, the brightness. Your eyes are watching half of the frames, and when they are not supposed to see the screen they are covered with a dark screen, that means that the perceived brightness is half of the monitor brightness, and you feel it, when you are used to bright monitors this is like playing with your brightness set to 50%. Annoying. Of course they could create special monitors with the double of brightness, but that brings us to the next problem:

Ghosting. When working with LCD glasses you have to ensure that the darkened eye won’t see anything on the screen, otherwise the user sees strange objects floating on the screen that reduces the stereographic sensation.

So where is the great improvement here? Well, it is not a hardware improvement, it is more a software improvement, and the improvement is that the game do not need to be coded to work in 3D, the driver is able to do it by itself.

Thats a great step forward, and I can tell you that it is not easy. Because the driver somehow has to understand all the steps during the rendering process and it has to determine which parts needs to be redone, readjust the camera position and render the frame for the other eye. And it works!, but not perfectly, because the rendering pipelines are composed of lots of steps and a driver it is not able to understand them fully. Thats why DirectX has some specific features meant to take advantage of this technology.

Those games developed to be used in 3D will work perfectly, the others probably will show horrible gliches, or will have inter-ocular distances that will make your brain explode. Because thats another big point, when working with stereographic you have to set the distance between the cameras used for every eye, and the focus point distance, if you don’t set these distances right, the sensation is annoying or you just loose the 3D effect. For instance, I’ve been testing Colin McRae Dirt 2, the game looks amazing in 3D, the speed feeling is awesome, but you can’t play it using the inside-car camera, because the intra-ocular distance is too big.

I guess that what the driver uses to determine the distance is probably something like ( (far_plane – near_plane) / 2 ) and as I said it work, but not under all circunstances. Another game I tested is TorchLight, in this game I couldnt find any glich (and the game is not meant to work with 3DVision) but the only annoying thing was the cursor, which floated on the screen instead of being at the ground level.

So at the end what is my impression? It is hard to say. It really looks 3D, it really improves the gaming experience, but at the same time you feel that this is some kind of natural evolution in games, and you are used to play in 2D that you really don’t bother if there is no depth perception. I think that this technology needs to walk hand to hand with the headtracking technology, otherwise is some kind of expensive eye-candy.

Twittear para decir que twitteo

Tuesday, December 8th, 2009

Cuando uno twittea me estoy casando, deja automáticamente de casarse. E ingresa en la metavida. Cuando se pretende narrar en directo, el único hecho que resulta es el propio acto de narrar. La narración, como la felicidad de Ferlosio, sólo puede ser retrospectiva. Todo esos tweets llevan un único mensaje. Estoy twitteando.

Aunque no esté de acuerdo con el contexto, me ha sorprendido esta valoracion sobre el arte del twitteo, escrita por Arcadi Espada.

pygame makes me waste my time

Sunday, October 11th, 2009

Today I had some free time so I decided to take back python programming to add some features I had in mind for the pyncel app.

But then I discovered an anoying bug, if you resize the window the mouse messages from pygame don’t work properly, they are limited to the old size, so if the new window is bigger, when the mouse moves outside the old size it stop sending messages, and when it sends it, the position is always in the old border.

I track the problem till pygame, and I discovered that it is just a bug, nothing else to say. I guess the problem is some kind of ‘if’ statement inside pygame code, because I’ve been working with SDL for long time and it never gave me this problem

The weird thing is that I’ve been trying to find more people commenting this bug and there is no trail. And being such an obvious error I’m dazed. Maybe is a problem that only arises with Windows 7

So this is why I comment it here, with the keywords to help search engines: pygame VIDEORESIZE mouse border problem error. I hope somebody finds this post somebody and stop wasting time with pygame.

No improvements to my app today.

Harder, Better, Faster, Stronger

Tuesday, September 1st, 2009

And then I realized how much time wasted, how many ideas got lost, and how far I was getting from the right path I draw during my bright years. And then I remembered, that I had a blog, somewhere over the internet.

So from now and on, it doesnt matter that I think I don’t have nothing to say, from now and on I will do things, and I will document them, here, and I will use this blog as a proof of existence.

And yes, it is time to switch to english.

But be aware, not more emo-stuff (I hope), from now only technical words I barely understand.

Evaluaciones

Thursday, August 7th, 2008

Me han pasado hoy el enlace a la web donde se pueden ver las valoraciones que los alumnos han hecho de mi labor como profesor de prácticas de los últimos años. Sabía que existía tal web pero nunca me había parado a buscarla, y lo cierto es que me dejan bastante fino.

Como profesor novato que soy aprecio las críticas y veo que en gran parte tienen razón, muchos de los errores que apuntan son fallos que me constan ya de tiempo atras, pero que no se solventan de un año para el otro. Tambien los hay que se toman mis reproches como algo personal y aprovechan las evaluaciones anónimas para desahogarse, pero yo tambien he sido alumno así que es comprensible.

Os dejo aquí el listado de los comentarios que me han hecho los alumnos en los últimos años para escarnio público mio.

Infografía 2007 mi primer año como profesor, traté de repetir lo que se había hecho en años anteriores aunque no me convenciera del todo, aun así ese año figuré en la lista de profesores que estaban por encima de la media en valoraciones, la nota media fué de 8.09

  • excelente, explica muy bien y si tienes alguna duda, te atiende muy aducademente. (este debía ser el alumno al que le aprobé con un cuatro)
  • mes exercicis y practiques i menys teoria abstracta. (parece eslogan de campaña)
  • És poc eficient haver de posar a la pràctica allò que encara no s’ha explicat a teoria.
  • Explicaciones muy claras y ademas incluye posibles errores tipicos que se han cometido a lo largo de los cursos, que quieras o no, son muy utiles porque hacen que vayas con mas atencion a la horade programar.
  • M’agrada molt la forma d’explicar. Fa que les practiques siguin molt entenedores i amenes. La unica cosa es que es podria deixar una mica mes de temps per a l’ntrega de les practiques, ja que tot i que es poden fer parcialment a classe, per acabar-les al mateix dia no es possible moltes vegades, creant retrassos en l’entrega – retrassos acceptats, pero que no agraden ni a professors ni a alumnes
  • Que parli més a poc a poc. No és que s’expliqui malament, és que a la velocitat que ho explica no tenim temps de processar tota l’informació. A part d’això molt bé tot, està molt predisposat a ajudar.
  • Explica bé i sempre está disposat a ajudar.
  • Que no parli tant depressa.
  • Es un tiu una mica borde i va del pal amb els alumnes, es creu un ser superior als alumnes, personalment, el professor més estúpid que m’he trobat en tota la carrera….  (este llevaba odio contenido durante semanas)

Infografía 2008, este año intenté rehacer las practicas para hacerlas menos teóricas y más utiles para los alumnos, aunque eso las hizo algo caoticas. Reconozco que se me fué un poco de las manos y eso se notó en las valoraciones. La nota media fué de 6.16:

  • En general todo esta bien. ¡enhorabuena!
  • Al fer-se-li una pregunta, o dir-li que una cosa no et funciona, si mira la teva pràctica, sol dir que ‘esto es una chorrada, imaginate tener que trabajar con operaciones de matrices como yo’, despreciant el que els alumnes a vegades no sapiguem una resposta. Tot i així, sempre acaba resolent la qüestió. (jurl, a este mis críticas no le sentaron muy bien)
  • no és que expliqui malament, si no que ho fa massa rapid. parla extremadament rapid dels conceptes que segurament ell sap de sobres i deu considerar banals xo molts de nosaltres ni coneixem i és molt dificil seguir que diu quan encara estas pensant en el que ha dit abans.
  • Una semana es poco plazo de entrega para la gran mayoria de las practicas.
  • Parla tan depressa que no s’enten res del que diu i a part utilitza documents en PDF que son d’altres anys i que tenen poca relació o serveixen de poca ajuda a l’hora de fer les pràctiques. Si el vas a veure el despatx perque no t’ha quedat clara alguna cosa, no t’ajuda a entendre-ho sino que encara posa traves preguntant si no escoltàvem a classe… No m’ha agradat gens la docència rebuda (i se que no soc la unica persona) (parte de razón lleva pero me quedo con la última frase, habla por los demas porque sabe que ellos no tendran valor de hacerlo)
  • Parla molt ràpid. La classe on s’impartia la classe era un forn (la 231 crec). Amb tanta calor un no es pot concentrar. (no se si me culpa a mi de que la clase se caliente tanto)
  • Hi han massa pràctiques a fer durant el trimestre, ja que tenim més assignatures d’aquest estil de fer pràctiques i seminaris i encara més amb Bolonya… El professor a vegades s’explica amb massa pressa a les pràctiques i no s’acaba d’entendre tot el que s’ha de fer.

Taller de Jocs 2008, primer año dando juegos, en general estoy contento pero faltó algo de planificación y los recursos que daba a veces no habian pasado un testeo adecuado, pero traté de suplirlo dedicandoles más horas de las que figuraban por contrato. La nota media que me dieron fué de 8.23

  • Agenjo for president (este debe ser presidente de mi club de fans)
  • parla més a poc a poc ;)
  • Cuidado con los bugs en los frameworks, los alumnos nos podemos volver bastante locos! A parte de eso, buen trabajo. (es lo que pasa cuando no reaprovechas el trabajo de los profesores anteriores)

En fin, creo que queda claro que tengo que ponerme serio con mi problema de hablar rápido, pero joder, hablar más lento implica pensar más lento y eso no se como se hace. Y por otra parte debería advertirles de que tengo una actitud un poco agresiva cuando se trata de comentar sus errores, pero no hay maldad ninguna, es la manera como a mi me habría gustado que me dijeran las cosas.

Bueno, me queda mucho trabajo que hacer para mejorar mi labor docente, me esforzaré para que no me vean tan ‘evil’ cuando pierda la paciencia.

El Sindrome del Savegame

Thursday, June 12th, 2008

Yo me considero hijo de una generación donde los grandes cambios se han producido con tanta celeridad que nadie ha sabido las consecuencias que se iban derivando de ella.

No es que esto no haya sucedido antes, es solo que por lo general a cada gran cambio le precede un tiempo de adaptación donde las cosas se asientan y donde se pueden medir su impacto en los otros ámbitos, para poder aplicar alguna solución que los palie de alguna manera, y en esta generación eso difícilmente puede suceder.

Mi generación ha jugado mucho a videojuegos, hemos visto el salto del Pacman al GTA4, y nos hemos dejado arrastrar por la mecánica de mundos virtuales, adaptando nuestra forma de pensar a la de los creadores de mundos. Algunos de los que derrochaban su tiempo en videojuegos lo han sabido alternar con otras actividades más enriquecedoras socialmente que les han mantenido equilibrados, yo no.

En un videojuego uno no teme a las consecuencias de sus actos durante la partida, primero porque sabe que estas jamás traspasaran el umbral entre el videojuego y  la realidad, y segundo porque incluso dentro del juego sabe que siempre le quedara alguna partida guardada desde la que poder recuperar el momento anterior a cuando tuvo que tomar su decisión. El jugador no afronta las consecuencias de sus malas decisiones y por lo tanto no ejercita tampoco su habilidad para enmendar los errores.

loopEs por eso que el adolescente que desarrolla su personalidad delante de una pantalla no tiene el hábito de afrontar las consecuencias de sus decisiones.

Esta persona una vez puesta en el contexto social, emocional o laboral siente una presión increible cuando se trata de tomar decisiones, no se ve capaz de elegir porque le da pánico equivocarse, teme sobremanera arrepentirse.

Cuando a un jugador se le presenta un dilema en el que debe tomar una decisión a elegir entre varias este no toma aquella que parezca más favorable (incluso si esta es mucho más probable que el resto), tomará la que menos impacto tenga en su vida, es decir, aquella que garantice que no tendrá consecuencias.

Esto a la larga hace que el jugador se deje arrastrar por las decisiones de los demás, deambulando por un curso de la vida que no es el que él ha escogido.

Ante tal panorama el jugador solo le queda una opción y es la de asegurarse de que quienes tomen las decisiones por él sepan qué es lo que él quiere.

Y ya van tres…

Sunday, June 1st, 2008

Hará cosa de un año al mover el blog de carpeta en el servidor este se fué al traste. Traté de arreglarlo pero solo conseguí que los antiguos posts estuvieran visibles, internamente estaba tan destrozado que no se podía ni escribir ni editar lo ya existente, así que finalmente desistí, tampoco es que sintiera que tenía nada que contar.

Pero echo a faltar tener mi rincon en la red así que he enviado el viejo blog a un rincón polvoriento del servidor y reinstalado un WP de nuevo. Espero que este no me la juegue como el anterior, de hecho le he cogido manía pero yo siempre he sido de más vale malo conocido…

Invertiré el tiempo justo para adaptar un theme bonito y darle un toque personal pero sin entrar en la clásica esperial de mejorarlo hasta el punto de que le dedico más horas al continente que no al contenido.