Quick question about TerrainGridTileLoader

Hello community,



I have a really simple question about TerrainGridTileLoader. I have seen TerrainGridTileLoaderTest on the SVN and I have noticed that it references AssetTileLoader. The test loads terrain tiles from *.j3o files, but I was wondering, whether it would be possible to load the tiles from *.obj files as well?



I mean, let’s say my designer has prepared the terrain for me in some random modelling software and exported it to *.obj. After splitting one huge *.obj into several smaller tiles (of the same size, for instance 65x65), will I need anything else to be able to use those files with AssetTileLoader (excluding converting them into *.j3o)?



Thank you,

Patryk.

.obj cannot store jme specific data so it would be more complicated as you have to clean up the model data after loading. You can select multiple .obj files and convert them to j3o as well in the SDK if thats the issue.

I wasn’t clear, so let me just rephrase the question. :slight_smile:


  1. Let’s say my artist created a terrain.
  2. He gave me the terrain as a bunch of *.obj files.
  3. I manually converted those files to *.j3o in the SDK.



    Question is: can I use such *.j3o files with AssetTileLoader now?

Oh. Yeah, if they are named correctly it could work. I don’t exactly know if the TerrainGrid doesn’t depend on the actual Terrain geometry. If yes you’d have to basically reimplement the same system for your tiles. Afaik the TerrainGrid interface isn’t supposed to be used in the future though @Sploreg?

Afaik the TerrainGrid interface isn’t supposed to be used in the future though

Hmm, then what else would you suggest for handling terrain loaded from several meshes, not a single heightmap texture?

A control that attaches them to a node based on cam position?

What about collisions then? With TerrainGrid, we can use:

[java]quad.addControl(new RigidBodyControl(new HeightfieldCollisionShape(quad.getHeightMap(), terrain.getLocalScale()), 0));[/java]

and the camera is neatly aligned to the terrain.



How would you reproduce such behavior using your approach (which looks to me like a good one, notabene)?

If you don’t use heightmap-based terrain you cannot use heightmap collision shapes… You’d have to use mesh collision shapes. This all really is just an application of the core classes, there is no “special” things to follow, its all normal monkeying :slight_smile:

1 Like

Thanks for your patience normen, I’m just a bit overwhelmed and trying to figure out where to start with my project. :slight_smile:



Ok, I’ll investigate matters on my own right now. Thanks a lot once again!

TerrainGrid and the TerrainGridTileLoader are very tied to TerrainQuad objects, and in that respect, heightmaps. TerrainGrid is a subclass of TerrainQuad.

TerrainGrid strictly ties you to what it wants, and therefore is not ideal. It won’t be removed any time soon, not until it has a replacement that handles paging in other scene objects as well, in an easy way.

1 Like