12 TextureTerrainProblem

I get the following error when i use a terrain with

3 Alphamaps

12 Diffusemaps

5 Normalmaps

I guess this is has something to do with a artfical Texture limit the engine enforces? Since the Hardware should support far more textureunits actually.

What are my options?

java.lang.ArrayIndexOutOfBoundsException: 16

at com.jme3.renderer.lwjgl.LwjglRenderer.setTexture(LwjglRenderer.java:1832)

at com.jme3.material.MatParamTexture.apply(MatParamTexture.java:46)

at com.jme3.material.Material.render(Material.java:967)

at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:656)

at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:301)

at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:363)

at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:912)

at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:849)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1125)

at com.jme3.renderer.RenderManager.render(RenderManager.java:1162)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:264)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:218)

at java.lang.Thread.run(Unknown Source)

Thats a lot of textures… can’t imagine this being good for fillrate either.

The 16 texture limit is imposed because most OpenGL2 cards support that much.

Perhaps you can split your terrain into several parts so you dont have to use that many textures at once?

16 will be your max textures. The terrain editor enforces this but the material itself does not.

I suggest using terrain grid and limiting the number of textures per cell.

Actually no I have the exact same Framerate I have with 16 texture as I have with two (well 245 instead of 250 fps)

Also I’m pretty sure that all current AMD and nvidia Cards have somewhat around 50 texture units if not more.

Guess there we are again with texture atlases, I will see if I can combine one with the terrain shader as then I can have 12 textues and 12 normalmaps without any problem. (also one alphamap containing all 3 would be possible)

Hello everybody,

i’m totaly new to JME and i’m happy that i found it. When i Load the SDk my TerrainEditor only handle 4 Texture, how i’m able to load more ?


You need to check out the latest version from SVN. Alpha4 only supports 4 textures, the next version (which I believe will be Beta1) will support 12.