FPS Camera issue

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
ManlyStump
Posts: 6
Joined: Mon Mar 02, 2015 3:31 pm

FPS Camera issue

Post by ManlyStump »

I've just created a new project using the Hello World tutorial (http://irrlicht.sourceforge.net/docu/example001.html), but instead of loading the md2 file, I've used my own obj exported from Blender. For whatever reason, the UV's seem to be utterly messed up though. Any idea why this would be? Code and screenshot below (grey inset on screenshot shows how it appears in Blender).

Code: Select all

IrrlichtDevice* device = createDevice(video::EDT_SOFTWARE, dimension2d<u32>(800, 600), 16, false, false, true);
     if (!device) return -1;
 
    device->setWindowCaption(L"New Irrlicht Project!");
    IVideoDriver* driver = device->getVideoDriver();
    ISceneManager* scenemgr = device->getSceneManager();
    IGUIEnvironment* guienv = device->getGUIEnvironment();
 
    IMesh* mesh = scenemgr->getMesh("media/grassblock.obj");
    if (!mesh) return -1;
    IMeshSceneNode* node = scenemgr->addMeshSceneNode(mesh);
    if (!node) return -1;
    node->setMaterialFlag(EMF_LIGHTING, false);
    node->setMaterialTexture(0, driver->getTexture("media/grass01.bmp"));
 
    SKeyMap keymap[4];
    keymap[0].Action = EKA_MOVE_FORWARD;
    keymap[0].KeyCode = KEY_KEY_W;
    keymap[1].Action = EKA_STRAFE_LEFT;
    keymap[1].KeyCode = KEY_KEY_A;
    keymap[2].Action = EKA_MOVE_BACKWARD;
    keymap[2].KeyCode = KEY_KEY_S;
    keymap[3].Action = EKA_STRAFE_RIGHT;
    keymap[3].KeyCode = KEY_KEY_D;
    ICameraSceneNode* cam = scenemgr->addCameraSceneNodeFPS(0, 50.0f, 0.01f, -1, keymap, 4, false);
    cam->setNearValue(0.01f);
 
    while (device->run())
    {
        driver->beginScene(true, true, SColor(255, 100, 110, 170));
        scenemgr->drawAll();
        guienv->drawAll();
        driver->endScene();
    }
    device->drop();
Image
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: FPS Camera issue

Post by mongoose7 »

The main problem appears to be that your cube is deformed. Examine the process by which you constructed the cube in Blender, because any Blender tricks you used would not be exported in the OBJ.
ManlyStump
Posts: 6
Joined: Mon Mar 02, 2015 3:31 pm

Re: FPS Camera issue

Post by ManlyStump »

Thanks mongoose7, but that was literally just the standard cube Blender starts with, UV unwrapped and exported. In fact, I managed to get it rendering just fine in Irrlicht by changing EMT_SOFTWARE to EMT_OPENGL. I can only assume there's some issue with the software renderer handling OBJ files, or maybe particular OBJ file formats?
Foaly
Posts: 142
Joined: Tue Apr 15, 2014 8:45 am
Location: Germany

Re: FPS Camera issue

Post by Foaly »

The software driver (EDT_SOFTWARE) does not support 3D rendering:
It should only be used for 2d graphics, but it can also perform some primitive 3d functions. These 3d drawing functions are quite fast, but very inaccurate [...].
(http://irrlicht.sourceforge.net/docu/na ... 1b559e8995)

You usually want to use a hardware accelerated driver like EDT_DIRECT3D9 or EDT_OPENGL.
Irrlicht also has a second software driver, which is meant for 3D rendering: EDT_BURNINGSVIDEO
ManlyStump
Posts: 6
Joined: Mon Mar 02, 2015 3:31 pm

Re: FPS Camera issue

Post by ManlyStump »

Ah ok, thanks for that information.
Post Reply