Ogre Procedural [v0.2 officially out]

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Ogre Procedural v0.1 released!

Post by Wolfmanfx »

I have a feature request:
Remove the singleton pattern so we could use it with multiple scenemanagers at once.
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural v0.1 released!

Post by Mikachu »

Wolfmanfx wrote:I have a feature request:
Remove the singleton pattern so we could use it with multiple scenemanagers at once.
Actually, you should already be able to use it with multiple scenemanagers :)
The scenemanager is only used to create a temporary ManualObject, that is destroyed once the mesh is built.
So, what you're left with is just a Mesh, and that's not tied to a SceneManager..
Anyway, I'd like to get rid of that dependency to SceneManager and ManualObject, it feels rather unnatural (ManualObject is very practical to use, but it creates an extra step/buffer between my code and the actual HardwareBuffer generation).
OgreProcedural - Procedural Geometry for Ogre3D
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

pdv373 wrote:Thanks Mikachu, your library is great, and I'm sure Ogre Community appreciates all your hard work. I do as well. Keep it up.
Image
Image
hey, do you think you could give us some example code and data, so we could add it as example to the official distribution? :)

UPDATE: i also just removed this scenemanager hack:
http://code.google.com/p/ogre-procedura ... a674e21365#
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

so i started coding on the XML definition of objects, this is how it looks like atm:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<proceduralmesh>
  <!-- this replicates the sharp edges test -->
  <CatmullRomSpline3>
    <point>0 0 0</point>
    <point>0 0 4</point>
    <point>1 0 5</point>
    <point>5 0 5</point>
    <asPath realize="0">path1</asPath>
  </CatmullRomSpline3>
  <CircleShape name="circle1" radius="3" segments="10" realize="0" />
  
  <Extruder name="default" realize="1">
    <ShapeToExtrude>circle1</ShapeToExtrude>
	<ExtrusionPath>path1</ExtrusionPath>
  </Extruder>
  <Extruder name="default_fixed" realize="1">
    <ShapeToExtrude>circle1</ShapeToExtrude>
	<ExtrusionPath>path1</ExtrusionPath>
	<fixSharpAngles />
  </Extruder>
  
  <!-- TODO: add more -->
  
</proceduralmesh>
the usage for the developer is also very easy:

Code: Select all

Procedural::Serializer s;
s.loadXMLFile("simple-tests.xml");
// realize all meshes that are tagged as "realize"
putMesh(s.realizeAllMeshes(), 1);
// or realize only a specific mesh out of that XML:
//putMesh(s.realizeMesh("default_fixed"), 1);
and the finished 3d version: see attachment

i am not so sure on whether the options and functions should be represented as XML attributes or as child nodes. opinions?

UPDATE: commited to new "serializer" branch: http://code.google.com/p/ogre-procedura ... serializer#
Attachments
screenshot08022011_032851357.jpg
User avatar
zarfius
Gnome
Posts: 367
Joined: Wed Jan 03, 2007 12:44 pm
Location: Brisbane, Australia
x 13
Contact:

Re: Ogre Procedural v0.1 released!

Post by zarfius »

tdev wrote:XML definition of objects
Wow, that's cool :) I've been thinking about adding procedural geometry editing to my Glue Editor project and now there's a file format I can export too. Does anyone else think it would be useful to be able to visually create procedural geometry in an editor?
Craftwork Games - hand crafted entertainment.
http://www.craftworkgames.com/
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

zarfius wrote:
tdev wrote:XML definition of objects
Wow, that's cool :) I've been thinking about adding procedural geometry editing to my Glue Editor project and now there's a file format I can export too. Does anyone else think it would be useful to be able to visually create procedural geometry in an editor?
would be cool, but i guess very hard to realize?

also, added Boxes and capsules to the format after rewriting some internals:

Code: Select all

  <Box size="5 10 5" segments="1 2 3" realize="1" />
  
  <Capsule realize="1" />

  <Capsule radius="5" numRings="10" numSegments="6" segHeight="5" height="15" realize="1" />
Attachments
screenshot08022011_163541168.jpg
pdv373
Gnoblar
Posts: 6
Joined: Sat Jul 30, 2011 12:03 am
x 7

Re: Ogre Procedural v0.1 released!

Post by pdv373 »

tdev wrote: hey, do you think you could give us some example code and data, so we could add it as example to the official distribution? :)
Here's my project and here's how it works:

Data is in xml format exported from http://www.openstreetmap.org/ (see export tab)

Step 1: Project uses tinyxml to parse the data.
Step 2: Project uses OgreProcedural to generate the meshes based on data in the xml. Both of these steps were coded in a quick and dirty ways, so don't expect elegant or efficient or well documented code. Obviously I provide this code to just give you an idea behind what I did.

Some caveats:
1. This project does link to tinyxml.lib and OgreProcedural.lib If you don't have tinyxml, you will need to write your own parsing method, or generate tinyxml library on your machine.
2. You need OgreProcedural.dll in bin folder
3. You need map.osm in the same folder as executable ( any map exported from openstreetmap should work fine)
4. Project uses material file that comes inside the zip.
5. Program only parses and renders "highways" and distinguishes only between 3 of them... all others are rendered in White (including motorways and footpaths). No other objects defined in the xml are rendered.
6. Even though its named "Project 7" I assure you its not a school project and you can use this code any way you like.
Attachments
streets.zip
Sample procedural street map
(242.66 KiB) Downloaded 266 times
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

pdv373 wrote: Here's my project and here's how it works:
awesome, i will see what i can do out of this :)
wanted to write a OSM and inkscape shape reader anyways ^^
User avatar
zarfius
Gnome
Posts: 367
Joined: Wed Jan 03, 2007 12:44 pm
Location: Brisbane, Australia
x 13
Contact:

Re: Ogre Procedural v0.1 released!

Post by zarfius »

tdev wrote:
zarfius wrote:
tdev wrote:XML definition of objects
Wow, that's cool :) I've been thinking about adding procedural geometry editing to my Glue Editor project and now there's a file format I can export too. Does anyone else think it would be useful to be able to visually create procedural geometry in an editor?
would be cool, but i guess very hard to realize?
Realize? Is that a pun? ;)

I can think of a few ways an editor could work for this kind of thing. At the simplest level, you could have a split view between the XML and the 3D render window. That way you could see the results of your changes to the XML as you make them (or maybe after you click a button).

A more advanced way would be a combination of traditional 3D modelling and editing XML. For example, you could edit the individual components like the size of a box or the radius and height of a capsule in the 3D window with click-and-drag. Other properties like numRings and numSegments are edited directly in the XML. Paths are also fairly simple, you can click to create each point then select and drag them into position.

So, yeah. It'd be a lot of work to implement an editor but achievable if it's done in small increments. I'm sure it would make it easier than editing the XML blindly.
Craftwork Games - hand crafted entertainment.
http://www.craftworkgames.com/
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

screenshot08032011_093412723.jpg
thanks for the example, added it to serialization branch, i exchanged TinyXML with RapidXML and rewrote some things, but the idea is the same :)

changes: http://code.google.com/p/ogre-procedura ... serializer

also, found a bug (somehow the second shape crashes):

Code: Select all

	shapes[WAY_RESIDENTIAL] = Shape().addPoint(0.5,0).addPoint(-0.5,0).addPoint(-0.5,-0.3).addPoint(0.5,-0.3).close();
	// with sidewalk
	/*
	//   Schemata:
	//   3---4      7---8
	//   |   5------6   |
	//   2--------------1
	//
	// TODO: this crashes, FIX!
	shapes[WAY_RESIDENTIAL] = Shape()
			.addPoint(1,0)       // 1
			.addPoint(-1,0)      // 2
			.addPoint(-1,-0.5)   // 3
			.addPoint(-0.5,-0.5) // 4
			.addPoint(-0.5,-0.1) // 5
			.addPoint(0.5,-0.1)  // 6
			.addPoint(0.5,-0.5)  // 7
			.addPoint(1,-0.5)    // 8
			.close();
	*/
also, the input data seems to be strange at some points, maybe we could add a cleanup
screenshot08032011_094737873.jpg
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

zarfius wrote: Realize? Is that a pun? ;)

I can think of a few ways an editor could work for this kind of thing. At the simplest level, you could have a split view between the XML and the 3D render window. That way you could see the results of your changes to the XML as you make them (or maybe after you click a button).

A more advanced way would be a combination of traditional 3D modelling and editing XML. For example, you could edit the individual components like the size of a box or the radius and height of a capsule in the 3D window with click-and-drag. Other properties like numRings and numSegments are edited directly in the XML. Paths are also fairly simple, you can click to create each point then select and drag them into position.

So, yeah. It'd be a lot of work to implement an editor but achievable if it's done in small increments. I'm sure it would make it easier than editing the XML blindly.
oh, this way, that would be great :)
an XML side by side to a 3d view should be relatively easy to create.

also, added LOD scheme to road example:
http://code.google.com/p/ogre-procedura ... serializer#

the LOD activates a bit early so you can see it ;)
Attachments
screenshot08032011_101940491.jpg
screenshot08032011_101938610.jpg
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: Ogre Procedural v0.1 released!

Post by Zonder »

It might be worth having an external file option in the xml, was just thinking maybe you made a house in pure procedual geometry but want several in the loaded scene that way you could reduce the bloat in the xml and also be able to update all at once. Maybe this is more for a scene format file than this but thought I would mention.

Great work on that example it really shows this library off.
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural v0.1 released!

Post by Mikachu »

Zonder wrote:It might be worth having an external file option in the xml, was just thinking maybe you made a house in pure procedual geometry but want several in the loaded scene that way you could reduce the bloat in the xml and also be able to update all at once. Maybe this is more for a scene format file than this but thought I would mention.
Yes, that's something I thought about from the beginning... we won't try to build every single model procedurally or we would just end up recreating 3dsmax :)
Also, the xml format is at the proof-of-concept stage, their will be much more work to do until we have something truly great..

I hope we can release a stable version (0.2) in the upcoming month(s), so v0-2 branch is in a feature freeze state, and new features such as file format will be in the future v0-3.
Zonder wrote:Great work on that example it really shows this library off.
Yes, it impresses me too 8)
OgreProcedural - Procedural Geometry for Ogre3D
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

added some more complex shapes so the difference between the LOD levels is bigger. I guess this sample is done with that :)
Attachments
screenshot08032011_112427800.jpg
screenshot08032011_112423147.jpg
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

added SVG import (works with unmodified inkscape files), partly working for non-bezier shapes already:

Code: Select all

// load inkscape .svg file into a shape:
Shape shape = Shape();
shape.loadFromSVG("inkscape-test.svg", "path2985");

// construct the spline we want to extrude along:
CatmullRomSpline3 pp;
pp.addPoint(0,-5,0).addPoint(50,-5,250).addPoint(500,-5,500).setNumSeg(10);
Path line = pp.realizePath();

// extruder and mesh generation
putMesh(shape.realizeMesh());
putMesh(line.realizeMesh(),1);
Extruder e;
putMesh(e.setShapeToExtrude(&shape).setExtrusionPath(&line).realizeMesh(),1);
Attachments
screenshot08032011_175144997.jpg
snapshot2.png
screenshot08032011_175142361.jpg
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Ogre Procedural v0.1 released!

Post by jacmoe »

Wow, Tdev!
You're on fire. :D
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
pdv373
Gnoblar
Posts: 6
Joined: Sat Jul 30, 2011 12:03 am
x 7

Re: Ogre Procedural v0.1 released!

Post by pdv373 »

Oh My :shock: ... That looks fantastic. I see that you decided to skip over version 0.2 and just go straight to 2.0.

Great Job.
dudeabot
Gnome
Posts: 334
Joined: Thu Jun 28, 2007 2:12 pm
Location: Brazil
x 5
Contact:

Re: Ogre Procedural v0.1 released!

Post by dudeabot »

i have to say i <3 this
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Ogre Procedural v0.1 released!

Post by al2950 »

Had not checked up on this thread for a while, and I have to say, WOW :shock: ! Good work Tdev :D
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Ogre Procedural v0.1 released!

Post by duststorm »

I am impressed..
This really is some amazing work. I can see some amazing city/world generators spawning from this.
Developer @ MakeHuman.org
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: Ogre Procedural v0.1 released!

Post by tdev »

Mikachu did an amazing job on this library, i only "use" its API to create things from xml and so forth, so you should thank him instead :)

With a bit of cleanup and polish this will turn out to be really useful for creating dynamic roads, junctions, fences, etc :)
i am currently very busy but i will continue with the XML stuff later on.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Ogre Procedural v0.1 released!

Post by jacmoe »

tdev wrote:Mikachu did an amazing job on this library, i only "use" its API to create things from xml and so forth, so you should thank him instead :)
Yes, indeed.
But a lot of kudos to you because you're the one who really opened up our minds to what's possible :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
dudeabot
Gnome
Posts: 334
Joined: Thu Jun 28, 2007 2:12 pm
Location: Brazil
x 5
Contact:

Re: Ogre Procedural v0.1 released!

Post by dudeabot »

duststorm wrote:I am impressed..
This really is some amazing work. I can see some amazing city/world generators spawning from this.
yes, i was thinking after creating the roads it could add some blocks (maybe start with blocks of larger scales and keep scaling down until they fit a selected area) its already a start for a great city generation toool based on real data =)
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Ogre Procedural v0.1 released!

Post by duststorm »

It would be nice to have a procedural geometry core that allows you to easily do all sorts of geometry generation using available functions and drawing primitives.
Then you could have a plugin infrastructure that allows different procedural generator scripts to be plugged in, for example a plugin for generating roads (be it procedurally or from vector data), cityscapes (like the blender city generator), and virtually anything you could think of.
Developer @ MakeHuman.org
drwbns
Orc Shaman
Posts: 788
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 24

Re: Ogre Procedural v0.1 released!

Post by drwbns »

Reminds me of the Max "path" tool... :)
Post Reply