Problems with performance

Well, lately I’ve been working with an object that has a lot of triangles (a city with 86,628 triangles), and need to find a way to improve fps, but not how. My idea is to delete the polygons that are not seen directly by the camera, or even delete the polygons that are within a certain distance. The city is composed of a single object, which has all that amount of triangles.



PD: sorry for my english!

I have a GeForce 430 and that is regarded as marginal for most games. The 410 is likely much less powerful - my weak 430 has 96 cuda cores, while the 410 has only 48. I think you will hit the performance limits of is card quite easily.



On the other hand, my ancient Radeon 3450 can handle millions of non-textured polygons… Are you using mipmaps?

Thanks to all …


@zarch said:
Nice looking city.

Did you create it in blender as one object? If so did you apply more than one material to that object? If so then the blender import has actually split the city into multiple geometries...


Respect to the materials, try removing all materials from the city and still retains the same amount of fps (36 approx.). And if I have blender different geometries generated by the use of seven types of materials (five are the textures of the buildings, a street and the other trails).

@nehon said:
mhhh I was going to say "Batching is the solution" but 57 objects is not that much....especially considering you are using PSSM.
Your card is quite recent so it should run no problem...
Really your scene looks clean to me, are you doing something special in the update loop?


Well, i don't have nothing in the update loop. I'll upload the code so they can see more clearly.

@ags1 said:
I have a GeForce 430 and that is regarded as marginal for most games. The 410 is likely much less powerful - my weak 430 has 96 cuda cores, while the 410 has only 48. I think you will hit the performance limits of is card quite easily.

On the other hand, my ancient Radeon 3450 can handle millions of non-textured polygons... Are you using mipmaps?


I have not used mipmaps :l.

The code:

[java]
package MOTOR3D;

import com.jme3.app.SimpleApplication;
import com.jme3.scene.Spatial;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
import com.jme3.shadow.PssmShadowRenderer;

public class Interfaz3D extends SimpleApplication{
private Spatial[] paraderos;

private static final float PI = 3.14159f;


@Override
public void simpleInitApp(){
inicializarEntornoGeneral();
}

private void inicializarEntornoGeneral(){
//propiedades de la cámara.
getFlyByCamera().setDragToRotate(true); //se debe hacer click para girar.
getFlyByCamera().setMoveSpeed(70);
cam.setLocation(new Vector3f(0, 150f, 0));
cam.setRotation(new Quaternion().fromAngles(0.7f, 10f, 0));

//carga del cielo.
Spatial skybox = assetManager.loadModel("Models/skybox/skybox_1.j3o");
rootNode.attachChild(skybox);

//se incorpora el mesh con la ciudad (calles, paraderos y edificios).
Spatial ciudad = assetManager.loadModel("Models/ciudad/ciudad.j3o");
ciudad.scale(100.0f);
ciudad.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(ciudad);

//se genera la luz del sol (direccionada).
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(5f, -15.0f, 5f)).normalize());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);

//se genera la luz ambiental (sin dirección).
AmbientLight ambient = new AmbientLight();
ambient.setColor(ColorRGBA.White);
rootNode.addLight(ambient);

//generación de la sombra PSSM (dinámica).
PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 1024, 4);
pssm.setDirection(new Vector3f(5f, -15.0f, 5f).normalizeLocal());
pssm.setFilterMode(PssmShadowRenderer.FilterMode.PCF8);
viewPort.addProcessor(pssm);
}

@Override
public void simpleUpdate(float tpf){
//bucle de actualización de la escena.
}
[/java]

does the frames per second change much if you look at the sky? (i.e away from your building)

@wezrule said:
does the frames per second change much if you look at the sky? (i.e away from your building)


Yes, increases to 500fps approx.

Well, i changed the properties of the shadow PSSM, and increased to 150fps approx. Then I show the changes:



[java]

PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 1024, 3);

pssm.setDirection(new Vector3f(5f, -20f, 5f).normalizeLocal());

pssm.setFilterMode(PssmShadowRenderer.FilterMode.Bilinear);

pssm.setCompareMode(PssmShadowRenderer.CompareMode.Hardware);

pssm.setLambda(0.4f);

pssm.setShadowIntensity(0.6f);

viewPort.addProcessor(pssm);

[/java]



The big problem was the filter PCF8, i really do not know if it’s the best way to generate the shadows on the graphics engine … if anyone knows a much more effective and realistic would be much better.



thanks to all

I thought you said that removing PSSM was almost not affecting frame rate?

you can try to use smaller texture (512) and use PCF4, you’ll get a better visual result / frame rate trade off than with 1024 and dither.

It’s a big texture, so I thought mipmaps might help - you don need the full texture for the distant buildings

What kind of graphics card do you have? That’s not really too many triangles for one scene and one object.



What material are you using?

Well i have a Nvidia Geforce 410m 512mb, which I have worked quite well.



Respect to the materials, I created these with Blender, which are composed of 512x512 jpg images and mapping by UVW. An image of the scene:







(if I take the shadows does not improve performance much).

Nice looking city.



Did you create it in blender as one object? If so did you apply more than one material to that object? If so then the blender import has actually split the city into multiple geometries…

mhhh I was going to say “Batching is the solution” but 57 objects is not that much…especially considering you are using PSSM.

Your card is quite recent so it should run no problem…

Really your scene looks clean to me, are you doing something special in the update loop?