tiles loading too late

morfiel

20-07-2007 17:10:48

Hi together,

first of all, thanks for the PLSM. Its one of the coolest pieces of software I recently had in my hands - even though the documentation needs a little work on. So I hereby promise to work on that as soon as I fully understood how everything is working.

But one question: since I switched to Ogre 1.4.3, the tiles in PLSM2 load by far too late. This means, I walk over an empty space and only after a while the tile is created. I use no shadows. Does anybody have an idea where this strange behaviour might come from?

thanks and best regards
Tim

Jon

20-07-2007 19:53:05

I've seen this, and every time I try to track it down the problem disappears on me.

Try increasing max adjacent pages by a small amount.

morfiel

22-07-2007 11:12:05

Hi Jon,

thanks for the answer, I was not aware of that parameter before. However, fiddling around with it showed no appearant effect whatsoever.

I hereby post my currently used config file, in cast somebody can see something wrong in there...

GroupName=PLSM

DefaultMap=Primeran

Nirvana=Nirvana
Primeran=Primeran

LandScapeFileName=Primeran
FileSystem=LandScapeFileName

Width=8
Height=8

Data2DFormat=HeightFieldRaw

ScaleX=4096
ScaleY=2048
ScaleZ=4096

TextureFormat=SplattingOtherland
TextureStretchFactor=1.0f
VertexNormals=no
VertexLit=no

NumMatHeightSplat=4
SplatFilename0=terraingcgrass01.png
SplatFilename1=greatforestrock01.png
SplatFilename2=greatforestrock01.png
SplatFilename3=greatforestrock01.png

################## PERFORMANCES OPTIONS.
### Visible renderables
# This is the number of visible renderables from the current camera position
# to the border of the visible terrain. (The radius of renderables)
VisibleRenderables=512

### WINDOWING AROUND CAMERA
# Num of adjacent loaded landscape pages.
MaxAdjacentPages=4

### Num of adjacent preloaded landscape pages.
# Must be bigger than MaxAdjacentPages + 1, the textures are loaded in a separate thread.
MaxPreloadedPages=12

### Camera Threshold
# If the last camera position minus current camera position is >= CameraTheshold
# then the scene is trasverse to check LOD.
CameraThreshold=1

### LOD : LEVEL OF DETAIL
# Distance LOD
# This is the number of renderables in the higher LOD.
#
DistanceLOD=25

### TILE SIZE
# size of a renderable tile
#
TileSize=129

### MAX RENDER LEVEL
# not quite shure what it does
#
MaxRenderLevel=5

MaxPixelError=12

HorizonVisibilityComputing=no


Have a nice sunday
Tim

Jon

22-07-2007 16:28:52

Now I'm confused. This appears to be a combination of the paginglandscape.cfg and the terrain-specific cfg file. Perhaps one could do that, but I don't think it would work since one file points to the other.

The plsm config file identifies which terrain will be used, the terrain-specific file has the run-time options for that map. The number of adjacent page option goes in the terrain-specific file.

Are all of the load queues empty when this drawing error occurs? We may as well make sure we aren't seeing the normal loading process, as opposed to paging wierdness.

morfiel

22-07-2007 18:17:08

I use only one config file because I have to switch maps in mid-game.

So I use
mSceneMgr->setWorldGeometry(getName() + ".cfg");
to swich the MapFile. The file I posted is the mixed config file (i.e. I guess its that per terrain config you refer to, only I also added a line that tells PLSM which terrain to use i.e. depending on the level to play ;-)

For the loading queues I'm not sure. How would I check? But my understanding is that its using the normal Ogre resource manager, which by now lives in its own thread. As all the other resources fetch quite well, I don't think its a problem with the resource loader. More likely something that PLSM does not trigger the loading.

Do you have any other ideas? By the way: thanks for your help so far.

Jon

23-07-2007 18:46:37

The PLSM demo application has an overlay which shows how many pages are loaded, on the load queue, on the preload queue (off the top of my head), so that shows how to determine the queue states. The only reason I ask is that there is the possibility that a particular page hasn't finished loading, and that is the reason why it wasn't displayed.

Rereading your original post (I did read it earlier, but I guess things didn't sink in), it sounds like this probably is the case. I would still take a look at the size of the queues to see if a ton of pages were being queued before the camera moved (and required new pages loaded).

Try lowering the VisibleRenderables to around 80, and see if that improves things.

I have seen the case where after everything was loaded the page where the camera was on would not be drawn. A while back I posted some screen-shots of that case. When I finally got too annoyed with this and started to hunt for it, the problem vanished mysteriously. It is like finding half a worm in an apple, you can't stop wondering where the other half is. For some reason I wondered if this was happening, but I guess not.

morfiel

28-07-2007 18:24:33

Hm, quite strange. I put an debug output in the FrameListener. Here is how the page loading looks like when no page at all is visible: plsm does not use anything and also does not seem overly concerned about it. Strange behaviour, right?

  1. >> TileFree 64
    >> MaxNumTiles 64
    >> UnloadedPages 64
    >> PreLoadedPages 0
    >> TextureLoadedPages 0
    >> LoadedPages 0
    >>
    >> RenderableFree 64
    >> MaxNumRenderables 64
    >> RenderableLoading 0
    >> VisibleRenderables 0[/list:u]

    When only one is visible it looks like:
    1. >> TileFree 48
      >> MaxNumTiles 64
      >> UnloadedPages 63
      >> PreLoadedPages 0
      >> TextureLoadedPages 0
      >> LoadedPages 1
      >>
      >> RenderableFree 48
      >> MaxNumRenderables 64
      >> RenderableLoading 0
      >> VisibleRenderables 0
      >>
      >> CurrentCameraPageX 4
      >> CurrentCameraPageZ 4
      >> CurrentCameraTileX 0
      >> CurrentCameraTileZ 0[/list:u]

      Appearanty the page loading works correctly, only plsm does not get the idea of triggering the loading of additional pages. Hm.

morfiel

29-07-2007 09:51:13

I think I partially tracked down the problem.

In the method:

bool PagingLandScapePageManager::frameEnded(const FrameEvent& evt)

there is a call to
processLoadQueues();
This is dependent on mOnFrame which is always (or almost always) null. To basically processLoadQueues(); is never called and obviously nothing is loading. If I remove the dependency, is works find. However, I do not fully get the meaning of mOnFrame (something about a frame having seen a camera?) so I wonder what problems are created by ignoring that...

So my new code looks like this:


bool PagingLandScapePageManager::frameEnded(const FrameEvent& evt)
{
if (!mEnabled)
return true;
// unload some pages if no more in use
processUnloadQueues();
// load some pages that are still queued
processLoadQueues();