The editor is functional. There are still some small improvements to do but here a sample :
And the result in application :
Monday, June 7, 2010
Wednesday, March 31, 2010
Model Editor finished.
Now, models can be aggregated using the GroupModelEditor. This will allow to add and manipulate complex models into the scene.
Here the editor :
This editor allow to aggregate severals md2 models into one entitie.
Each "sub-model" have a field called type. This type can be associated to a custom object class derived from GLModelObject.
After that, each sub-model can be handled one by one.
Here an example :
NOTE : It's more efficient to move a static object with code than using Model animation. Static objects are loaded into VBO. If you rotate a VBO object, there is few datas sent into the bus. Whereas if animations are used, each vertices are sent at each render(only if modified), into the bus. On PC it's less important as buses (AGP or PCI-E) are very fast. But on mobile device, buses are slower.
In the near futur, I will make scriptable the above code, maybe with Lua. It will allows non-programmers to create a scene, and make it "alive!"
Here the editor :
This editor allow to aggregate severals md2 models into one entitie.
Each "sub-model" have a field called type. This type can be associated to a custom object class derived from GLModelObject.
After that, each sub-model can be handled one by one.
Here an example :
NOTE : It's more efficient to move a static object with code than using Model animation. Static objects are loaded into VBO. If you rotate a VBO object, there is few datas sent into the bus. Whereas if animations are used, each vertices are sent at each render(only if modified), into the bus. On PC it's less important as buses (AGP or PCI-E) are very fast. But on mobile device, buses are slower.
In the near futur, I will make scriptable the above code, maybe with Lua. It will allows non-programmers to create a scene, and make it "alive!"
Thursday, March 4, 2010
All effects
After added ground reflection :
All contacts are loaded from Android phonebook. The thumbnails comes from phonebook too.
Thursday, February 18, 2010
How to make bloom effect without shaders
The "bloom light" effect will give this kind of result :
What we would like, it's to make it run on a device that does not support any shaders. The following method has been done using OpenGL ES 1.1 and a framebuffer object.
First you need to create a framebuffer object using glBindFramebufferOES() and co. (glBindFramebufferEXT for OpenGL). In my case, the framebuffer have the same size of the screen. (I have tried with smaller Framebuffer with no really gain of performances)
When you create this framebuffer, you must use the following parameter :
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Then, bind your framebuffer and set the viewport to 0,0,ScreenWidth>>1,ScreenHeight>>1 (Green square on picture).
Render all your objects that will be affected by bloom light and other objects in black color with no texture.
After that, reset the viewport to 0,0,ScreenWidth,ScreenHeight. Render a rectangle that will use this Framebuffer as texture. (Yes It works). This rectangle should have this size : ScreenWidth>>2,ScreenHeight>>2 and can be rendered at the top left of the framebuffer. Repeat the operation with rectangle size of ScreenWidth>>3,ScreenHeight>>3 and ScreenWidth>>4,ScreenHeight>>4.
Your framebuffer content should be as following :
Ok, now unbind your framebuffer to render on the screen. Render your scene as usual on the screen buffer.
Once, it's done, bind your framebuffer as a texture and render 4 rectangles of the screen size. Make texture coordinates match with each 4 thumbnails from framebuffer.
Use additive color blend while you render your square: glBlendFunc(GL_SRC_ALPHA, GL_ONE_BLEND);
Here the rendering process :
Note :
Texture of ScreenWidth>>1,ScreenHeight>>1 = 1:2
Texture of ScreenWidth>>2,ScreenHeight>>2 = 1:4
Texture of ScreenWidth>>3,ScreenHeight>>3 = 1:8
Texture of ScreenWidth>>4,ScreenHeight>>4 = 1:16
First, render rectangle of 1:2 using alpha value of 10% over your final scene.
Repeat the operation for rectangles :
- 1:4 with alpha 15%
- 1:8 with alpha 34%
- 1:16 with alpha 60%
That's done your bloom light effect is completed.
NOTE : This implementation depend on OpenGL ES driver implementation. On Acer liquid, if bloom is enable I get about 15 fps and if it's disabled I get 55-60 fps. On PC, I do not detect such performances fall.
If I found a way to improve performances, I will update this post.
Sources : http://developer.amd.com/media/gpu_assets/GDC06-GLES_Tutorial_Day-Ginsburg-Advanced_Rendering.pdf
Tuesday, February 16, 2010
Poseidon ported on Android.
Here a short video of an application that use Poseidon on Android.
The phone used is an Acer liquid.
The phone used is an Acer liquid.
Tuesday, January 26, 2010
OpenGL / GLES Picking Method in Poseidon
I will explain, how in Poseidon Picking method works.
First of all, the method of picking in OpenGL using glRenderMode(GL_SELECT) and co. are not available under OpenGL ES.
After googling, I found this solution :
- When the mouse is pressed I make a quick render of the scene. The texture are disabled, color shading is disabled and other effects are also disabled.(fog, lights, dither ...)
When a GLObject is rendered a color is associated to this object. Ex: (0A,05,00). As there is the GLWrapper, the color used for rendering is bypass here.
- Once the scene is rendered, I read the pixel at the clicked position. Then, we can compare the read color and GLObject color. We look if color are similar, not exactly match. When you are in 16 bits color rendering, colors may be scaled. That's why when we assign a color to GLObject, we step the next color value of 32(edit : explaination after).
- After that, we render the scene normaly and swap buffers.
Here a rendering using this
picking method.(Not visible on screen)
picking method.(Not visible on screen)
And now the visible rendering.
Here the computation to select GLObject color :
- Select a Red, Green and Blue unique value. Each channel value should be in [0..32[
- Left Shift Bit each channel by 3
When a color is read, compare each channel of read color(Cr) and object color(Co).
For each channel C :
if (abs(Cr-Co) < D)
{
// Channel match !
}
Where D is equal to 5 8. For each color you can have an error of 10 (Co +5 or -5).
EDIT :
To sum up :
- each R/G/B values are in [0..32[
- After the bit shift of 3, the result R/G/B are in [0..256[
But in 16-bits colors mode (for instance 565) :
- When you read back the pixel, R is coded on 5 bits, G on 6 and B on 5 bits.
Let's look on Red channel. The possibles values are limited to 2⁵ = 32.
So the red value is fitted from 256 to 32 ranged.
The way that the value is scaled is obscur for me but if you draw with
red value of 200 and you read back the value, it will be 206.
But anyway, this difference cannot exceed 8 = 256 / 32.
To sum up :
- each R/G/B values are in [0..32[
- After the bit shift of 3, the result R/G/B are in [0..256[
When you are in 24-bits colors :
- When you read back the pixel, you will get the exact same value.
But in 16-bits colors mode (for instance 565) :
- When you read back the pixel, R is coded on 5 bits, G on 6 and B on 5 bits.
Let's look on Red channel. The possibles values are limited to 2⁵ = 32.
So the red value is fitted from 256 to 32 ranged.
The way that the value is scaled is obscur for me but if you draw with
red value of 200 and you read back the value, it will be 206.
But anyway, this difference cannot exceed 8 = 256 / 32.
Impressive !!!
http://mi.eng.cam.ac.uk/~qp202/
And the video :
"The system works by calculating the Delaunay tetrahedralisation of a point cloud obtained from on-line structure from motion estimation which is then carved using a recursive and probabilistic algorithm to rapidly obtain the surface mesh."
When I was at University, I have worked on a project using Delaunay triangulation, A-Shape and Voronoï diagram. Our project was to rebuild A-Shape from a point cloud. We used the library CGAL (http://www.cgal.org/) to compute each shape.
And the video :
"The system works by calculating the Delaunay tetrahedralisation of a point cloud obtained from on-line structure from motion estimation which is then carved using a recursive and probabilistic algorithm to rapidly obtain the surface mesh."
When I was at University, I have worked on a project using Delaunay triangulation, A-Shape and Voronoï diagram. Our project was to rebuild A-Shape from a point cloud. We used the library CGAL (http://www.cgal.org/) to compute each shape.
Subscribe to:
Posts (Atom)









