[HELP] Missing tiles in my terrain

Samir

13-11-2005 15:37:31

Hi,

I have already hinted to this problem I'm having and showed some screenshots in a previous post of mine here:

http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=157

I've been trying for a week now to solve this with no luck :(

Basically, some tiles are missing from my terrain when I build in the Release configuration. Here are two other screenshots of my problem.





The problem did not exist before I upgraded to the new PLSM2 (from CVS as opposed to the old one from that website which is used with the Ogre SDK).

Here is my ps_height_1k.cfg:


### WARNING
## read Data2dLoader.txt, Mapsplitterreadme.txt
## in ogreaddons paginglandscape root folder before anything here.
##
# resource group name
GroupName=PLSM2


##
##

################## HeightMap OPTIONS.


#
# Before using the paginglandscape2 plugins,
# you'll have to split your big heightmap file into pages.
# Use the Mapsplitter tool for that

# Base file name for the landscape heightfield data
# The file name MUST be LandScapeFileName.x.z.LandScapeExtension (ex: landscape.0.0.png)
# and MUST be squared.
LandScapeFileName=ps_height_1k
LandScapeExtension=png


# Height and Width of the landscape in number of pages
Width=4
Height=4

#
# Size of the Heightfiled in pixels (must be (power of 2) + 1)
PageSize=257
#
# Size of the Heightfiled in pixels
TileSize=65
#
## so if map is 2048x1024, with pagesize=257 and TileSize=64
# it gives 32 pages (8 pages width, 4 pages width), each 16 tiles so it's 512 tiles on the whole map.

#
# Especialized 2D data loader.
# Currently the only available loaders are 'HeightField', 'HeightFieldTC' and 'SplineField'.
#

# 8bits, grayscale images. (png, jpg, etc) or 16 bits (raw)
Data2DFormat=HeightField
# 32bits, RGBA images. (png, jpg, etc) RGB is normal information, in alpha we store heightmap
#Data2DFormat=HeightFieldN

#
# The HeightField TC is a compresed format and need to know the value range from where the
# heightfield file was compressed
MaxValue=3000
MinValue=0
# # 8bits, grayscale images. (png, jpg, etc) or 16 bits (raw)
#Data2DFormat=HeightFieldTC
# 32bits, RGBA images. (png, jpg, etc) RGB is normal information, in alpha we store heightmap
#Data2DFormat=HeightFieldNTC

#experimental spline terrain
#Data2DFormat=SplineField


#
# Scale values
# Beware that scaling is pagesize and heighmap definition range indepedant.
ScaleX=1800
ScaleY=900
ScaleZ=1800

# if Deformation is no use for you, you can gain fps by saying no here.
Deformable=no
# experimental VRAM saves. need instant base texture and vertex shader support
# "vertex displacment mapping"
VertexCompression=yes

# Use vertex program to morph LODs, if available
VertexProgramMorph=no
# The proportional distance range at which the LOD morph starts to take effect
# This is as a proportion of the distance between the current LODs effective range,
# and the effective range of the next lower LOD
LODMorphStart=0.2
# The maximum error allowed when determining which LOD to use
MaxPixelError=15

################## LIGHTING OPTIONS.
# For lighting
# For better looking deformed texture (instantbase)
# for shader (needed to get slope)
VertexNormals=no


############### TEXTURING OPTIONS
#
TextureExtension=png
#
#
#
# Especialized texture loader.
#
#(no pregenerated maps needed)
# Real-time (no pregenerated maps needed) splatting => splatting (needs DX9) and splatting5 (need shaders)
# Real-time (no pregenerated maps needed)Coloring => basetexture.
#
#(pregenerated maps needed)
# Deformable splatting => splatting5 (need shaders)
# Deformable Coloring => instantbasetexture.
#
#(pregenerated maps only)
# splatting => splatting2, (needs DX9) splatting3 (opengl)
# Coloring => basetexture2
# Image => Image (generated by any terrain texture generator terragen, T2, etc)
#
#
#
#DX = BaseTexture, BaseTexture2, InstantBaseTexture, Splatting, Splatting2, Splatting4, Splatting6, Splatting7
#GL = BaseTexture, BaseTexture2, InstantBaseTexture, Splatting3
#Both = BaseTexture, BaseTexture2, InstantBaseTexture, Splatting5
#



TextureFormat=Image
ImageFilename=ps_texture_1k
BigImage=no

## realtime splatting
#TextureFormat=BaseTexture
## (need to generate maps with mapsplitter)
#TextureFormat=InstantBaseTexture

# Shader Splatting
# Needs pixel shader
#TextureFormat=Splatting5

#need DIRECTX
#TextureFormat=Splatting

## precalc static splatting
## (need to generate maps with mapsplitter)
#TextureFormat=BaseTexture2

#need DIRECTX
#TextureFormat=Splatting2
# Need Multitexturing Hardware DIRECTX
#TextureFormat=Splatting7

### Experimentals splatting techniques
#need DIRECTX
#TextureFormat=Splatting4

### Experimentals splatting techniques
#need OPENGL
#TextureFormat=Splatting3
#need DIRECTX
#TextureFormat=Splatting4

#²²
# For splatting3 and perhaps a pass less in splatting2 and splatting4
VertexColors=no
# For splatting3
CoverageVertexColor=no
# Forsplatting4
BaseVertexColor=no
#
BaseVertexShadow=no
#
BaseVertexInstantColor=no
#
# Splatting
# We are allowing 4 textures to build the terrain texture
# MaterialHeight to change alpha weights ( using percentages )
# for Real-time textureformat and deformable (instantbasetexture, splatting5)
MaterialHeight1=12
MaterialHeight2=60


#needs to be in Search Path directory (resources.cfg)
SplatFilename0=splatting_snow.jpg
SplatFilename1=splatting_sand.jpg
SplatFilename2=splatting_grass.jpg
SplatFilename3=splatting_rock.jpg


################## 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=80
#
# LOD : LEVEL OF DETAIL
#
# Distance LOD
# This is the number of renderables in the higher LOD.
#
DistanceLOD=5
#
# if not set, it's precomputed to the max possible at this TileSize.
# Must be (2^MaxRendervel < TileSize)
MaxRenderLevel=3
#
#
# FPS Processing limit
# number of renderables loading in a single frame (if needed)
NumRenderablesLoading=50
#
# WINDOWING AROUND CAMERA
#
# Num of adjacent loaded landscape pages.
MaxAdjacentPages=3
#
# Num of adjacent preloaded landscape pages.
# Must be bigger than MaxAdjacentPages + 1, the textures are loaded in a separate thread.
MaxPreloadedPages=4
#
#
# Pages Load Factor
# Pages will be load/unload when they are about PageSize^2 * ChangeFactor
ChangeFactor=1.5
#
#
# Camera Threshold
# If the last camera position minus current camera position is >= CameraTheshold
# then the scene is trasverse to check LOD.
CameraThreshold=5
#
# Memory Pool Initial Usage Values (pre-allocated renderables and tiles.)
# use debug mode to check your needs.
MaxNumRenderables=200
IncrementRenderables=200
MaxNumTiles=200
IncrementTiles=200
# Horizon Visibility computing:
# enable it if your map have moutains, cliff... not if it's mainly plane.
# everything hidden will not be send to GPU saving framerates.
HorizonVisibilityComputing=yes


Again, this problem only occurs in Release builds, not in Debug builds.

Does anyone have any idea what this could be caused by?

tuan kuranes

14-11-2005 10:19:45

used exact same cfg file here and still cannot reproduce the bug.
is this Demo_paginglandcscape2 ?
what video card ?
how many FPS do you get ?

Samir

14-11-2005 13:26:35


used exact same cfg file here and still cannot reproduce the bug.
is this Demo_paginglandcscape2 ?

Tried it in Demo_paginglandcscape2 and the same thing happens. Actually, the parts of the terrain that don't show up depend on the compilation. Each compilation I get a different result. Most of the time, in the Release configuration, no terrain shows up at all. This happened when I tried it in the demo.


what video card ?

MSI MS-StarForce GeForce4 Ti 4200 with AGP8X (NVIDIA GeForce4 Ti 4200 with AGP8X) with 128MB of memory.


how many FPS do you get ?

When I tried in the demo, no terrain showed up so I had:


14:55:38: Render Target 'OGRE Render Window' Average FPS: 713.826 Best FPS: 723.277 Worst FPS: 479.52

In my app I have some parts of the terrain showing and I got:


15:00:24: Render Target 'Pentagenesis: The Future is immortal' Average FPS: 409.555 Best FPS: 576.846 Worst FPS: 344.655


I'm using VC++ 2005 Express, could this have anything to do with that?...Maybe some optimisations are doing this?...But still, the problem also happens in Debug builds, but less frequently.

I have a fealing this has to do with not being able to load the texutres. Cause the parts of the terrain that don't show up appear to be one whole texture that the MapSplitter outputted. Could this have anything to do with the DevIL library then?...Cause when I downloaded Ogre Dagon and PLSM2 from CVS, I also had to download and compile all the dependencies. I'm pretty sure that this has nothing to do with the resources (i.e. the maps) cause this problem did not exists before I upgraded and I used the same maps. Having said that, different outputs of the MapSplitter produce different parts of the terrain not showing up. Also, before I upgraded, I was using VC++ Toolkit 2003 with Code::Blocks and Ogre 1.0.4.

MrCarbohydrate

15-11-2005 00:24:16

I'm getting a similar problem in my game, some pages never show up in Release mode (haven't tried with the demos yet). I'm using CVS HEAD, DirectX9 renderer, Radeon9800 Pro. Actually when I start my game in Release, I can't see any terrain. When I move around I can see some other pages, and when I get back to the starting point some pages that weren't there before show up correctly... very weird. When the problem happens, the triangle count is very low and nothing shows up in wireframe, so I don't think it's a texture loading problem (moreover, Ogre.log mentions the textures being loaded properly).

Here's my log of what my page events delegate gets when starting my game (before I start moving the camera), first in Debug then Release (my terrain has 4x4 pages) :
Debug Mode
[INFO] 01:03:47 > Page 2-1 loaded
[INFO] 01:03:47 > Page 2-1 shown
[INFO] 01:03:47 > Page 2-2 loaded
[INFO] 01:03:48 > Page 2-2 shown
[INFO] 01:03:48 > Page 1-1 loaded
[INFO] 01:03:48 > Page 1-1 shown
[INFO] 01:03:48 > Page 1-2 loaded
[INFO] 01:03:48 > Page 1-2 shown
[INFO] 01:03:49 > Page 3-1 loaded
[INFO] 01:03:49 > Page 3-1 shown
[INFO] 01:03:49 > Page 3-2 loaded
[INFO] 01:03:49 > Page 3-2 shown
[INFO] 01:03:49 > Page 2-0 loaded
[INFO] 01:03:49 > Page 2-0 shown
[INFO] 01:03:50 > Page 1-0 loaded
[INFO] 01:03:50 > Page 2-3 loaded
[INFO] 01:03:50 > Page 2-3 shown
[INFO] 01:03:50 > Page 1-3 loaded
[INFO] 01:03:50 > Page 1-3 shown
[INFO] 01:03:50 > Page 0-1 loaded
[INFO] 01:03:51 > Page 3-0 loaded
[INFO] 01:03:51 > Page 3-0 shown
[INFO] 01:03:51 > Page 0-2 loaded
[INFO] 01:03:51 > Page 3-3 loaded
[INFO] 01:03:51 > Page 3-3 shown
[INFO] 01:03:51 > Page 0-0 loaded
[INFO] 01:03:52 > Page 0-3 loaded


Release Mode
[INFO] 01:02:47 > Page 2-1 loaded
[INFO] 01:02:48 > Page 2-2 loaded
[INFO] 01:02:48 > Page 1-1 loaded
[INFO] 01:02:48 > Page 1-2 loaded
[INFO] 01:02:48 > Page 3-1 loaded
[INFO] 01:02:48 > Page 3-2 loaded
[INFO] 01:02:49 > Page 2-0 loaded
[INFO] 01:02:49 > Page 1-0 loaded
[INFO] 01:02:49 > Page 1-0 hidden
[INFO] 01:02:49 > Page 2-3 loaded
[INFO] 01:02:49 > Page 1-3 loaded
[INFO] 01:02:49 > Page 0-1 loaded
[INFO] 01:02:49 > Page 0-1 hidden
[INFO] 01:02:49 > Page 3-0 loaded
[INFO] 01:02:49 > Page 0-2 loaded
[INFO] 01:02:49 > Page 0-2 hidden
[INFO] 01:02:49 > Page 3-3 loaded
[INFO] 01:02:50 > Page 0-0 loaded
[INFO] 01:02:50 > Page 0-0 hidden
[INFO] 01:02:50 > Page 0-3 loaded
[INFO] 01:02:50 > Page 0-3 hidden


As you can see I never get a 'shown' event in Release, so I guess the problem is related to pages culling. I'm going to check tomorrow if I can reproduce it with the demos.

tuan kuranes

15-11-2005 08:21:40

are you using visual 2005 too ?
If so, What Floating Point Model in Release mode ?

MrCarbohydrate

15-11-2005 11:27:53

VC++ 7.1 for me...

Samir

15-11-2005 15:33:13

When I first compiled PLSM2, it was /fp:precise, then to make things faster, I recompiled with /fp:fast. Now that you asked, I recompiled with /fp:strict. All three produce the same missing tiles.

tuan kuranes

16-11-2005 15:02:35

Still cannot reproduce the bug related to release.

I managed to reproduce it changing shadow type (hitting 'C' key),
maybe it's related.

strange bug.

A bit OT , but does the .gen.cfg also say PageSize = 256 ?
is this cfg comes from SDK, CVS or datasrc ?

512 is far better, I tought that I had this changed in all cfg files.

Samir

16-11-2005 17:45:30


but does the .gen.cfg also say PageSize = 256 ?
is this cfg comes from SDK, CVS or datasrc ?

512 is far better, I tought that I had this changed in all cfg files.


I tried the config from the datasrc in CVS and the datasrc that I dowloaded from your website. All cfg files in CVS have PageSize = 513, but the one from your website has PageSize = 257. All of them have the same bug.


Still cannot reproduce the bug related to release.

I managed to reproduce it changing shadow type (hitting 'C' key),
maybe it's related.

strange bug.


I have a suggestion, maybe a little radical, but its the only way I can think of. I have some webspace I'm not using, do you think I could upload you my media directory?...No need for source code cause the bug happens in anything that uses PLSM2, so you can use the demo. Just in case that still did not reproduce the bug, maybe you should try it with VC++ 2005 Express.

If you agree on this, please let me know of a way to give you the link other then on this forum, I really don't want to make the link public.

tuan kuranes

16-11-2005 18:02:34

So the 257 is from datasrc.zip on the website. I'll change that. thanks.

I'm trying now Express, but all libraries didn't end compiling.

I used the cfg file you posted, so I should have got same medias and cfg files. But you can mail me the media's link to test this.

Samir

16-11-2005 18:35:13


I'm trying now Express, but all libraries didn't end compiling.


I had trouble compiling some of them myself. But I managed to get through all of them. Tell me if you need any help with any of them.


I used the cfg file you posted, so I should have got same medias and cfg files.

Well, I don't know...maybe this has something to do with the texture files or something.


But you can mail me the media's link to test this.


Will do. But my upload speed is slow, so it will be an hour before the files are uploaded, I'll send you the e-mail when they are up and ready.

tuan kuranes

22-11-2005 10:46:03

found the bug. Should be in anon CVS tomorrow.

Samir

22-11-2005 17:01:56

WOW!...Really?!...I'm so happy :D...this has been annoying me for quite some time. I'll make sure to try it out tomorrow.

Thank you very much for your hard work, I'm sure it was not that easy finding the bug without being able to reproduce it.

MrCarbohydrate

22-11-2005 22:15:53

Yes thanks a lot Tuan, I just updated from CVS and now it works perfectly! :D

Samir

23-11-2005 18:39:22

Yey!...It worked for me too, it worked for me too!... :)

Jules Robichaud Gagnon

30-07-2008 03:01:54

I am having a very similar bug with our terrain when I enable the flag HorizonVisibilityComputing. I enabled the display of the bounding boxes of the tile's renderables. The horizon visibility would help quite a lot but I still don't get what I do wrong. I tried all the parameters of the cfg file. Any idea where I should look ?