mardi 22 janvier 2013

Shapes optimisation, Episode II

One of my main difficulty now is to "group" shapes in the scenegraph, because there are to many objects to manage. I can't group an entire building when modeled because of two reasons :


 - My scenegraph JMonkey Engine can't group objects with different textures.
 - As I said before, all shapes are manipulated by the scenegraph and can't be grouped before the rendering.

So I made an algorithm in my modeler, that looks for shapes with identical attributes and post-process like same textures, same rotation axes, same altitudes... and group them in real time during modelisation.

This method is very light and save a huge amont of memory, especialy with big buildings. But the code is not that simple and requires some more work to be implemented.

Here are some visuals of the grouping system in action.


 

The Highways

Here is some news of the road network generation with the implementation of a new pattern : the Highways.

This pattern is quite specific because you can't grow a highway randomly like the other roads, considering only the population density. So I've updated my population density management with an interpolated randomly generated map. It works exactly like a basic landscape generator.

When the population is in place, the engine "casts" a highway in direction of the future city, but when the highway touches high population area, it choose between passing through, or turning around. Algorithms are still to be enhanced but the result is interesting.