Is Ogre suitable for DTMS and TINS?

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
jdbyin
Gnoblar
Posts: 6
Joined: Sun Jan 13, 2008 6:34 pm

Is Ogre suitable for DTMS and TINS?

Post by jdbyin »

Greetings

I just stumbled across this project in my quest to find a suitable package to 'view' digital terrain models. I come from a back ground in land surveying and during the course of my work I often have to build DTMs and TINs utilizing AutoCAD. The files and data I produce are collections of triangles stored as data structures containing only the double value of the triangle vertices, in real world coordinates.

Would Ogre be a suitable platform to load these DTMS into? What I have in mind is developing something where I can 'walk' across my surface and look for possible erros and such. Any suggestions or comments are greatly appreciated.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

You should get Ogre (SDK or source) and run the Terrain demo -- it's pretty much what you are looking for. Substitute a step to load your mesh data (you would have to write the loader) for the "setWorldGeometry()" call and you should largely be done (other details beyond that, of course).
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
jdbyin
Gnoblar
Posts: 6
Joined: Sun Jan 13, 2008 6:34 pm

Post by jdbyin »

Thanks. I'll download it and give it a go
jdbyin
Gnoblar
Posts: 6
Joined: Sun Jan 13, 2008 6:34 pm

Post by jdbyin »

Ok the Terrain Demo is almost exactly what I am after but after looking at the wiki and the docs I guess i'm overlooking a method to add a lot of single triangles.

The data i'll be importing will look like

x,y,z 'start triangle 1
x,y,z
x,y,z
x,y,z 'start triangle 2
x,y,z
x,y,z

The models I work with may have anywhere from a few hundred to maybe fifty thousand triangles. Any suggestions on the best way to get this data into ogre?
User avatar
Falagard
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2060
Joined: Thu Feb 26, 2004 12:11 am
Location: Toronto, Canada
x 3
Contact:

Post by Falagard »

Can you sample the data using a regular grid and turn it into a heightmap?

If not, you could just build a mesh from the data - 50,000 triangles should be fine .
jdbyin
Gnoblar
Posts: 6
Joined: Sun Jan 13, 2008 6:34 pm

Post by jdbyin »

I can sample the data in a regular grid but for this particular tool I really need to work directly with the triangles.
User avatar
johnhpus
Platinum Sponsor
Platinum Sponsor
Posts: 1186
Joined: Sat Apr 17, 2004 2:49 am
x 3

Post by johnhpus »

I haven't used the terrain system much, so I don't know how to input geometry other than to use a heightmap. It seems like you could find an answer in the source.

If you don't care about whatever features using the terrain system adds, you could just build an Ogre mesh using ManualObject. You could also make the conversion part of a command line tool.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Post by Kojack »

I've got a 65000 poly rabbit mesh (good old stanford bunny). :)

Loading the triangle data into a ManualObject should work fine.

(ManualObject is a simple way of building up a mesh using triangles at run time, without needing to worry about all the low level details)
jdbyin
Gnoblar
Posts: 6
Joined: Sun Jan 13, 2008 6:34 pm

Post by jdbyin »

Thanks guys. I'll look into ManualObject now.
jdbyin
Gnoblar
Posts: 6
Joined: Sun Jan 13, 2008 6:34 pm

Post by jdbyin »

Ok using the example code here

I've got my triangles loaded. Is there anyway though to 'clamp' the camera to these triangles like in the Terrain demo?
User avatar
johnhpus
Platinum Sponsor
Platinum Sponsor
Posts: 1186
Joined: Sat Apr 17, 2004 2:49 am
x 3

Post by johnhpus »

The terrain sample does this by using a scene query. Unfortunately, except in the case of the terrain scene manager, a scene query will return information about where it collided with a bounding box, not the actual mesh.

So three suggestion. Write your own collision system, figure out how to make the terrain scene manager use your mesh data, or use something like Newton or Opcode (both of which have Ogre related wrappers, OgreNewt and OgreOpcode).
Horizon
Greenskin
Posts: 122
Joined: Thu Jun 02, 2005 3:24 pm

Post by Horizon »

Easy, just like in the terrain demo, cast a ray down, but this time instead of taking the WorldFragment just take the distance to whatever is hit first (in this case just some triangle) and lower the camera by that distance.

Edit: Oh crap, that's right, Ogre doesn't do triangle level raycasting, been working with other stuff to much recently :P.
Post Reply