Outdated Homeworks
In December 2012, I started to develop on my spare time a 3D engine, in Java and OpenGL ES 2.0, that is loosely based on the architecture of Unity3D. My goal is not to make something better than this software or to even reach its level of sophistication but to simply get a better idea of its internals. The current result is far from being 'awesome' but provides in my humble opinion a well-suited base to develop shaders and pieces of code that could be reused. Said differently, I tried to build a good software architecture but sometimes at the expense of performances. In addition, I decided to use the Android SDK because I was expecting to make a software that could run easily on any Android device...
Step 7 (2013/03/13)
This version features:
- Dynamic hard shadows (using a depth/shadow map) for the brightest directional light.
The following screenshot illustrates shadow generated dynamically under the dragon. The shadow is generated by a depth map without any filtering (no blur so its edges remains 'hard'). Note that the dragon model is not correctly modeled: its two sides are not joined/close enough, which leads to a strong disconnection in the shadow.
The source code is available under the GPLv2 licence and is my property except if stated otherwise. You can try the APK file, which may work on your Android device.
Step 6 (2013/03/03)
No screenshots this time because everything happened under the hood:
- Use of buffer objects for vertices and indexes to draw calls. I did not evaluate how much performances got improved, I just saw the difference: it is much faster. Because bindings for VBO are broken on Froyo, I use partially the library libGDX.
- Use of AABB to cull objects by the camera.
- Improvement of the .obj loader to create less vertices when loading.
The source code is available under the GPLv2 licence and is my property except if stated otherwise. You can try the APK file, which may work on your Android device.
Step 5 (2013/02/17)
This version features:
- A loader of Wavefront .obj files.
- An example of the load of a .obj file that contains a dragon. The model comes from this page.
The following screenshot illustrates the dragon that comes from a Wavefront .obj file that has been loaded.
The source code is available under the GPLv2 licence and is my property except if stated otherwise. You can try the APK file, which may work on your Android device.
Step 4 (2013/02/11)
This version features:
- A way to send tangents to shaders as vertex attribute.
- A shader for normal mapping in tangent space.
- Some code refactoring in the Mesh class in order to set easily vertices, normals, tangents and uv coordinates.
The following screenshot illustrates normal mapping with a smiley that was part of the normal map.
The source code is available under the GPLv2 licence and is my property except if stated otherwise. You can try the APK file, which may work on your Android device.
Step 3 (2013/01/29)
This version features:
- A framework for the emission of particles: trajectories, color over time, size over time, scheduled bursts, customized texture to provide appearance of particles, etc.
- A render queue for translucent objects (at least, objects that should be rendered after opaque ones).
- Less memory allocations: almost none once some data structures have been initialized.
- Fixes for rendering on HTC Desire phones.
The following screenshots show a stream of particles with a burst that begun at the first image and finished at the last one. New particles are colored in red but become blue and transparent over time.
The source code is available under the GPLv2 licence and is my property except if stated otherwise. You can try the APK file, which may work on your Android device.
Step 2 (2013/01/13)
This version features:
- Object culling based on a mask. So It is possible to render some objects (meshes, lights) by only selected cameras.
- Ability to apply post-effects to any render-texture (that may be then used as an object texture or the 'quad-screen').
- Fixes of render-texture management.
- Code cleanups.
The following screenshots show:
- what is rendered to a texture: a quad with a world map as main texture and a red point light for illumination. As a post-effect, Perlin noise draws waves that change over time
- the texture obtained is applied on the cube. The scene is illuminated by a directional light and a spot light. A final Gaussian blur post-effect is applied to prove that post-effects can be applied here also.
The source code is available under the GPLv2 licence and is my property except if stated otherwise. You can try the APK file, which may work on your Android device.
Step 1 (2013/01/09)
This software is in its infancy but provides already the following features:
- a SceneObject class, that is similar to GameObjects in Unity3D, to move, rotate and associate behaviors to 'objects' that populate a scene.
- a Transform class to apply translations and rotations (with the help of quaternions). This class let the programmer build a scene graph by parenting Transform objects together (although culling is not implemented yet).
- a Mesh class to get the 3D mesh associated to a SceneObject.
- a class to create lights (directional, point, spot).
- a Camera class that renders to a texture and accepts multi-pass rendering and post-processing effects (Gaussian blur, Laplace edge detection, Perlin noise are implemented by GLSL shaders). Many cameras can render to textures in a scene.
- a simple architecture to pass values to shaders easily.
- a shader to demonstrate per-pixel lightning.
- etc.
Well, although I'm not very happy because nobody will be impressed by the result, I must prove by pictures that my software works so, see below.
The source code is available under the GPLv2 licence and is my property except if stated otherwise. You can try the APK file, which may work on your Android device. On my HTC Desire, I currently suffer from precision troubles with floats in my shaders which leads to incorrect lighting...