Here are some visuals of the app after core modification to avoid generation of bugging polygons, and some few work on modelisation. My first video is also available on youtube (see below), showing the generator in action.
jeudi 28 avril 2011
dimanche 17 avril 2011
Performances
I've done some tests of optimisation with JME3 to increase fps and low necessary memory usage. The first step was to merge the geometries together and it worked well, my framerate increase dramaticaly.
Their is still two problems : the quatity of materials will certainly growup with rules addition and JME can merge only objects with same material, so I will have to test this optimisation method with more realistic rules, and the memory is still overflown because of the number of geometries generated before optimisation, but JME is no culprit for that (as Normen said).
My little 2D extruded system have one big inconvenience : I need to make one mesh for each object before optimisation, because the scenegraph is the only one capable to move and rotate my extruded polygons. So I do many meshes, transform them, then merge them together as much as possible. It takes a long time and memory space. This is a large failure in the object architecture, because formaly, the view code is reponsible of the model modification.
I should get my own 3D prisms and transformation code in the model, so I can manage my objects and merge them as much as possible in one unique mesh, that should be given to the view. Whatever the scenegraph or rendering method I use, this is what I need to do.
Here is a pic to see JME optimisation method : it's not perfect (Ardor, for exemple, makes a global merge and store different materials in a unique packer) but it does the work : 800 000 triangles and 50 fps.
After somes tests and tries, I finaly get my way out and get a correct result with some hundred meters radius full generation and rendering. Of course, I will need to merge vertices and to use a LOD system, but for now, JME performances are quite good. 3 millions of traingles, 4 thousand objects and still 18fps. Thanks to the community for its help !
But my architectural problem still exists and I need to add a transformation layer in my model, and to rewrite some parts of the 3D framework to manage rotation and other stuff myself. Due to the big specialisation of my geometries, I think there are very good optimisaiton opportunities, so I now what to do now.
Their is still two problems : the quatity of materials will certainly growup with rules addition and JME can merge only objects with same material, so I will have to test this optimisation method with more realistic rules, and the memory is still overflown because of the number of geometries generated before optimisation, but JME is no culprit for that (as Normen said).
My little 2D extruded system have one big inconvenience : I need to make one mesh for each object before optimisation, because the scenegraph is the only one capable to move and rotate my extruded polygons. So I do many meshes, transform them, then merge them together as much as possible. It takes a long time and memory space. This is a large failure in the object architecture, because formaly, the view code is reponsible of the model modification.
I should get my own 3D prisms and transformation code in the model, so I can manage my objects and merge them as much as possible in one unique mesh, that should be given to the view. Whatever the scenegraph or rendering method I use, this is what I need to do.
Here is a pic to see JME optimisation method : it's not perfect (Ardor, for exemple, makes a global merge and store different materials in a unique packer) but it does the work : 800 000 triangles and 50 fps.
After somes tests and tries, I finaly get my way out and get a correct result with some hundred meters radius full generation and rendering. Of course, I will need to merge vertices and to use a LOD system, but for now, JME performances are quite good. 3 millions of traingles, 4 thousand objects and still 18fps. Thanks to the community for its help !
But my architectural problem still exists and I need to add a transformation layer in my model, and to rewrite some parts of the 3D framework to manage rotation and other stuff myself. Due to the big specialisation of my geometries, I think there are very good optimisaiton opportunities, so I now what to do now.
(This city made of 250 000 shapes occupy 600 mo in the memory : 50 for the model, 500 for the view, 50 for the control)
vendredi 15 avril 2011
More rules
Many of the neccessarly algorithm are almost working and I can now write some more rules to enhance the modelisation of my buildings. I can :
- Select polygon edge by edge, comparing with front/back/left/right or N/S/E/W attributes, or even roadAccess/noRoadAccess
- Split polygons into one or many widths, and get tiles for widows (for example)
- Extrude edges of a polygon and merge touching polygons
These little algorithms, hard to implement for me and my poor math level, allow a lot of possibilities, as you can see.
Now I've some real troubles of performance, because my L-System generates a large number of meshes, and a very large number of invisible/useless faces. I need both optimise the rendering process and the architecture of my data if I still want to generate whole cities by mass modelisation.
Next step will be to change the scenograph, jMonkey seems not be designed to handle that kind of procedural generation (no good tools to optimize geometries)
- Select polygon edge by edge, comparing with front/back/left/right or N/S/E/W attributes, or even roadAccess/noRoadAccess
- Split polygons into one or many widths, and get tiles for widows (for example)
- Extrude edges of a polygon and merge touching polygons
These little algorithms, hard to implement for me and my poor math level, allow a lot of possibilities, as you can see.
Now I've some real troubles of performance, because my L-System generates a large number of meshes, and a very large number of invisible/useless faces. I need both optimise the rendering process and the architecture of my data if I still want to generate whole cities by mass modelisation.
Next step will be to change the scenograph, jMonkey seems not be designed to handle that kind of procedural generation (no good tools to optimize geometries)
Getting some virtual verticality
Now I need walls ! But... can't get the courageous to code a real 3D framework, because I know it's far from my coding level and would require some very long learning. I've imagined a trick to do 3D with extruded 2D only.
All shapes now have three rendering values : extrusion height, rotation angle and elevation. In fact, without these values, all shapes are only a montain of 2D polygons overlapping in all directions. It's in the view that the 2D polygons are well placed, with the help of the scenegraph transformation methods.
- First, the polygon is triangulated and converted into a 3D mesh by extrusion in a simple parallel prism,
- Second, the prism is moved at the correct (x,y) coordinates and elevated at the correct altitude,
- Third, the prism rotated around a specified axis.
It's like the egytians building obelisks : first you extract the object from the ground, then you move it and rotate it to its final place.
In the rules class, it is much more easier to set my polygons than digging the stone. Only three params. And because an urban environnement is mostly made of horizontal and vertical shapes, I think this method have some potential. Of course, we will be able to put assets on the scene for more detailled objects that need complex meshes.
All shapes now have three rendering values : extrusion height, rotation angle and elevation. In fact, without these values, all shapes are only a montain of 2D polygons overlapping in all directions. It's in the view that the 2D polygons are well placed, with the help of the scenegraph transformation methods.
- First, the polygon is triangulated and converted into a 3D mesh by extrusion in a simple parallel prism,
- Second, the prism is moved at the correct (x,y) coordinates and elevated at the correct altitude,
- Third, the prism rotated around a specified axis.
It's like the egytians building obelisks : first you extract the object from the ground, then you move it and rotate it to its final place.
In the rules class, it is much more easier to set my polygons than digging the stone. Only three params. And because an urban environnement is mostly made of horizontal and vertical shapes, I think this method have some potential. Of course, we will be able to put assets on the scene for more detailled objects that need complex meshes.
Adding rules...
Now, I just have to add rules to get a more realistic city and compute some details on the mass buildings. But to do that, I have to manipulate polygons with a lot of algoritm more complicated one eachothers.
The first algo that I implement is the offset/setback operator, that push somes edges of a polygon insde or outside, changing it's topology, to get new shapes of different forms. On these pics, you can see inside offset and basic L-Shape and U-Shapes giving building the width of a classic appartement. There are also some texturing rules, and a fence generation for houses. Rule creation is done in minutes.
The most important thing is that these algorithms must work on any polygon, in any situation because you never know what the road graph will compute for you. This is certainly the most difficult part of the job : no place for quick and dirty code! on a 20 000 buildings city, the special shitting case is immediatly visible.
The first algo that I implement is the offset/setback operator, that push somes edges of a polygon insde or outside, changing it's topology, to get new shapes of different forms. On these pics, you can see inside offset and basic L-Shape and U-Shapes giving building the width of a classic appartement. There are also some texturing rules, and a fence generation for houses. Rule creation is done in minutes.
The most important thing is that these algorithms must work on any polygon, in any situation because you never know what the road graph will compute for you. This is certainly the most difficult part of the job : no place for quick and dirty code! on a 20 000 buildings city, the special shitting case is immediatly visible.
At least, the L-System for Shape modeling
I now got a social map (invisible on the pics), a road graph of major and minor segments and a ground division.
Any division will be called initial shape, and will be the first data given to my new L-System.
The principle is quite simple : the procedural engine now get a list of shape, which store some geometry info and a single production rule. If the rule is not empty, it apply it to the shape that store it. The rule will transform this shape in one or more shapes, and assign next (or recursive) rules to the successor. Then, the procedural engine get these successors and so on.
This engine is not that easy to manage at the beginning, but it is very powerfull and have no limit. I can create as many rule as I need, and call in any modelisation path I decide.
Here is an exemple of the whole process from graph to divisions, envelopes and detailled shapes.
Any division will be called initial shape, and will be the first data given to my new L-System.
The principle is quite simple : the procedural engine now get a list of shape, which store some geometry info and a single production rule. If the rule is not empty, it apply it to the shape that store it. The rule will transform this shape in one or more shapes, and assign next (or recursive) rules to the successor. Then, the procedural engine get these successors and so on.
This engine is not that easy to manage at the beginning, but it is very powerfull and have no limit. I can create as many rule as I need, and call in any modelisation path I decide.
Here is an exemple of the whole process from graph to divisions, envelopes and detailled shapes.
Making roads more organic
A friend told me every day that the pattern of the minor roads where too much right angled. I used to say "don't worry, it's only a graph matter and I can change it in fives minutes". But will it be that simple?
Five minutes later :
With this procedural architecture, I can work on any stage of the generation proccess, all changes cross the generation layers and give results as well. The tool seem to be very power full and any road pattern can be randomly computed without causing any exception.
Five minutes later :
With this procedural architecture, I can work on any stage of the generation proccess, all changes cross the generation layers and give results as well. The tool seem to be very power full and any road pattern can be randomly computed without causing any exception.
Inscription à :
Articles (Atom)














