Generating+saving an overhead map image of a model/level?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

Generating+saving an overhead map image of a model/level?

Post by Josh1billion »

My goal is to generate (and save as an image file) an overhead map of my level geometry, which is just a .obj model, at a certain scale ratio (i.e., 1 pixel of the image = 10 units of the model). Preferably, I'd want to have the process be as automated and consistent as possible, as I'll be doing this for a couple dozen levels. The scale ratio is very important to be as accurate as possible, as the images will be used for a minimap in the game...

What would be the best way to go about this?

I have two ideas:

1. Easiest, but not automated and probably not 100% accurate as far as the ratio goes - Load the model in 3ds Max, approximate the zoom level, and take screenshots. Then, stitch together the screenshots.

2. via Irrlicht - set up a camera, make it think it's going to be on a very large screen resolution (since the image might be 3000x3000 pixels, go with that sort of resolution), and have it render the model from above. Then, save the camera's current rendering as an image file (how would I do this?).

Is there a better way? If #2 is the best option, can you give me some advice on which functions to look for?

Thanks in advance! :)
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Option number 2 should be perfectly doable

You could set up your camera to look directly down over the center of your map, increasing its distance from the map a certain offset every frame
After you've set the offset in a frame you could do a check whether the entire map geometry is inside the view frustum by doing a bounding box check

As soon as this condition is true you can render your output

You can use a render target texture to output to a high resolution
Josh1billion
Posts: 125
Joined: Thu Dec 11, 2008 9:50 pm
Location: Wisconsin
Contact:

Post by Josh1billion »

Thanks for the input. How would I save the texture to an image file?
www.JoshForde.com

Latest release: Super Orbulite World.
In development: Season of Dreams and others
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

You can use createImage() from the video driver class to create an IImage from your output texture, then you can use an IImageWriter to write your image to a file
Post Reply