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
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

Yes, the screenshot you're seeing above is taken from the "Extrusion" sample, which mixes various uses of extruder, shapes, path, track and lathe.
For a more in-depth view of every feature, you can refer to the user manual...
OgreProcedural - Procedural Geometry for Ogre3D
drwbns
Orc Shaman
Posts: 788
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 24

Re: Ogre Procedural [v0.2 officially out]

Post by drwbns »

Are the boolean operations fast enough to perform real time destruction of complex shapes?
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Ogre Procedural [v0.2 officially out]

Post by Klaim »

Congrats Mikachu, looks like awesome work done.

Also, I feel the same about CMake/integration stuffs in my own projects, all those infrastructure are necessary to keep the project going on but stilll it's a productivity killer, in particular when you are alone on the project. :(
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

drwbns wrote:Are the boolean operations fast enough to perform real time destruction of complex shapes?
I haven't benchmarked it seriously, my tests would say it's fast enough ;)
I think it's O(n^2) complexity, because of the intersection finding code, so it really depends on the size of the input.
Anyway, boolean operations are 2D only at the moment, so the main limitation is in which situation you intend to use it :)
Klaim wrote:Congrats Mikachu, looks like awesome work done.
Thanks :D
Klaim wrote:Also, I feel the same about CMake/integration stuffs in my own projects, all those infrastructure are necessary to keep the project going on but stilll it's a productivity killer, in particular when you are alone on the project.
Yes, it's a big investment.. setting all that stuff up takes a lot of time, but it sould be rewarding in the long term :P (also, there's a big learning curve, using that for another project should take a bunch of copy/pasting..)
OgreProcedural - Procedural Geometry for Ogre3D
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.2 officially out]

Post by jacmoe »

It *is* rewarding in the long run.
Each and every project, after having beat that learning curve, is only going to be less and less work (and more fun) =)

And Ogre Procedural is indeed an awesome project! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Kludgy
Gnoblar
Posts: 2
Joined: Wed May 09, 2012 8:12 am

Re: Ogre Procedural [v0.2 officially out]

Post by Kludgy »

Hi Mikachu,

Fantastic work on the library! My hat is off to you for dealing with notoriously difficult pathological cases.

I'm posting for duller reasons though: I've run into an Entry Point Not Found error when running the OgreProceduralSDK_vs10_v0.2.7z package DLL's with those from the OGRE 1.7.4 SDK for Visual C++ .Net 2010 (32-bit). Can anyone else confirm this? The specific error messages for debug and release targets, respectively are:

"The procedure entry point ??0Quaternion@Ogre@@QAE@XZ could not be located in the dynamic link library OgreMain_d.dll."
"The procedure entry point ??0Quaternion@Ogre@@QAE@XZ could not be located in the dynamic link library OgreMain.dll."

Rebuilding from https://code.google.com/p/ogre-procedural/ has addressed the issue here. :)

Cheers!
saftschachtel
Gnoblar
Posts: 1
Joined: Tue May 31, 2011 11:55 am

Re: Ogre Procedural [v0.2 officially out]

Post by saftschachtel »

Hi Mikachu,

congrats to the great work. I have one suggestion for your code.
In the file "ProceduralUtils.h" i replaced the code.

Code: Select all

static void log(const Ogre::String& st)
{
	Ogre::LogManager::getSingleton().logMessage("[PROCEDURAL] " + st);
	#if (PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_WIN32)		
		OutputDebugString( (st + "\n").c_str() );
	#endif
}
with the following lines:

Code: Select all

static void log(const Ogre::String& st)
{
	Ogre::LogManager::getSingleton().logMessage("[PROCEDURAL] " + st);
	#if (PROCEDURAL_PLATFORM == PROCEDURAL_PLATFORM_WIN32)		
		#ifdef UNICODE
			std::basic_ostringstream<TCHAR> buf;
			buf << st.c_str();
			std::wstring wst = buf.str();					
			OutputDebugString( wst.c_str() );
		#else
			OutputDebugString( (st + "\n").c_str() );
		#endif	
	#endif
}
If you do that, you are able to compile in the library in Multibyte and Unicode chracter-sets.
Otherwise i got a compile-error. The code is tested and should work.

Greetings
Saft
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

@kludgy:
Yes, the thing is that i built the sdk against ogre 1.8, so you can only use it with that branch of ogre. (hence why i posted a link to a prebuilt ogre 1.8 binary)
Or you can also rebuild it against the ogre version you're using, which you actually did :)

@saft: ok, thanks for noticing, i'll fix it as soon as i get back to my dev machine :)
OgreProcedural - Procedural Geometry for Ogre3D
Kludgy
Gnoblar
Posts: 2
Joined: Wed May 09, 2012 8:12 am

Re: Ogre Procedural [v0.2 officially out]

Post by Kludgy »

@Mikachu:
My bad for not noticing! Thank you for the reply. :)
pdv373
Gnoblar
Posts: 6
Joined: Sat Jul 30, 2011 12:03 am
x 7

Re: Ogre Procedural [v0.2 officially out]

Post by pdv373 »

First of all congrats on 0.2 release. I know quite a bit work went into it.

Second, I have a question. Is it possible to create an extruded road just like in the Extrusion Example, but with path not closed. When I do not call close() on path, it seems to render it weird. And I also apologize if this has been asked before.
jokoon
Goblin
Posts: 203
Joined: Sun Aug 23, 2009 8:30 am
x 3

Re: Ogre Procedural [v0.2 officially out]

Post by jokoon »

I don't understand you posted a screenshot, but it seems to be the same which was done with 0.1.
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

pdv373 wrote: Second, I have a question. Is it possible to create an extruded road just like in the Extrusion Example, but with path not closed. When I do not call close() on path, it seems to render it weird. And I also apologize if this has been asked before.
It should work, if it doesn't, it's probably a bug :(
Could you please post a screenshot and some code reproducing the problem?
jokoon wrote:I don't understand you posted a screenshot, but it seems to be the same which was done with 0.1.
No, 0.1 only featured primitives (and only sample_primitive was included)
OgreProcedural - Procedural Geometry for Ogre3D
pdv373
Gnoblar
Posts: 6
Joined: Sat Jul 30, 2011 12:03 am
x 7

Re: Ogre Procedural [v0.2 officially out]

Post by pdv373 »

Thanks for the reply Mikachu, I really appreciate the help.

The code is taken directly from the Extrusion Sample. So PutMesh3() function is exactly the same. The only thing that I'm doing different is not calling close() function on a path.

Code: Select all

Procedural::Path p = Procedural::CatmullRomSpline3().setNumSeg(8).addPoint(0,0,0).addPoint(0,0,10).addPoint(10,0,10).addPoint(20,0,0).realizePath().scale(2);
Procedural::Shape s = Procedural::Shape().addPoint(-1.2f,.2f).addPoint(-1.f,.2f).addPoint(-.9f,.1f).addPoint(.9f,.1f).addPoint(1.f,.2f).addPoint(1.2f,.2f).scale(2).setOutSide(Procedural::SIDE_LEFT);
Procedural::Track textureTrack = Procedural::Track(Procedural::Track::AM_POINT).addKeyFrame(0,0).addKeyFrame(2,.2f).addKeyFrame(3,.8f).addKeyFrame(5,1);
Procedural::Extruder().setExtrusionPath(&p).setShapeToExtrude(&s).setShapeTextureTrack(&textureTrack).setUTile(20.f).realizeMesh("extrudedMesh");
putMesh3("extrudedMesh");
What I end up getting looks like this:
Image


And while I have your attention, I also have some trouble with Triangulator: The shape itself triangulates fine; but the setPosition() and setOrientation() does not modify the mesh in any way. Here's some code:

Code: Select all

		Procedural::Shape pb=Procedural::Shape().addPoint(0,0).addPoint(100,0).addPoint(100,300).addPoint(0,200);
		pb.setOutSide(Procedural::SIDE_LEFT);
		pb.close();
		Procedural::Triangulator().setShapeToTriangulate(&pb).setPosition(100,200,200).setOrientation(Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_X)).realizeMesh("trishape");
		putMesh2("trishape");
I really do appreciate your help. Unfortunately this is probably not the last time I will ask questions as I am noticing some other weird things as I am trying different shapes and paths.
caduceus
Goblin
Posts: 224
Joined: Tue May 08, 2012 6:39 am

Re: Ogre Procedural [v0.2 officially out]

Post by caduceus »

I would like to show an image on front face of the cube. Please guide me as how can i accomplish it. As far as i know there are no submeshes in the box mesh.
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

@pdv373 ok, I've taken note of the issue and will adress it as soon as I get back to my dev machine..

@caduceus there's currently no way to customise the way texcoords are generated, and the cube mesh shows the same texture rectangle on each of its face, so the easiest way to do it at the moment would be to replicate the code in boxgenerator, and modify texcoords (it's quite easy, as the boxgenerator itself makes use of the planegenerator)
OgreProcedural - Procedural Geometry for Ogre3D
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

I finally got back from holidays :D

I just fixed the bugs raised by pdv373 and saftschachtel, you can update from the v0-2 branch of the main repo to get it (will be merged soon to the default branch).

[s]My continuous build server configuration got wrong, though, so the binary SDK is not yet updated..[/s] The updated SDK is available here
OgreProcedural - Procedural Geometry for Ogre3D
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: Ogre Procedural [v0.2 officially out]

Post by Transporter »

I've extended the current release with a spring generator. Feel free to use my code!

ProceduralSpringGenerator.h

Code: Select all

#ifndef PROCEDURAL_SPRING_GENERATOR_INCLUDED
#define PROCEDURAL_SPRING_GENERATOR_INCLUDED

#include "ProceduralPlatform.h"
#include "ProceduralMeshGenerator.h"

namespace Procedural
{

class _ProceduralExport SpringGenerator : public MeshGenerator<SpringGenerator>
{
	Ogre::Real mHeight,mRadiusHelix,mRadiusCircle;
	int mNumSegHeight, mNumSegPath, mNumSegCircle;
public:
	/// Contructor with arguments
	SpringGenerator(Ogre::Real height=1.f, Ogre::Real radiusHelix=1.f, Ogre::Real radiusCircle=0.1f, int numSegHeight=1, int numSegPath=10, int numSegCircle=8) : 
	  mHeight(height), mRadiusHelix(radiusHelix), mRadiusCircle(radiusCircle), mNumSegHeight(numSegHeight), mNumSegPath(numSegPath), mNumSegCircle(numSegCircle) {}

	/** Sets the height of the spring (default=1)  */
	SpringGenerator& setHeight(Ogre::Real height)
	{
		mHeight = height;
		return *this;
	}

	/** Sets helix radius (default=1) */
	SpringGenerator& setRadiusHelix(Ogre::Real radiusHelix)
	{
		mRadiusHelix = radiusHelix;
		return *this;
	}

	/** Sets radius for extruding circle (default=0.1) */
	SpringGenerator& setRadiusCircle(Ogre::Real radiusCircle)
	{
		mRadiusCircle = radiusCircle;
		return *this;
	}

	/** Sets the number of segments along the height of the spring (default=1) */
	SpringGenerator& setNumSegHeight (int numSegHeight)
	{
		mNumSegHeight = numSegHeight;
		return *this;
	}

	/** Sets the number of segments along helix path (default=10) */
	SpringGenerator& setNumSegPath(int numSegPath)
	{
		mNumSegPath = numSegPath;
		return *this;
	}

	/** Sets the number of segments for extruding circle (default=8) */
	SpringGenerator& setNumSegCircle(int numSegCircle)
	{
		mNumSegCircle = numSegCircle;
		return *this;
	}

	/**
	 * Builds the mesh into the given TriangleBuffer
	 * @param buffer The TriangleBuffer on where to append the mesh.
	 */
	void addToTriangleBuffer(TriangleBuffer& buffer) const;
};

}
#endif
ProceduralSpringGenerator.cpp

Code: Select all

#include "ProceduralStableHeaders.h"
#include "ProceduralSpringGenerator.h"
#include "ProceduralShape.h"
#include "ProceduralShapeGenerators.h"
#include "ProceduralPath.h"
#include "ProceduralPathGenerators.h"
#include "ProceduralExtruder.h"

using namespace Ogre;

namespace Procedural
{

void SpringGenerator::addToTriangleBuffer(TriangleBuffer& buffer) const
{
	assert(mNumSegHeight>0 && mNumSegPath>0 && mNumSegCircle>0 && "Num seg must be positive integers");
	assert(mHeight>0. && "Sizes must be positive");
	assert(mRadiusHelix>0. && mRadiusCircle>0. && "Radians must be positive");

	RoundedCornerSpline3 helix;
	Real step = 1.0f / (Real)mNumSegPath;
	helix.setNumSeg(mNumSegPath * mNumSegHeight);
	Real t = 0.0f;
	while(t < (Real)mNumSegHeight)
	{
		helix.addPoint(mRadiusHelix * cosf(Math::TWO_PI * t), mHeight / (Real)mNumSegHeight * t, mRadiusHelix * sinf(Math::TWO_PI * t));
		t += step;
	}

	Path p = helix.realizePath();

	Shape s = CircleShape().setRadius(mRadiusCircle).setNumSeg(mNumSegCircle).realizeShape();

	Extruder().setExtrusionPath(&p).setShapeToExtrude(&s).addToTriangleBuffer(buffer);
}

}
Example:

Code: Select all

	Procedural::SpringGenerator().setNumSegHeight(5).setHeight(6.0f).realizeMesh("springMesh");
	Ogre::Entity* entSpring = mSceneMgr->createEntity("springMesh");
	Ogre::SceneNode* snSpring = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	snSpring->attachObject(entSpring);
	entSpring->setMaterialName("SolidBlue");
	entSpring->setCastShadows(true);
caduceus
Goblin
Posts: 224
Joined: Tue May 08, 2012 6:39 am

Re: Ogre Procedural [v0.2 officially out]

Post by caduceus »

Mikachu wrote:@pdv373 ok, I've taken note of the issue and will adress it as soon as I get back to my dev machine..

@caduceus there's currently no way to customise the way texcoords are generated, and the cube mesh shows the same texture rectangle on each of its face, so the easiest way to do it at the moment would be to replicate the code in boxgenerator, and modify texcoords (it's quite easy, as the boxgenerator itself makes use of the planegenerator)
Can you please give some some hints as how can I do that. I need that in my project but dont want to reinvent the wheel. Thank you
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

@Transporter : Cool :D
I may include that as a primitive (or at least include "the helix path" as a path primitive).
Thanks for your contribution :)

@caduceus :
What I'm suggesting is that you copy the code of the BoxGenerator class in your project, rename it, and modify this :

Code: Select all

...
pg.setNumSegX(mNumSegY).setNumSegY(mNumSegX).setSizeX(mSizeY).setSizeY(mSizeX)
	  .setNormal(Vector3::NEGATIVE_UNIT_Z)
	  .setPosition(mPosition+.5f*mSizeZ*(mOrientation*Vector3::NEGATIVE_UNIT_Z))
	  .addToTriangleBuffer(buffer);
...
As you can see, the addToTriangleBuffer method in BoxGenerator makes use of PlaneGenerator, 6 times, one for each side of the box.
What you should do is use setTextureRectangle to some value (which corresponds to the part of your texture with the image) for one of the face, and to another value for the other 5 sides.
OgreProcedural - Procedural Geometry for Ogre3D
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: Ogre Procedural [v0.2 officially out]

Post by Transporter »

Mikachu wrote:@Transporter : Cool :D
I may include that as a primitive (or at least include "the helix path" as a path primitive).
Thanks for your contribution :)
You are welcome! Feel free to include and/or modify my code. I try to append more objects. :)
noorus
Halfling
Posts: 75
Joined: Wed Apr 20, 2011 9:55 pm
Location: Helsinki, Finland
x 3

Re: Ogre Procedural [v0.2 officially out]

Post by noorus »

Congratulations on 0.2, really glad to see this project moving forward steadily, if slowly :wink:
Ogre Procedural is an important project, because it pretty much stands alone in the field of procedural content generation for Ogre.
Good thing you chose to do this instead of yet another GUI or something :roll:
Creator of Nice Input Library, for your advanced input needs.
Image
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: Ogre Procedural [v0.2 officially out]

Post by Transporter »

I'm back with another contribution :D

The patch deleted patch contains the following changes:
  • New path class HelixPath which creates a helix curved path
  • New path class BezierCurve3 which creates a bezier curved path
  • New path class BezierCurve2 which creates a bezier curved shape
  • Simple SVG parser to parse simple SVG files using rapidxml
  • Sample project for SVG parser
  • SpringGenerator (uses HelixPath) which creates meshed springs as primitives
  • Add a spring to primitive sample
  • Add function convertToShape() to convert a path into a 2D shape (reverse of convertToPath)
Last edited by Transporter on Tue Jun 26, 2012 3:23 pm, edited 1 time in total.
User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France
x 35

Re: Ogre Procedural [v0.2 officially out]

Post by Mikachu »

Wow!
Sure looks like a big patch :D
Thank you for that..

I will have to have a closer look before applying it, because tdev already worked on a SVG parser, so I want to merge both ;)
Also, I'm on a big feature now, I'll try finishing it (or at least produce a usable WIP) before getting back to this.
OgreProcedural - Procedural Geometry for Ogre3D
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: Ogre Procedural [v0.2 officially out]

Post by Transporter »

Mikachu wrote:I will have to have a closer look before applying it, because tdev already worked on a SVG parser, so I want to merge both ;)
I have seen the serializer branch. The branch is more than one year old and only supports the path-element with m/M and z/Z. A sample is also missing. :(
My variant supports all primitives (rectangle, circle, ellipse, polygon) and all path-commands (m/M, z/Z, l/L, h/H, v/V, c/C, s/S, q/Q, t/T and a/A). :) I'm sorry tdev :wink:
Mikachu wrote:Also, I'm on a big feature now, I'll try finishing it (or at least produce a usable WIP) before getting back to this.
Nice! What is it? If you like you can send me a patch with your feature and I'll test it. :wink:

I'll add a new patch tomorrow to add a doxygen project to cmake and create the documentation for SDK (also including Ogre Procedural Manual).

Btw, I implemented an other feature: I have a lua script support for ogre procedual. I can create new primitives by a script without recompiling my ogre program.
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: Ogre Procedural [v0.2 officially out]

Post by Transporter »

I've updated the patch from yesterday. Complete change log:
  • New path class HelixPath which creates a helix curved path
  • New path class BezierCurve3 which creates a bezier curved path
  • New path class BezierCurve2 which creates a bezier curved shape
  • New shape class EllipseShape which creates an ellipse shape
  • Simple SVG parser to parse simple SVG files using rapidxml
  • Sample project for SVG parser
  • SpringGenerator (uses HelixPath) which creates meshed springs as primitives
  • Add a spring to primitive sample
  • Add function convertToShape() to convert a path into a 2D shape (reverse of convertToPath)
  • Add function binom() to calculate binomenal coefficients (required for bezier curves with more than 4 control points)
  • Update and fix Doxygen generation (manual and api are combined now)
  • Change names of svg classes for a better documentation
Attachments
ogre-procedural-great.patch
Updated patch
(198.15 KiB) Downloaded 286 times
Post Reply