Frustum culling question

hello

using the simplest tutorial code, i create a simple scene by adding 300 box objects with lighting material (norm/diffuse/specular) as a test bench

as i get away from the scene with the camera, so i can see all objects, i get around 30 frames per seconds
if i look away (no objects in frustum), i get around 60 fps

but if i look a t the scene, and dive in, the more i get closer to the center of the scene (the more objects get culled away)
the less i get fps (around 15)

seems like the frustum culling algorithm is doing the opposite of what would be expected (unless there are no object seen)

how can that be ?
how is it that i get lower fps looking at a part of the scene, and higher fps if i see the whole scene ?

thx

@curtisnewton said: but if i look a t the scene, and dive in, the more i get closer to the center of the scene (the more objects get culled away) the less i get fps (around 15)
There are tons of things that could make your scene slower no matter how culling occur. give us some screen shots maybe we'll be able to answer. my guess is that objects you're looking at are probably bigger on screen as you dive into the scene. So more pixels are shaded, so it's slower.
<cite>@nehon said:</cite> There are tons of things that could make your scene slower no matter how culling occur. give us some screen shots maybe we'll be able to answer. my guess is that objects you're looking at are probably bigger on screen as you dive into the scene. So more pixels are shaded, so it's slower.

good point
i havent’ thought of that

thx

is there still an imposter node implemented in jme3 ?
i cant find any tutorial on LOD/impostor/converting mesh to LOD/impostors

@curtisnewton said: is there still an imposter node implemented in jme3 ?
Impostors are geometries. I don't know what an impostor node would do.
@curtisnewton said: i cant find any tutorial on LOD/impostor/converting mesh to LOD/impostors
Those are different notion and I'm not surprised you don't find a tutorial/doc that covers both. Lod can be generated through the ogre pipeline. I recently added a LodGenerator that allows you to generate lods inside JME, but it only available in last svn. Impostors are up to you, you have to make a quad geometry apply a texture on it and then you can use a BillboardControl that will make your quad face the screen.

Note that if I’m right about the “more pixels are shaded” none of those techniques will solve your issue.

What does your model looks like? what material do you use? is that on desktop or on android?

<cite>@nehon said:</cite>

Note that if I’m right about the “more pixels are shaded” none of those techniques will solve your issue.

What does your model looks like? what material do you use? is that on desktop or on android?

hi,

so i would have to render an object on a texture and use it as a billboard
i thought there were maybe some helper that does that

the plan is to render a lot of cube objects and put grass on those
so i will use detailed grass meshes around the camera position, and impostors/billboards far ahead

but i wanted to have a test bench for many objects in the scene

i noticed (in my current game project) that if i created one big mesh for the ground, it was faster than multiple square meshes to do the same job

so here is the code (desktop)
i just created a new project, added a few lines of code

  • first i look at the entire scene(every objects)
  • then i go forward with the cam until one of the cube is out of sight -> i notice a lost of 10fps
  • the more i go forward, the more i loose fps

maybe you’re right it is maybe becos they are getting bigger on the screen
but here, i assigned a simple blue material to box geometries

[java]
package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.light.AmbientLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

/**

  • test

  • @author normenhansen
    */
    public class Main extends SimpleApplication {

    public static void main(String args) {
    Main app = new Main();
    app.start();
    }

    @Override
    public void simpleInitApp() {
    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White);
    rootNode.addLight(al);

     for(int i=0;i&lt;300;i++)
     {
         Box b = new Box(0.2f, 0.2f, 0.2f);
         Geometry geom = new Geometry("Box", b);
    
         Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setColor("Color", ColorRGBA.Blue);
         geom.setMaterial(mat);
         geom.setLocalTranslation((float)(Math.random()*10), (float)(Math.random()*10), (float)(Math.random()*10));
         rootNode.attachChild(geom);
     }
    

    }

    @Override
    public void simpleUpdate(float tpf) {
    //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
    //TODO: add render code
    }
    }
    [/java]