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
Patch flickering when manually setting the LOD
Sorry for the double post, but here's a minimal code and a video for the problem
Link to the video
The code:
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;
}
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 ).
Well I try if I can do this myself and if I'm successful, post it here.
-Lu
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 ).
Well I try if I can do this myself and if I'm successful, post it here.
-Lu