[help] Problem with size of .raw heightmap

hippokrates

04-04-2006 01:09:18

When I try to use the mapsplitter application on my heightmap it always says: "RAW size (2101264) does not agree with configuration settings.. "
I generated the heightmap with my own programme and saved it using DevIL. Here is the saving code:


ilGenImages(1, &image);
ilBindImage(image);
ilTexImage(terrainSize, terrainSize, 1, 2, IL_RGB, IL_UNSIGNED_BYTE, data);
ilEnable(IL_FILE_OVERWRITE);
ilSaveImage((ILstring)filename.c_str());
ilDeleteImages(1, &image);


With filename being "Island.raw" and data being an array of unsigned shorts.

This is my config-file:

GroupName=IslandSim

LandScapeFileName=Island
LandScapeExtension=raw
RawWidth=1025
RawHeight=1025

TextureStretchFactor=1.0

OutDirectory=./LandScapeFileName

HeightMap=yes


Why do I get this error?

hippokrates

04-04-2006 02:18:24

After doing some research I discovered that DevIL is actually appending a header to each .raw file. Therefore the filesize is just slightly bigger than PLSM2 expects it to be.
Well, I tried to remove the header manually (ugly ^^;) and the mapsplitter accepts my heightmap now.
Yet, it still does not work. After splitting my textures (I added "ColorMapSplit=yes" etc to my config-file) the application crashes with an access violation... what did I do wrong this time? ^^;

tuan kuranes

04-04-2006 08:37:45

Headers in raw ? That's weird... it's no more "raw" then !

Can you try without colormaplit and see if it crashes ?

hippokrates

04-04-2006 17:12:44

Yes, adding a header to a .raw file is somewhat weird but I did not find a way to stop DevIL from doing so ;)
Running the mapsplitter without the ColorMapSplit option set did, indeed, prevent it from crashing. But how do I get my textures split now?

hippokrates

04-04-2006 20:31:47

Well, since I can either have my textures split - with the mapsplitter crashing - or have my heightmap split - getting no textures - I am somewhat troubled.
Yet, for the moment I just ran mapsplitter twice, so I would end up having both, the heightmap and the textures ^^;

But if I try to display my terrain with PLSM2 the application crashes, complaining about some templateMaterial that is null.

Here is my config-file:

GroupName=IslandSim

LandScapeFileName=Island
FileSystem=./LandScapeFileName

Width=2
Height=2

Data2DFormat=HeightField

ScaleX=1000
ScaleY=1000
ScaleZ=1000

NumTextureFormatSupported=1

TextureFormatSupported0=Image

TextureFormat=Image
ImageFilename=Island_00

# where to put camera on load.
BaseCameraViewpoint.x=-396.0f
BaseCameraViewpoint.y=31000.0f
BaseCameraViewpoint.z=2640.0f

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

tuan kuranes

05-04-2006 11:55:47

How recent is the mapsplitter you're using ?
"null" Error message said it doesn't find the texture "Island_00" in resource group and path (beware that it compose the name.)

hippokrates

05-04-2006 16:56:12

I downloaded the mapsplitter about a month ago, so it is, maybe, not the newest version. But since I am using it with Ogre 1.0, which I downloaded at the same time, it should be ok, shouldn't it?

And the image "Island_00" is definitely there. There is no reason why it should not find it...
Is there any way, to display the terrain without a texture map?

hippokrates

06-04-2006 00:05:32

Since I wasn't getting anywhere, I uninstalled the OgreSDK, deleted PLSM. After that I switched from prebuilt SDK to CVS, downloaded the newest versions of Ogre (Dagon) and OgreAddons. It cost me some time but in the end I got everything compiled. Even the mapsplitter is working now.
Yet I still cannot display my terrain. This time the assert of "mOption" fails...

PLSM2.cfg:

GroupName=IslandSim
DefaultMap=Island
Island=Island
TextureFormatDebug=no


Island.cfg

GroupName=IslandSim

LandScapeFileName=Island
FileSystem=./LandScapeFileName

Width=2
Height=2

Data2DFormat=HeightField

ScaleX=1000
ScaleY=1000
ScaleZ=1000

NumTextureFormatSupported=1

TextureFormatSupported0=Image

TextureFormat=Image
ImageFilename=Island_00

# where to put camera on load.
BaseCameraViewpoint.x=-396.0f
BaseCameraViewpoint.y=31000.0f
BaseCameraViewpoint.z=2640.0f

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

tuan kuranes

06-04-2006 08:21:47

This time the assert of "mOption" fails...
what is exaclty the assert and where it happens ?

hippokrates

06-04-2006 16:30:37

The assert is really just: "Expression: mOptions".
It occurs in OgrePagingLandScapeSceneManager.cpp in line 1444.

tuan kuranes

06-04-2006 16:48:14

you need to call setWorldGeometry before creating a camera.

hippokrates

06-04-2006 17:32:31

Since I am using the example application I did not create a camera at all... but moving setWorldGeometry to chooseSceneManager fixed the problem.

But now I am back to my old problem: I get an assert on "!templateMaterial.isNull()" from OgrePagingLandScapeTexture_Image.cpp in line 86.

tuan kuranes

06-04-2006 17:42:56

Do you have a PagingLandScape.Template material in PagingLandscapeTemplate.material file ?

hippokrates

06-04-2006 18:09:57

Ahh, I didn't know, I needed to have such a file. Copying it to the respective directory solved my problems.
Thanks :)

But somehow the texturing is not what I expected. It seems as if the texture was applied totally wrong ^^;

tuan kuranes

07-04-2006 07:47:05

What do you mean ?

hippokrates

07-04-2006 12:47:05

Ah, I found the error. Unlike FreeImage, DevIL saves .raw files upside down. Therefore my texture was, compared to the heightmap, the wrong way round. Flipping the texture solved this ^^

tuan kuranes

07-04-2006 13:21:15

Glad you made it !
And many thanks for sharing it there for further readers.

hippokrates

07-04-2006 17:00:17

No, I have to thank you for having so much patience with me ;-)