Models

Hello, please save me :slight_smile:
I´m importing 3D model from Blender (file .blend) to jME SDK. In import dialog and in SceeneComposer I see model corect Corect model
But in game I see it bad Bad.

I´m new in JME… I think there is something wrong with lights, but I don´t know what…

I add this lights to the game:

       AmbientLight ambient = new AmbientLight();
        ambient.setColor(ColorRGBA.White);
        rootNode.addLight(ambient);

        DirectionalLight sun = new DirectionalLight();
        sunPos = new Vector3f(0.0f, -0.05f, 0.0f);
        sun.setDirection(sunPos);
        sun.setColor(ColorRGBA.White);
        rootNode.addLight(sun);

        FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
        Vector3f lightPos = sunPos.multLocal(-3000);

        DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(assetManager, 1024, 2);
        dlsf.setLight(sun);
        fpp.addFilter(dlsf);
        viewPort.addProcessor(fpp);

You made your sun light directly downwards, the sides of your model are not in the lit area…

Try to adjust sunPos to a more sideways looking vector

Thanks… From one side it´s good now. It´s look like the ambient light isn´t working for object imported from .blend…
Is there any solution?

I guess you’re looking at the back side of the model from the light direction.
What if you turn around it?
There must be something wrong with the ambient color of your building material.
If your building material has UseMaterialColors to true, make sure the diffuse and ambient color are not black.

Also in order to properly cast Shadows, you have to set a ShadowMode on each geometry (Cast, CastAndReceive, Receive). I recommend to set the terrina to receive only, and the rest to cast and receive.

Guys, I finaly got it!!

The right building is edited. The left one is not yet…

And this is the solution… You need do this for every material of the object and it works :slight_smile:

  Geometry geom = (Geometry) rootNode.getChild("Plane.0041");
   Material mat = geom.getMaterial();
   mat.setParam("Ambient", VarType.Vector4, new ColorRGBA(0, 0.002f, 0.024f, 1.0f));

So thank you guys :slight_smile: