What smooth shading algorithm does JME use?

When I make a model in Blender, I can choose “flat shading” or “smooth shading” and this seems to be a property of the model, not of the material, since I can change the material in JME but keep the smooth shading.

From reading Wikipedia I found that Phong shading is a smooth algorithm, so I would think that that’s what JME uses when I choose “smooth shading” in Blender.

But what about a model with “flat shading” in blender, what does JME use then?

Well one if how the color is being itnerpolated between two values, the other is if normals are shared.

Eg a box with shared normals at the corners would be lit more light a ball, whiel with flat each vertex gets it’s own normal, leading to uniform colord vertexes.

So one is for colors and one is for normals, I thought the colors were based on the normals’ result on the supposed darkness.

Anyway, what is the name of the algorithms involved, that’s what I really want to know. I’ll read up on them myself .

We use phong lighting.
But that is not related to you issue.
Flat or smooth shading are just 2 ways of computing normals for a mesh.
here is a picture to explain

The red arrows are normals computed for a flat shading. (note that there are 2, so you’ll have 2 vertices)
The green one is the one computed for a smooth shading algorithm (one vertex).

To have some flat shading, just make your object flat in blender. (there is an option in the left toolbar. Hit “t” to display the toolbar)

1 Like

Thanks for the reply and the image.
So JME uses phong lighting no matter my choice of “flat” or “smooth” in blender, and the blender option just affects the normals calculation used for shading. I got it right now?

To further clarify, I’m using these and they work fine for me, now I’m posting here to better understand what’s going on and also so I can work better because I understand more of it.

Do the normal calculations have a name too, or would you just say “interpolation of normals” ?

@ettavsdro said: So JME uses phong lighting no matter my choice of "flat" or "smooth" in blender, and the blender option just affects the normals calculation used for shading. I got it right now?
Yes, you got it right. But just to clarify, the normals are not computed by JME. The normals are computed by blender. They are just data to JME.
1 Like

Aha, thanks. I always assumed JME does the calculations.

Someone said in another post that smooth shading was less expensive than flat shading because smooth uses fewer vertices. This seemed counterintuitive to me and also was not what wikipedia said about it. But if Blender does that calculation and JME then just does the shading, I suppose it makes more sense.

I always thought the view in Blender was just a kind of “preview” of the smooth model, and that it was really made smooth when rendering.

Thanks a lot.
I should read up more on this but don’t know where to start. I got the book real time rendering, which is huge, something more “intro” level would be great. I’ll look.

Blender calculates the normals for each vertex. As said in the other post that means you need more vertices for flat shading.

More vertices = more calculations.

If you were using an unlit material with flat shading though that would be much faster than the lighting calculations - which may be why wikipedia said flat shading was cheaper.

The calculated normals are then interpolated between for all the points on the face - which is what gives you the illusion of a curve when lighting the surface.

1 Like