|
history
Since this intro was quite simple (just three minutes of static scenes with a few textures) and we had decided to take it as a test for Gortu's synth and for the Minitool (see here), we just reused the code of Paradise. Basically we changed the models of animals by the statues, the textures "et voila". We kept all the basic code and this the requeriments of Paradise: ARB fragment programs instead of GLSL, standard 8 bit RGBA textures instead of floating point textures, power of two textures instead of rectangular, and so on. This was good somehow: no need to develop anything new, no people complaining about latest drivers and/or graphics cards. Well, I made three minor changes to the core of the introsystem: pseudoinstanciation for collection of moving primitives, better scene generation system and extending the subdivision surfaces code to handle seed meshes with more than 256 verts and to better compress the data. Regarding the instanciation the intro is using a quite elegant system. In Paradise there was no notion of transformation matrix for the objects. Everything was generated in world space coordinates if it was static, or it was translated and rotated to world space by the same code animating the mesh. For example, the animation of the breathing of the rhinos was not only deforming some vertices, but also rotating and displacing the complete mesh to the correct location. Regarding the instanciation, the trick was a bit ugly also: for the fishes following the whale, only one big mesh was used for all the fishes. This mesh contained the vertices of all the fishes, and a uniquie animation was applied to the complete mesh to create the illusion of each individual fish to be moving. This was, only one single draw call (glDrawElements) was made. However everything was made like this to save glPush() and glPop() instructions. In this intro, however, we still don't use any matrix pushing or poping code and this we save lot of work on the driver. But, we finally have matrices for objects and instancies. We now have only one mesh representing one instance of the object (one pink petal, for example) and then we have a list of matrices associated with that object, one per instance. The animation code just fills this matrix and the rendering code uses many draw calls with the corresponding matrix attached to the texture coordinates of texture units 4 to 7. The vertex shader (we need one anyway) makes the trasnformation. The main drawback with this technique is that we still have many calls to the driver, but at least we saved the glPush and glPop. Another problem is that this technique only workd for solid transofmations to an object, for morphing we still have to use the old technique used in Paradise. I also |