No Lighting after Scale

Hello,



i just can’t figure out a problem with lighting. I import model data from IFC export format used by CAD-Systems.

This works pretty good, but as the model data uses 1mm as unit and as i want 1 jme unit to be 1m, i scale the topmost node by 0.001f.

Scaling also works fine, model has the right size afterwards.

[java]scene_root.scale(0.001f);[/java]

and

[java]scene_root.setLocalScale(0.001f);[/java]

work both.



The big problem with this is, that after scaling, no lighting works anymore. I have a DirectionalLight and AmbientLight attached to scene as well as a moving PointLight.

Without Scaling light shading works, it really seems to have to do with scaling.



Here my material definition:

[java]

Material material = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

material.setFloat(“Shininess”, 12);

material.setBoolean(“UseMaterialColors”, true);

material.setColor(“Ambient”, ColorRGBA.Black);

material.setColor(“Diffuse”, ColorRGBA.Gray);

material.setColor(“Specular”, ColorRGBA.White);

[/java]



Is this a bug or am I doing something wrong? Any hints for me?



Here the screenshot, Background ist set to white to see that the model parts are all rendered black.

Perhaps the model is too big and the lights aren’t sufficient. Try to change the lights’ direction and radius, test with a point light too.

glaucomardano said:
Perhaps the model is too big and the lights aren't sufficient. Try to change the lights' direction and radius, test with a point light too.


DirectionalLight has no size and should apply to whole model, isn't it? Also at least AmbientLight should apply to all objects i think.
But i also have a PointLight circling around one corner column. Tried setting its Radius to higher values, but that did not help either.
As soon as i scale the topmost Node the whole model remains with no lighting at all.

It looks that model can’t update its light list. Make sure your sdk is up to date. Did you convert that model to j3o?

I am usigng jme3 from svn, so most current version.



I import the model by creating custom meshes for the objects, vertex coordinates, index data and normals.

[java]

Mesh mesh = new Mesh();



mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices_jme));

mesh.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals_jme));

mesh.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indices));



mesh.updateCounts();

mesh.updateBound();



Geometry geometry = new Geometry(name, mesh);

[/java]



Export to j3o is planned, but these are my first steps with jme3 and i am just experimenting now with some models.

So the whole geometry is generated at runtime, at least by now.



Have to say that the same import procedure has worked fine in jme2, what i am trying here is a port to jme3.

Lights worked with no problem in jme2, with or without scaling (basically the same code). I expected it to work pretty much the same in jme3, the switch from TriMesh to Mesh seemed straitforward to me.



What can I do to debug this further, are there any debug classes to make use of (i remember jme2 had some nice debug functions)?

There is definitely something odd going on.



Can you show us your lighting setup?



Curious, what happens if you scale up the directional light’s direction vector?



Alternately, what if you only set the scale of the model and not the entire scene?

You are right, it is odd and gets even worse.

I have created a simplified test class where i generate just one plate as geometry:

[java]

public class SimpleTest extends SimpleApplication

{

float angle;

PointLight pl;

Geometry lightMdl;

@Override

public void simpleInitApp()

{

viewPort.setBackgroundColor(ColorRGBA.White);

flyCam.setDragToRotate(true);

flyCam.setMoveSpeed(10);

flyCam.setRotationSpeed(10);

//

// gometry

//

Vector3f[] vertices = new Vector3f[] { new Vector3f(0.0f, 0.0f, 10.0f), new Vector3f(0.0f, 500.0f, 10.0f),

new Vector3f(0.0f, 500.0f, -10.0f), new Vector3f(0.0f, 0.0f, 10.0f),

new Vector3f(0.0f, 500.0f, -10.0f), new Vector3f(0.0f, 0.0f, -10.0f),

new Vector3f(0.0f, 500.0f, 10.0f), new Vector3f(1000.0f, 500.0f, 10.0f),

new Vector3f(1000.0f, 500.0f, -10.0f), new Vector3f(0.0f, 500.0f, 10.0f),

new Vector3f(1000.0f, 500.0f, -10.0f), new Vector3f(0.0f, 500.0f, -10.0f),

new Vector3f(1000.0f, 500.0f, 10.0f), new Vector3f(1000.0f, 0.0f, 10.0f),

new Vector3f(1000.0f, 0.0f, -10.0f), new Vector3f(1000.0f, 500.0f, 10.0f),

new Vector3f(1000.0f, 0.0f, -10.0f), new Vector3f(1000.0f, 500.0f, -10.0f),

new Vector3f(1000.0f, 0.0f, 10.0f), new Vector3f(0.0f, 0.0f, 10.0f), new Vector3f(0.0f, 0.0f, -10.0f),

new Vector3f(1000.0f, 0.0f, 10.0f), new Vector3f(0.0f, 0.0f, -10.0f),

new Vector3f(1000.0f, 0.0f, -10.0f), new Vector3f(1000.0f, 500.0f, -10.0f),

new Vector3f(1000.0f, 0.0f, -10.0f), new Vector3f(0.0f, 0.0f, -10.0f),

new Vector3f(1000.0f, 500.0f, -10.0f), new Vector3f(0.0f, 0.0f, -10.0f),

new Vector3f(0.0f, 500.0f, -10.0f), new Vector3f(1000.0f, 0.0f, 10.0f),

new Vector3f(1000.0f, 500.0f, 10.0f), new Vector3f(0.0f, 500.0f, 10.0f),

new Vector3f(1000.0f, 0.0f, 10.0f), new Vector3f(0.0f, 500.0f, 10.0f), new Vector3f(0.0f, 0.0f, 10.0f) };

Vector3f[] normals = new Vector3f[] { new Vector3f(-1.0f, 0.0f, 0.0f), new Vector3f(-1.0f, 0.0f, 0.0f),

new Vector3f(-1.0f, 0.0f, 0.0f), new Vector3f(-1.0f, 0.0f, 0.0f), new Vector3f(-1.0f, 0.0f, 0.0f),

new Vector3f(-1.0f, 0.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f),

new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f),

new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f),

new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f),

new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f),

new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f),

new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, -1.0f),

new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, -1.0f),

new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.0f, 0.0f, 1.0f),

new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.0f, 0.0f, 1.0f),

new Vector3f(0.0f, 0.0f, 1.0f) };

int[] indices = new int[] { 0, 1, 2, 0, 2, 5, 1, 7, 8, 1, 8, 2, 7, 13, 14, 7, 14, 8, 13, 0, 5, 13, 5, 14, 8,

14, 5, 8, 5, 2, 13, 7, 1, 13, 1, 0 };

//

// scaling vertex coordinates

//

//for (int i = 0; i < vertices.length; i++)

//{

// vertices = new Vector3f(vertices.getX() / 1000, vertices.getY() / 1000, vertices.getZ() / 1000);

//}

Mesh mesh = new Mesh();

mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));

mesh.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals));

mesh.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indices));

mesh.updateBound();

Geometry geometry = new Geometry("test", mesh);

Material material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");

material.setFloat("Shininess", 12);

material.setBoolean("UseMaterialColors", true);

material.setColor("Ambient", ColorRGBA.Black);

material.setColor("Diffuse", ColorRGBA.Gray);

material.setColor("Specular", ColorRGBA.White);

geometry.setMaterial(material);

//

// scaling geometry

//

geometry.scale(0.001f);

rootNode.attachChild(geometry);

//

// lights

//

DirectionalLight dl = new DirectionalLight();

dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());

dl.setColor(ColorRGBA.White);

rootNode.addLight(dl);

AmbientLight al = new AmbientLight();

al.setColor(new ColorRGBA(5f, 5f, 5f, 1.0f));

rootNode.addLight(al);

lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));

lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));

lightMdl.getMesh().setStatic();

rootNode.attachChild(lightMdl);

pl = new PointLight();

pl.setColor(ColorRGBA.White);

pl.setRadius(10f);

rootNode.addLight(pl);

}

@Override

public void simpleUpdate(float tpf)

{

angle += tpf;

angle %= FastMath.TWO_PI;

pl.setPosition(new Vector3f(FastMath.cos(angle) * 2f, 0.5f, FastMath.sin(angle) * 2f));

lightMdl.setLocalTranslation(pl.getPosition());

}

/**

  • @param args

    */

    public static void main(String[] args)

    {

    SimpleTest test = new SimpleTest();

    test.start();

    }

    }

    [/java]

    Enabling the scaling on geometry here has the effect described, no lights at all.





    Scaling the vertex coordinates before creating the mesh gives us lighting, but with another strange effect.

    When the moving PointLight is behind the object, specular highlights are shown on the front face, when the light is in front of the object it stays dark.



    Something is odd with this setup, i just can’t figure out what, any help is appreciated.

Just a short test, try scaling your model by -1 and see if it makes a difference to the lighting (yeah it’s flipped but you are looking for the normal information at this point right? :wink: )

The problem is one of these :

  1. no TangentBinormalGenerator.generate(node);
  2. wrong normals, uvs ? Reverse index order ?

TangentBinormalGenerator does not work here, as i do not have texture coordinates. These are not provided in my input data and i assumed they are not needed, as no textures shall be applied, just basic colored materials.



I have reversed the index order, no success here.



Wrong normals was also something i have thought of, but how do i check these?

in jme2 with normals shown it looks alright and renders fine:





I also used the ShowNormals.j3md but have no idea what the colors mean, is there some explanation to this?

Scaled model by -1, object upside down, but no effect on lighting, same behaviour as before.

By closely inspecting the geometry i managed to sort out one problem.

The index array was wrong, it reused vertices and left others unused.

The fixed array for the SimpleTest now looks like:

[java]

int[] indices = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,

25, 26,27, 28, 29, 30, 31, 32, 33, 34, 35 };

[/java]



This fixes the lighting when not scaling the geometry, looks perfect now. :smiley:



But the other problem is still there, when i scale the geometry with geometry.scale(0.001f); instead of the vertex coordinates, lighting disappears completely.



Any more ideas on this one?

[java]



public static Node createDebugNormals(Mesh mesh, Material mat)

{

Node debugNormals = new Node();



VertexBuffer vertex = mesh.getBuffer(Type.Position);

float[] vertexArray = BufferUtils.getFloatArray((FloatBuffer) vertex.getData());



VertexBuffer normals = mesh.getBuffer(Type.Normal);

float[] normalArray = BufferUtils.getFloatArray((FloatBuffer) normals.getData());



for (int i = 0; i < vertexArray.length; i += 3)

{

Vector3f p1 = new Vector3f(vertexArray, vertexArray, vertexArray);

Vector3f n1 = new Vector3f(normalArray, normalArray, normalArray);



debugNormals.attachChild(createLine("DebugShowNormalsLine", mat, p1, p1.add(n1.mult(0.1f))));

}



GeometryBatchFactory.optimize(debugNormals);

return debugNormals;

}





public static Geometry createLine(Material mat, Vector3f startPosition, Vector3f endPosition)

{

return createLine("Line", mat, startPosition, endPosition);

}



public static Geometry createLine(String name, Material mat, Vector3f startPosition, Vector3f endPosition)

{

Line line = new Line(startPosition, endPosition);

Geometry lineGeom = new Geometry(name, line);

lineGeom.setMaterial(mat);

return lineGeom;

}



[/java]

Thanx @tralala. Your code is definitely useful, integrated right away.



Have done some more investigation, checked all triangles and normals (by hand on paper … i have too much time apparently :wink: ).

Result is, everything is ok, all triangles are created counterclockwise, index array ist ok, normals point to the right directions, no errors here.



Anyway, scaling the geometry breaks something.

Here two screenshots made with the code to draw the normals (red lines), the strange thing is drawings the normals to the scaled geometry results in just three lines in one corner ???





I,m confused …

I cannot reproduce your issue… I can scale the model and the createDebugNormals() method is still working correctly. Lighting also works correctly when the model is scaled.

Also, your last post does not prove that scaling causes normals to mess up because the createDebugNormals() method generates the data based on the original normals, not the scaled normals.



You will need to provide more information, preferably a test case that shows lighting break down when a model is scaled

I have a lightning problem with my terrains and Sploreg said it’s a “bug with the normals not taking into account the terrain’s scale”



http://hub.jmonkeyengine.org/groups/terramonkey/forum/topic/alphamap-in-terraingrid-problem/#post-136190



Similar ?

Does it work correctly with Lighting.j3md instead of TerrainLighting.j3md?

ozonegrif said:
I have a lightning problem with my terrains and Sploreg said it's a "bug with the normals not taking into account the terrain’s scale"

http://hub.jmonkeyengine.org/groups/terramonkey/forum/topic/alphamap-in-terraingrid-problem/#post-136190

Similar ?


My guess... and it's only a guess... is that this had more to do with the fact that the normals are generated from the terrain. In that case, the relationship between x,z scale and y scale is important or the normals will be too subtle or too dramatic.

hey momoko,



thank you for replying, thought no one was interested in this topic.

Here my test code for you to reproduce the issue:



[java]

import java.nio.FloatBuffer;



import jme3tools.optimize.GeometryBatchFactory;



import com.jme3.app.SimpleApplication;

import com.jme3.light.AmbientLight;

import com.jme3.light.DirectionalLight;

import com.jme3.light.PointLight;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.FastMath;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.Mesh;

import com.jme3.scene.Node;

import com.jme3.scene.VertexBuffer;

import com.jme3.scene.VertexBuffer.Type;

import com.jme3.scene.shape.Line;

import com.jme3.scene.shape.Sphere;

import com.jme3.util.BufferUtils;



public class SimpleTest extends SimpleApplication

{

public static Node createDebugNormals(Mesh mesh, Material mat)

{

Node debugNormals = new Node();

VertexBuffer vertex = mesh.getBuffer(Type.Position);

float[] vertexArray = BufferUtils.getFloatArray((FloatBuffer)vertex.getData());

VertexBuffer normals = mesh.getBuffer(Type.Normal);

float[] normalArray = BufferUtils.getFloatArray((FloatBuffer)normals.getData());

for (int i = 0; i < vertexArray.length; i += 3)

{

Vector3f p1 = new Vector3f(vertexArray, vertexArray, vertexArray);

Vector3f n1 = new Vector3f(normalArray, normalArray, normalArray);

debugNormals.attachChild(SimpleTest.createLine("DebugShowNormalsLine", mat, p1, p1.add(n1.mult(0.1f))));

}

GeometryBatchFactory.optimize(debugNormals);

return debugNormals;

}



public static Geometry createLine(String name, Material mat, Vector3f startPosition, Vector3f endPosition)

{

Line line = new Line(startPosition, endPosition);



Geometry lineGeom = new Geometry(name, line);

lineGeom.setMaterial(mat);

return lineGeom;

}



/**

  • @param args

    /

    public static void main(String[] args)

    {

    SimpleTest test = new SimpleTest();

    test.start();

    }



    float angle;

    PointLight pl;

    Geometry lightMdl;



    @Override

    public void simpleInitApp()

    {

    this.viewPort.setBackgroundColor(ColorRGBA.White);

    this.flyCam.setDragToRotate(true);

    this.flyCam.setMoveSpeed(10);

    this.flyCam.setRotationSpeed(10);



    //

    // gometry

    //

    Vector3f[] vertices = new Vector3f[] { new Vector3f(0.0f, 0.0f, 300.0f), new Vector3f(0.0f, 500.0f, 300.0f),

    new Vector3f(0.0f, 500.0f, 0.0f), new Vector3f(0.0f, 0.0f, 300.0f), new Vector3f(0.0f, 500.0f, 0.0f),

    new Vector3f(0.0f, 0.0f, 0.0f),



    new Vector3f(0.0f, 500.0f, 300.0f), new Vector3f(1000.0f, 500.0f, 300.0f),

    new Vector3f(1000.0f, 500.0f, 0.0f), new Vector3f(0.0f, 500.0f, 300.0f),

    new Vector3f(1000.0f, 500.0f, 0.0f), new Vector3f(0.0f, 500.0f, 0.0f),



    new Vector3f(1000.0f, 500.0f, 300.0f), new Vector3f(1000.0f, 0.0f, 300.0f),

    new Vector3f(1000.0f, 0.0f, 0.0f), new Vector3f(1000.0f, 500.0f, 300.0f),

    new Vector3f(1000.0f, 0.0f, 0.0f), new Vector3f(1000.0f, 500.0f, 0.0f),



    new Vector3f(1000.0f, 0.0f, 300.0f), new Vector3f(0.0f, 0.0f, 300.0f), new Vector3f(0.0f, 0.0f, 0.0f),

    new Vector3f(1000.0f, 0.0f, 300.0f), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(1000.0f, 0.0f, 0.0f),



    new Vector3f(1000.0f, 500.0f, 0.0f), new Vector3f(1000.0f, 0.0f, 0.0f), new Vector3f(0.0f, 0.0f, 0.0f),

    new Vector3f(1000.0f, 500.0f, 0.0f), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.0f, 500.0f, 0.0f),



    new Vector3f(1000.0f, 0.0f, 300.0f), new Vector3f(1000.0f, 500.0f, 300.0f),

    new Vector3f(0.0f, 500.0f, 300.0f), new Vector3f(1000.0f, 0.0f, 300.0f),

    new Vector3f(0.0f, 500.0f, 300.0f), new Vector3f(0.0f, 0.0f, 300.0f) };



    //

    // normals

    //

    Vector3f[] normals = new Vector3f[] { new Vector3f(-1.0f, 0.0f, 0.0f), new Vector3f(-1.0f, 0.0f, 0.0f),

    new Vector3f(-1.0f, 0.0f, 0.0f), new Vector3f(-1.0f, 0.0f, 0.0f), new Vector3f(-1.0f, 0.0f, 0.0f),

    new Vector3f(-1.0f, 0.0f, 0.0f),



    new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f),

    new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f),



    new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f),

    new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f), new Vector3f(1.0f, 0.0f, 0.0f),



    new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f),

    new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f), new Vector3f(0.0f, -1.0f, 0.0f),



    new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, -1.0f),

    new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, -1.0f), new Vector3f(0.0f, 0.0f, -1.0f),



    new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.0f, 0.0f, 1.0f),

    new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.0f, 0.0f, 1.0f) };



    //

    // indices

    //

    int[] indices = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,

    23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 };



    // ACTIVATING THIS SCALING WORKS

    // *** scaling vertex coordinates

    //

    // for (int i = 0; i < vertices.length; i++)

    // {

    // vertices = new Vector3f(vertices.getX() / 1000,

    // vertices.getY() / 1000, vertices.getZ() / 1000);

    // }

    //

    // *** scaling vertex coordinates



    Mesh mesh = new Mesh();



    mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));

    mesh.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normals));

    mesh.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indices));



    mesh.updateBound();



    Geometry geometry = new Geometry(“test”, mesh);



    // material wireframe

    // Material material = new Material(this.assetManager,

    // “Common/MatDefs/Misc/Unshaded.j3md”);

    // material.setColor(“Color”, ColorRGBA.Green);

    // material.getAdditionalRenderState().setWireframe(true);

    //

    // material solid

    Material material = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

    material.setFloat(“Shininess”, 12);

    material.setBoolean(“UseMaterialColors”, true);

    material.setColor(“Ambient”, ColorRGBA.Black);

    material.setColor(“Diffuse”, ColorRGBA.Gray);

    material.setColor(“Specular”, ColorRGBA.White);



    geometry.setMaterial(material);



    // ACTIVATING THIS SCALING BREAKS NORMALS

    // *** scaling geometry

    //

    geometry.setLocalScale(0.001f);

    //

    // *** scaling geometry



    this.rootNode.attachChild(geometry);



    //

    // lights

    //

    DirectionalLight dl = new DirectionalLight();

    dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());

    dl.setColor(ColorRGBA.White);

    this.rootNode.addLight(dl);



    AmbientLight al = new AmbientLight();

    al.setColor(new ColorRGBA(5f, 5f, 5f, 1000f));

    this.rootNode.addLight(al);



    this.lightMdl = new Geometry(“Light”, new Sphere(10, 10, 0.1f));

    this.lightMdl.setMaterial(this.assetManager.loadMaterial(“Common/Materials/RedColor.j3m”));

    this.lightMdl.getMesh().setStatic();

    this.rootNode.attachChild(this.lightMdl);



    this.pl = new PointLight();

    this.pl.setColor(ColorRGBA.White);

    this.pl.setRadius(10f);

    this.rootNode.addLight(this.pl);



    //

    // debug normals

    //

    this.rootNode.attachChild(SimpleTest.createDebugNormals(mesh,

    this.assetManager.loadMaterial(“Common/Materials/RedColor.j3m”)));

    }



    @Override

    public void simpleUpdate(float tpf)

    {

    this.angle += tpf;

    this.angle %= FastMath.TWO_PI;



    this.pl.setPosition(new Vector3f(FastMath.cos(this.angle) * 2f, 0.5f, FastMath.sin(this.angle) * 2f));

    this.lightMdl.setLocalTranslation(this.pl.getPosition());

    }



    }

    [/java]



    Using the '
    ** scaling geometry’ block for scaling breaks lighting, comment this out and uncomment the ‘*** scaling vertex coordinates’ which result in same model scale but with correct lighting.



    You can also see the the normals (red lines) are drawn incorrectly with ‘scaling geometry’.



    Can you reproduce it with above code?

Fixed in SVN