Splitscreen technique used for overhead map: BUGS?

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
dracflamloc
Posts: 142
Joined: Sat Dec 11, 2004 8:13 am
Contact:

Splitscreen technique used for overhead map: BUGS?

Post by dracflamloc »

Heres the code I'm using:

Code: Select all

//draw main game
        scene->setActiveCamera(camera);
        scene->drawAll();

        if (showMap)
        {
            //draw overhead map cam - Activate mapcam and set the viewpoint. draw.
            scene->setActiveCamera(mapcamera);
            mapcamera->setPosition(vector3df(camera->getPosition().X,maxheight+spacer,camera->getPosition().Z));
            mapcamera->setTarget(camera->getPosition());
            driver->setViewPort(rect<s32>(10,10,driver->getScreenSize().Width/6,driver->getScreenSize().Height/6));
            scene->drawAll();
        }

        //draw gui
        driver->setViewPort(rect<s32>(0,0,game::driver->getScreenSize().Width,game::driver->getScreenSize().Height));
        gui->drawAll();

THis puts a minimap in the upper left. Two issues:
a) When theres something being drawn behind the map viewport, the map viewport will only show the sky (Pic 1 and 2)
b) The lighting and shading gets messed up while the map is on. (see pic 2 and 3)

Here are some screenshots of the issues:
Image
Note in the below, the minimap draws partially, but where there are buildings it only draws sky still.
Image
Note the above and below shading differences with and without the minimap
Image
dracflamloc
Posts: 142
Joined: Sat Dec 11, 2004 8:13 am
Contact:

Post by dracflamloc »

After removing the skybox, it now just draws the building thats int he way. Its like the viewport is a node in the scene thats a certain distance from the camera so only some things get drawn or something.

The lighting issue is still there. I cant for the life of me figure out how to fix that.
dracflamloc
Posts: 142
Joined: Sat Dec 11, 2004 8:13 am
Contact:

Post by dracflamloc »

Ok I think I solved the lighting problem by making the lights children of the FPS camera. But now the lights move around as the camera moves around.

Still trying to fix the other issue
dracflamloc
Posts: 142
Joined: Sat Dec 11, 2004 8:13 am
Contact:

Post by dracflamloc »

I think I got the lighting finally. If I created the cameras AFTER creating the lights, for some reason it would be tweaky like in the screenshots.

If I create the lights AFTER creating the cameras, there doesnt seem to be a problem.

So the lighting issue has been solved.



This minimap issue still exists
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

weird. Looks like the z-buffer isn't clearing between drawing your overlapping viewports. just guessing here but perhaps you need to start and end the scene separately each time you draw
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
dracflamloc
Posts: 142
Joined: Sat Dec 11, 2004 8:13 am
Contact:

Post by dracflamloc »

If I do that the previous screen is overwritten?

Interesting though, maybe I can manually clear the Z buffer?
dracflamloc
Posts: 142
Joined: Sat Dec 11, 2004 8:13 am
Contact:

Post by dracflamloc »

That was it dude you're awesome!

driver->clearZBuffer();
I put this before I started drawing the minimap and everything works!

Thanks!
MrPotatoes
Posts: 38
Joined: Mon Nov 07, 2005 5:55 am

Post by MrPotatoes »

i like your map. that's a cool looking map :)
dracflamloc
Posts: 142
Joined: Sat Dec 11, 2004 8:13 am
Contact:

Post by dracflamloc »

Its actually a randomly generated city =D

But as I'm sure you can tell I suck at art!
Post Reply