Close-to-camera LOD

HexiDave

02-03-2006 14:59:30

Is this done automatically with settings in the map's cfg file or by calling functions in the framelistener?

I've got OgreNewt integrated now and it gets the correct LOD for TreeCollision, but when I get close to some areas the LOD isn't going to LOD 0.

Sorry if this has been answered else-where - I searched but didn't get what I was looking for.

Thanks.

tuan kuranes

02-03-2006 15:08:21

bool maxlod = true;
setOption("MaxLodUnderCam", &maxlod);

HexiDave

02-03-2006 15:24:29

I'm still getting this:


Those are spheres rolling along LOD 0. In other areas it is perfectly fine.

Should that code be in the framelistener? Do any other settings affect that or its effectiveness?

tuan kuranes

02-03-2006 15:35:44

call it after setworldgeometry once and for all.

HexiDave

02-03-2006 16:30:56

Do I have to create a PagingLandscapeCamera somewhere and have it tag along with the main camera? I'm not getting any results from this yet :(

I appriciate the help.

Falagard

02-03-2006 16:52:41

When you create a camera from the paging landscape scene manager it is a PagingLandscapeCamera, no need to create another.

Not sure about your problem.

tuan kuranes

02-03-2006 16:58:29

maxlodundercam applies to tiles just under cam so if balls are on next tiles... Check wireframe view to check lod / tiles

HexiDave

02-03-2006 17:29:03

Here's from OgreNewt's debugger showing the collision lines:


You can see the object sinking as well as the ground being below the normal terrain. This is on 1 tile in the shot. The LOD 0 information for the TreeCollision was taken right from the Wiki article, so there shouldn't be any errors.

If you need code, let me know and I'll clean it up and pop it on the internet.

tuan kuranes

02-03-2006 17:39:05

please post Ogre wireframe shot, lines are hardly visible there (ogrenewt should use zbias on their line material...)

HexiDave

02-03-2006 17:46:27

Ok here you can see the terrain as it is in wireframe:


And here is with wireframe and OgreNewt treecollision lines - you can easily see the LOD difference:


Here's the terrain's CFG file:
GroupName=PLSM2
LandScapeFileName=Terrain_HF
FileSystem=../../../../Samples/Media/paginglandscape2/terrains/LandScapeFileName

Width=16
Height=16

ScaleX=5000
ScaleY=5000
ScaleZ=5000

Deformable=yes

VertexCompression=no
VertexProgramMorph=no

MaxPixelError=8

HorizonVisibilityComputing=yes

MaxRenderLevel=3

DistanceLOD=5

CameraThreshold=5

NumTextureFormatSupported=1

TextureFormatSupported0=Image


TextureFormat=Image
ImageFilename=Terrain_TX
VertexNormals=yes

BaseCameraViewpoint.x=10462.0f
BaseCameraViewpoint.y=6969.0f
BaseCameraViewpoint.z=-13254.0f

Baselookat.x=0.0f
Baselookat.y=0.0f
Baselookat.z=0.0f


I'm still trying to figure out what all the options do, but that's what I had during those shots.

tuan kuranes

03-03-2006 14:09:20

:oops:
I didn't updated setOption mechanisme when I added MaxLodUnderCam...
so until CVS fix goes into anon cvs, Add it to your config file instead.

HexiDave

03-03-2006 16:57:41

That wasn't working for me, but I did get it to work by adding this in the framelistener:

PagingLandScapeTile *tile = PagingLandScapePageManager::getSingleton().getTile(mCamera->getPosition().x,mCamera->getPosition().z,false);

if(tile != NULL)
tile->getRenderable()->setMaxLod(true);


PLSM2 is nice enough to set the other tiles to normal LOD after I'm done with em too! :D Thanks again for your help.

tuan kuranes

03-03-2006 17:29:49

That wasn't working for me
MaxLodUnderCam=yes in config file didn't work.
I'll add that to my check list.
Thanks for the report.

HexiDave

03-03-2006 18:19:18

It's possible my version wasn't up to date on CVS or something, been over a week since I updated.

Anyways, this gives me the nice option of finding the tile I'm on and a few surrounding ones and max them out too - this way objects a bit away from me don't appear to be sinking either.

zackron

20-03-2006 19:40:05

Here is another LOD question which I think might be along the same lines..

we are using 3 x 3 pages in PLSM2, for a total of 9 pages, each page with 4 tiles. at some point after the tiles have loaded and terrain is showing, the client will, as a result of data recieved from our server, load a series of objects at different locations on these pages.

When objects are loaded, a scene ray query is done to get the current terrain height and then the loaded object is placed at that height. The problem seems to be that height returned in that test is based on the LOD of the terrain in that location, thus as the camera approaches the location of the object, the LOD of the terrain may have changed causing the object to appear to be floating or under the terrain.

Thus, here are my questions...

1a) Will ogre (plsm2) automatically update the Y axis of objects to adjust them to the new height of the terrain, if the terrain LOD changes.

1b) if this is not something that happens by default, is there an option that can be toggled to make this happen

2) if the above is not an option, is it possible to do a terrain height test at the full LOD that the camera will use when it gets to the object, or at least to turn LOD on to full for everywhere while objects are being loaded, and then turn it back to normal?

Thanks.

HexiDave

20-03-2006 21:48:58

Pretty sure 1a & 1b aren't going to happen, but you should be able to find out WHICH tile you are hitting with the ray-scene query by taking the coordinates X,Z from the query and get the tile from that. Look into the different getTile() functions and find one that takes the X & Z values to return a PagingLandscapeTile* - it's slightly different than my code below, but you can use the

tile->getRenderable()->setMaxLod(true); to upgrade the LOD, then set it back to false and it should go back to normal.

If you have implementation problems, I can find the code that works as I've done this before.