Patch flickering when manually setting the LOD

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
KungFuLu
Posts: 27
Joined: Sat May 15, 2010 9:41 pm

Patch flickering when manually setting the LOD

Post by KungFuLu »

Hi guys,

when I try to manually set the LOD of a patch with ITerrainSceneNode::SetLODOfPatch, then you can see the patch is flickering. For me it looks like that the terrain updates the LOD level of an patch after I set it and then I set it again and so on.
So is there a way to prevent this or to tell the terrain that a specific patch shouldn't be updated?

Thanks,
-Lu
KungFuLu
Posts: 27
Joined: Sat May 15, 2010 9:41 pm

Post by KungFuLu »

Sorry for the double post, but here's a minimal code and a video for the problem

Link to the video

The code:

Code: Select all

#include "irrlicht.h"

#pragma comment(lib,"irrlicht.lib")

using namespace irr;



int main()
{
    //create device,sgmr and driver
    IrrlichtDevice * device = createDevice(video::EDT_OPENGL);
    scene::ISceneManager * smgr = device->getSceneManager();
    video::IVideoDriver * driver = device->getVideoDriver();

    //create camera
    scene::ICameraSceneNode * camera = smgr->addCameraSceneNodeFPS(); 


    //create a heightmap
    video::IImage * heightmap = driver->createImage(video::ECF_R8G8B8,core::dimension2d<u32>(65,65));
    for(int x=0;x<65;++x)
        for(int y=0;y<65;++y)
            heightmap->setPixel(x,y,video::SColor(255,(sin(float(x+y))+1)*122+1,(sin(float(x+y))+1)*122+1,(sin(float(x+y))+1)*122+1),false);
    driver->writeImageToFile(heightmap,"heightmap.png",0);
    heightmap->drop();
    heightmap = 0;

    //create terrain
    scene::ITerrainSceneNode * terrain = smgr->addTerrainSceneNode("heightmap.png",0,-1,core::vector3df(0,-50,0),core::vector3df(),core::vector3df(10,0.1,10));
    terrain->setMaterialFlag(video::EMF_WIREFRAME,true);


    //set ambient light
    smgr->setAmbientLight(video::SColorf(1.0,1.0,1.0,1.0));

    //run
    while(device->run())
    {
        //set patch lod ==> flickering
        terrain->setLODOfPatch(0,0,3);

        //draw
        driver->beginScene();
        smgr->drawAll();
        driver->endScene();
    }


    return 0;
}
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Looks like a bug, I'll move it to the bug forum and investigate further.
KungFuLu
Posts: 27
Joined: Sat May 15, 2010 9:41 pm

Post by KungFuLu »

Thanks for moving this topic hybrid.

I took a short look in the source and for me it seems, that if the camera moved or rotated by a certain value (set with ITerrainSceneNode::setCameraMovementDelta or the equivalent for the rotation), the geo data gets updated.
So maybe there must be a flag which indicats if the LOD was manually set and then don't change the LOD state of this patch but clear the flag (I Don't know really how to explain it, so I hope that this was understandable :D).
Well I try if I can do this myself and if I'm successful, post it here.

-Lu
Post Reply