Creating a flat shaded mesh

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 ?


Maybe you should use a directional light instead of a point light.

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.

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

So i got the same issue with this mesh :

private static final Mesh OxTEST = new Mesh();
OxTEST.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(positions[3], positions[2], positions[5]));
OxTEST.setBuffer(Type.Index, 3, BufferUtils.createIntBuffer(0, 1, 2));
Vector3f n = (positions[2].subtract(positions[3]).cross(positions[5].subtract(positions[3]))).normalize();
OxTEST.setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(n, n, n));

and the normal seem to be ok

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.

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 ?

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.