Sunday, February 15, 2009

Culling and scene

Speaking of culling, I've finished frustum culling and rendering using an octree as spatial structure. I've began also working on occlusion culling, and found a very intersting paper:

Coherent Hierarchical Culling Revisited

You can download the paper from there. It seems a very good techniques that uses Hardware Occlusion Queries with many render-state friendly optimizations, and seems also a real improvement to the basic technique.
But before moving to occlusion culling, I'm studying the design of the scene management, so when I've done with it I can create a real scene to test the CHC++ and also some simpler techniques of occlusion culling (using occlusion planes/frustum entierely on CPU). I found very interesting the use of occlusion queries, but if the scene you are about to render uses heavly the GPU it can impact the performances too much.
With the advent of the multicore cpus the old-fashioned-cpu culling can be of great impact on the performances.
In the meantime, I'll attach two simple shots of some random-placed meshes (the same as the previous post) this time entirely culled and rendered:

The first is the scene seen from the camera, the second shows the frustum and the object rendered.

Friday, February 13, 2009

Octree and HydraIO!

Hello again...now that I finally closed the section about the previous engine, it's time to talk about the new one!
The name HydraIO, that means "Hydra2" read as binary code, and is the natural successor of the first one.
This version will be more complete and will have more features than Hydra, but it's still under heavy development. The architecture is totally new, the level of abstraction of the resources is different but let me implement all the resources also with consoles in mind, finally the shaders are totally data driven and uses Cg effects as standard. The old assembly used on the first Hydra is dead!
Actually the engine let me load models from 3d studio max, apply a cgfx effect totally data-driven, and now I'm working on culling.
This is the first shot of HydraIO:


a really simple Octree in a random based set of static meshes, next I'll attact a debug shader that let's me know if an object has been culled or not. In the meantime, I want you to know a simple trick about the criteria to be matched to end dividing the octree. In many papers I've read, there's always mentioned the criteria based on the number of polygons: if you are under a threshold, there's no way to not split the octree.
Another simple critera is to let you decide the aabb minimum size, so if you are slicing too much the octree doesn't divide: this was a real salvation for avoid infinite cycles!
Staticmeshes are meshes that have their points transformed in worldspace directly, thus all their shader will have only the multiplication: view * projection, and that are fitted in the octree.

Monday, February 9, 2009

Hydra History #3: the twist in the tale

Then it comes the light.
But first, the tangent and bitangent problem...it causes some really annoying (but funny) parallax effects!












After solving this issue, I began fighting with another great effect: the shadows! After a while, and maaaany problems, I've figure out that the road to the demo lead me to a simple shadow map, with the light cast by the player...
This is the scene without the relief, but with the improved water.
Oh yeah, the water!













The other great effect to improve...after some trial, I've ended with a water like that:













I've used a simple environment map to enhance the visual appeal. The noise is terrible by the way, but tweaking it in assembly was a real PAIN!



This shots shows the technique for reflection and refraction, taken from GPU Gems2 Ch19.
Using also the copy of the framebuffer in directx, you can skip the second render of the scene that contains the refraction mask in the alpha channel!






The final set of effects was near completion, but with some problems. Still, this is not a demo that satisfied myself.






































So I ended up writing an importer from quake3 arena bsp maps...














And added some basic physics with Nvidia PhysX.














On august I ended it and in september I began working in the game industry...but still there are many things I want to know and that I'm studying.
This was my first engine from scratch, now I've began a second one (called Hydra IO ) that is different in architecture and more powerful.
Soon I'll post some shots of it, but right now I'm working on the core...