Newbie: Terrain data usage and platforms

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Rock2000
Gnoblar
Posts: 4
Joined: Fri Nov 07, 2014 4:58 pm
x 1

Newbie: Terrain data usage and platforms

Post by Rock2000 »

I'm new to Ogre and I have a few questions. One easy one is about the platforms supported. Is iOS and Android support official currently? Looking in the Features section from the homepage, those aren't listed. But my impression from other locations seem to indicate that this support is there?

The other question is about terrain/world data. I'd like to just assign a mesh to the terrain, but I don't see any API to do that. The terrain API in the scene manager seems to only take some configuration file as input, and generates the terrain? Is there some way to load the terrain mesh like I load movableObjects? It seems odd that the terrain would be handled so differently from other meshes.

Thanks
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Newbie: Terrain data usage and platforms

Post by spacegaier »

Yes, Ogre runs on Android, iOS and Windows Phone.

Ogre::Terrain can either generate a flat terrain, a terrain based of an height map or of a list of float values, representing the height. See the ImportData structure for reference.

If you have an existing mesh, you can load its values and pass them as floats to convert them. The Ogre::Terrain component uses an own binary format to store the resulting terrain pages for later use, so you could do the conversion once and then use the optimized binary format.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Newbie: Terrain data usage and platforms

Post by c6burns »

It's not really that odd for a terrain system to work this way. In fact I don't know any terrain systems that allow you to input an arbitrary mesh ... just heightmap data. The reason is because of how terrain systems handle LOD levels for you using an optimized algorithm that requires evenly spaced vertices. If you want to use a mesh as terrain, you totally can do that. You don't need the terrain system at all in that case, just create an entity from your mesh and attach to a scenenode as you would with any other entity. Or create a heightmap for ogre's terrain component from your geometry in DCC tools (often this is done by raytracing a displacement map)
Rock2000
Gnoblar
Posts: 4
Joined: Fri Nov 07, 2014 4:58 pm
x 1

Re: Newbie: Terrain data usage and platforms

Post by Rock2000 »

I was just noticing that the terrain system is inherently tile/grid based. I'm not working on a game so I don't have that use case. I have an arbitrarily sized mesh.

OK, I am creating a mesh/scenenode currently, and it draws great. So that would be fine. But the next thing I wanted to do was basically terrain collision, like in Intermediate Tutorial 2. This tutorial may not be up to date and so I'm a little confused on the current ray querying technique, but in either case it seems like it only works with 'terrain'? I tried to do a ray query against my scenenode, but it doesn't give me the actual intersection point like the worldFragment seems to return. And the distance that it returns from the ray start point SEEMS to be the distance to the node's bounding box and not the actual intersection point. Is there a way to get the terrain collision/intersection behavior without using 'terrain'?

Thanks
Rock
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Newbie: Terrain data usage and platforms

Post by c6burns »

I think you are right, scene queries use the bounding box. For raycasting to the polygon level, I use a physics library (specifically Bullet), but this may be overkill for you. I have heard of something called MOC (Minimal Ogre Collision) which I believe will do queries to the polygon level and is much lighter weight than a full physics library. I have personally never used it though, so I can't say any more.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Newbie: Terrain data usage and platforms

Post by spacegaier »

Quote from here:
MOC (Minimal Ogre3d Collision) is a small library with the aim to provide simple and easy to use collision and mouse-picking functionality for the Ogre3D graphics engine written by Thomas Gradl (Nauk) and Esa Kylli (wannabee). It is based on the Ogre3D Wiki entry "Raycasting down to Polygon-Level".
Wiki page: http://www.ogre3d.org/tikiwiki/tiki-ind ... +Collision
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Rock2000
Gnoblar
Posts: 4
Joined: Fri Nov 07, 2014 4:58 pm
x 1

Re: Newbie: Terrain data usage and platforms

Post by Rock2000 »

Thanks, I'll look into that. Is the theory that this is spatially optimized in some way, like the terrain should be? My terrain could be quite large, so I don't want to lose the ability to have spatial queries.

Thanks
Rock2000
Gnoblar
Posts: 4
Joined: Fri Nov 07, 2014 4:58 pm
x 1

Re: Newbie: Terrain data usage and platforms

Post by Rock2000 »

Dang, it seems to be pretty brute force, and takes too long to run continuously for my sized meshes. I guess I'll have to come up with something else.

Thanks
Post Reply