Hello everyone. First off, thank you to all those who have posted code. It has been very helpful.
Now to my problem. My game only renders at 2 frames per second. I have implemented a SimplePassGame that loads a 1025 x 1025 gray scale height map.
My system is Ubuntu (Intrepid) with a GeForce 6150SE nForce 430 graphics card with 512 MB memory. The driver is version 185 from from nVidia. The OpenGL/GLX Direct Rendering is set to 'Yes'.
The stats on my scene are: Frames/s: 2; Avg Tex binds: 26; Avg Objs: 45; Avg Tris: 16.8m.
I am able to play a game that renders at least 10 frames per second with a very large map; so I know my system is capable of doing more. I have set the farPlane for the frustum to be 2500.0f and scaled my map by 200 in the x and z directions. I have also scaled it in the y direction but that calculation was more complex. I have also locked the rootNode. It is also rendering reflections in the water (also locked down).
Anyway … I find it hard to believe that with the frustum farPlane set at 2500 that it is still trying to render 16.8m Tris. Doesn't the frustrum cull out triangles that are out of bounds? What does 'Tris' stand for? And what can I do to render this terrain at a higher frame rate?
Anyway ... I find it hard to believe that with the frustum farPlane set at 2500 that it is still trying to render 16.8m Tris. Doesn't the frustrum cull out triangles that are out of bounds?
No. Only objects are culled. Triangles are "clipped" by the video card.
What does 'Tris' stand for?
Triangles.
And what can I do to render this terrain at a higher frame rate?
Are you using TerrainPage to render your 1025x1025 map? Does the map have any texturing? If so, what method is it using? Splatting or the standard jme method?
It is also rendering reflections in the water (also locked down).
Does disabling/removing the water improve the fps?
I am using TerrainPage to render the 1025 x 1025 map. It is splatting five textures; four of which have alpha channels.
I must be doing something wrong when I disable the water because my triangle count drops to zero (and of course my fps goes to 210+). I will give you more info about the water when I figure it out.
GeForce 6150SE
This is a low-end card. Water is (quite) expansive, shader-instruction wise and it might have branches too which will kill performance. I once had a GeForce FX 5200, very similar in specs to yours, and guess what.. water ran at 1 fps. So, the problem isn't the terrain, it's the water.
Thank you everyone who responded. I will rewrite this without the water reflection and passes.
When I dump this height map into a scene without the water or spatting my frames per second go to 3. My triangles are 2.1m
The following is my code for creating the height map (taken from HelloTerrain.java):
// Create an image height map based on the gray scale of our image.
ImageBasedHeightMap ib=new ImageBasedHeightMap(
new ImageIcon(grayScale).getImage()
);
// Create a terrain block from the image's grey scale
TerrainBlock tb = new TerrainBlock("image icon",
ib.getSize(),
//new Vector3f(0.5f, 0.05f, 0.5f),
new Vector3f(2f, .2f, 2f),
ib.getHeightMap(),
new Vector3f(0, 0, 0)
);
How do I break up this height map into 16 smaller objects? Or ... which tutorial uses more than one height map?
TerrainPage automatically splits the heightmap into smaller portions. You should use it instead of TerrainBlock.
By implementing TerrainPage instead of TerrainBlock my fps went from 3 to 31+. Now that is more like it! Thank you Momoko_Fan.
chapman said:
By implementing TerrainPage instead of TerrainBlock my fps went from 3 to 31+. Now that is more like it! Thank you Momoko_Fan.
Great! Remember though, this is essentially the worst case scenario. Most people will have much better video cards than you ;) and will get fps in the ranges of 100-150. Adding LOD (level of detail) to the terrain might improve fps even more.