February 6, 2015, 11:19pm
So I m trying to create a flat shaded mesh like this
By flat shading i mean hard edge and a single color per face.
But right now (with only one face) i can’t have an unique solid color (without color gradient).
Which material should i use ?
February 6, 2015, 11:42pm
Maybe you should use a directional light instead of a point light.
February 6, 2015, 11:59pm
Could be a point light issue. Could be that you have normals facing the wrong way.
…hard to say without knowing how the mesh is created.
February 7, 2015, 12:00am
do a spot light is a directional light ? If so it’s not better with.
@pspeed may be an normal issue let me check that
February 7, 2015, 12:07am
So i got the same issue with this mesh :
private static final Mesh OxTEST = new Mesh();
OxTEST.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(positions, positions, positions));
OxTEST.setBuffer(Type.Index, 3, BufferUtils.createIntBuffer(0, 1, 2));
Vector3f n = (positions.subtract(positions).cross(positions.subtract(positions))).normalize();
OxTEST.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(n, n, n));
and the normal seem to be ok
February 7, 2015, 12:15am
DirectionalLight is a directional light… with no fall off and no limited cone or anything. Spot light and point light may or may not light some vertex for various reasons that have nothing to do with its normal.
February 7, 2015, 12:23am
It works correctly with a directional light. Imfortunately as you said there is no fall off. So if i want to use point light and spot light will i have to create a custom material ?
February 7, 2015, 4:32am
The problem will be the same. I guess your single triangle is huge when compared to the light fall-off… thus one corner it bright and the other completely in shadow or whatever. General solution is to subdivide the triangles.