Thursday, 31 May 2007

Studio power gloving!

This is a short footage of my band Simmetry jamming on a space-rock theme, letting me improvise with the power glove!

It's our first attempt in composing something around the new instrument; not so simple to handle, difficult to keep in tune and complex to use due to the slight delay.

Maybe some further effect will give him an additional gear. Cool and scenographic, anyway!

Friday, 25 May 2007

Now we're talking!

Computergraphics project is near the end!
There are some minor features to program (asteroids belt, pluto, music in background), but most is gone!!

A huge thank goes to Alessandro Re for the help and infinite knowledge in OpenGL programming. For instance, he explained me how to texture map spheres correctly: matter of three steps.

1) Quit using glut*Sphere(), 'cause "this function does not correctly set up the texture parameters needed for mapping". There's a GLU function that does it, and it's gluSphere().

gluSphere() draws a sphere of the given radius centered around the origin. The sphere is subdivided around the z axis into slices and along the z axis into stacks (similar to lines of longitude and latitude).
If texturing is turned on (with gluQuadricTexture), then texture coordinates are generated.

2) As documentation says, we have to specity a gluQuadricTexture before calling gluSphere();
gluQuadricTexture() accepts two parameters: a reference to some quadratic object and a boolean value.

3) We have to create the quadric object then! We do it with gluNewQuadric() function; it returns a pointer to a GLUquadric object that can be passed to gluQuadricTexture.

So here it comes the snippet:

GLUquadric *sfera;
sfera = gluNewQuadric();
gluQuadricTexture (sfera, GL_TRUE);
glBindTexture(GL_TEXTURE_2D, texture);
gluSphere (sfera, radius, slices, stacks);

This code will create a perfectly textured sphere, with specified radius, made by that number of slices and stacks!

Another important issue solved speaking with Alessandro and doc. Paolo Scala is the handling of lights. They can't be set up at beginning, or randomly in models/camera definition: despite the coordinates we give, they will mess up. Discovered that is FUNDAMENTAL to place them soon after the gluLookAt() call, to be sure they will be where we expect them!

Saturday, 19 May 2007

Balls keep on spinning

One preliminar shot from my Multimedia final project: the solar system, rendered with OpenGL.

What's done so far:
  • The abstract solar system is modeled: distances are proportional, dimensions are proportional (but the Sun), speeds (rotation and revolution) are correct;
  • everything is parametric, so it can be altered realtime;
  • Moon actually rotates around Earth and every planet spins on his axis, also the moon itself (showing the same face to the Earth!);
  • every planet has its own satellites, the real number, correctly distanced each other. Discovered yesterday night that Jupiter has 63 satellites!! Oo"
  • Saturn and Uranus now feature their rings; I used a transparent toroid to represent them, gotta place some serious texture;
  • stars on the background and debries around the system are implemented, for enhanced flight experience ;D
  • the camera follows an arbitrary planet, and it is highlighted with a nice green cube.

The todo list:
  • depict asteroids belt between Mars and Jupiter;
  • fix the eccentric revolution of Pluto;
  • place clouds layer around Earth, and possibly to bump-map the Moon;
  • insert Simmetry's song "R.O.D.O.L.F.O." as musical commentary;

Open issues:
  • learn how to apply a spherical texture without always showing the same face to the camera;
  • learn how to specify the extension of the texture over a simple glutSolidSphere;

I have one week to achieve this results. Surely I won't, but who knows.

Probably I'll have to stress someone, starting from Alessandro Re (that I thank for the suggestion on the project and the patience in answering me every time :D)!