Ground Face is invisible in some terrains

So, this problem happens sometimes with some mesh terrains(Ground up-Face culling) , i think it’s a camera frustum problem as i have solved it before by translating the camera frustum plane upward(but image get interrupted when i use the cam in another calculation like ScreenFilters) , but i think there’s an optimum standard fix for this ? , also if there’s examples from jme repos on using different camera features , please share !

thanks

Problem :

real mesh(town.zip):

code(demoApp) :

floorGeometry.getMaterial().getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
1 Like

It gives me ClassCastException when trying to cast to Geometry like this Spatial :: jMonkeyEngine Docs

Spatial floorGeometry = assetManager.loadModel("RocketLeauge/assets/Scenes/town/main.scene");
        DirectionalLight directionalLight=new DirectionalLight(new Vector3f(-3,-floorGeometry.getLocalScale().getY()*4,-3).normalize());
        directionalLight.setColor(ColorRGBA.White.mult(2f));
        floorGeometry.addLight(a);
        rootNode.addLight(directionalLight);
        ((Geometry)floorGeometry).getMaterial().getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);

what’s wrong ?

Not all spatials are geometries. Some are nodes. Iterate over all geometries in the model.

1 Like

the childs of the Spatial or Node retrieved in the form of other nodes of Spatial , how to get Geometry instance from a Spatial or Node.

Hmm , the materials are done here programmatically :

but that’s not the case , the town.zip is done in an editor & i am just trying to load the material of it , but i cannot because i cannot cast a Node to a Geometry when they already have the same origin(Spatial)…?