Imaged Based Heightmap in Scene Composer

Hi,

I am trying to load an imaged based heightmap, which has a total size of 1024, into the scene composer. But whenever I try this, it gives me an
java.lang.OutOfMemoryError: Direct buffer memory exception.

So I searched the forum a bit and found out, that i have to increase the heap space, that is used by the SKD.
So I set the following parameters in the jmonkeyplatform.conf file: -J-Xms24m -J-Xmx1024m -J-XX:PermSize=256m -J-XX:MaxDirectMemorySize=2048m

But it somehow doesn’t work for me. I think 1024m are enough, because when i load the heightmap from my sourcecode, it all works fine, although I have set only 512m in my project properties.

So what am I doing wrong? I’ll be very gratefull if you can give me some tips.

The SDK uses a lot of memory as well, so you have to account for that. Here are my parameters:
default_options="–branding jmonkeyplatform -J-Xms512m -J-Xmx1024m -J-XX:PermSize=512m -J-XX:MaxDirectMemorySize=2048m"
Mine are set in the C:\Program Files\jmonkeyplatform\etc\jmonkeyplatform.conf file

I get the following message when I try your parameters:

Error: Could not create Java Virtual Machine
Error: A fatal exception has occurred. Program will exit.

This message shows up right after i clicked on the SDK and the SDK’s splashscreen shows up.

Now the bad news are i can’t get it running again, even if I try my parameters. There must be a mistake in the config file

This is how it looks like:
[java]

${HOME} will be replaced by user home directory according to platform

default_userdir="${HOME}/.${APPNAME}/3.0RC2"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/3.0RC2"

options used by the launcher by default, can be overridden by explicit

command line switches

default_options=”–branding jmonkeyplatform -J-Xms24m -J-Xmx1024m -J-XX:PermSize=256m -J-XX:MaxDirectMemorySize=2048m”

for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea

default location of JDK/JRE, can be overridden by using --jdkhome switch

#jdkhome="/path/to/jdk"

clusters’ paths separated by path.separator (semicolon on Windows, colon on Unices)

#extra_clusters=
[/java]

Oh, i found the mistake myself. A “-” was missing.

But anyways, even if I try to load the heightmap with your parameters, i will still get the same exception.

How much can i increase these values without any risks?

Increasing the IDE memory limits is going to depend on your system memory size at some point. For example, I have Eclipse set at 4096m, and system memory is at 8gb, which runs fine.

I would just increase the memory until it works or the IDE doesn’t, or try to use a smaller heightmap, load it in sections, etc.

Ok, I set it to 4096m and it still doesn’t work.
So you mentioned to load it in sections. Do you mean i load 2 maps with a size of 512 each? And if so how would i do this?

And I have a second question:
I managed to load the map with a size of 512. The scene composer created a myScene.j3o file which i loaded with the asset manager into my game. But wouldn’t the heightmap be just a big model then and all the advantages you have with a heightmap over a big model, as decribed in the HelloTerrain tutorial, are lost?

What advantages are there to a heightmap over a model?

You can load the terrain however you want. The scene composer and terrain editor in the SDK give you tools to position models where you want, and modify the terrain without having to use a heightmap.

Also note the difference between direct memory and normal java memory. A bit unintuitive, you are prone to get direct memory oom’s when you set the java heap too big in comparison.