Custom model format face smoothing

Hello. I am trying to get my binary model format to export from Blender with smooth faces. To do this I’ve referenced Blender exporter, and I think I have it down.

When I reached the importing into jME3.1 part I couldn’t find out how the smoothing is applied. In GitHub the OBJLoader skips over the “s 1” flag which is what marks a group of verts as smooth.

My question is how does jME3.1 apply smooth faces from objs? Or what is the class that loads the obj format, if its not “”?

It does not at all.

For this usually the vertices are shared, with a average normal.
This makes the lighting do a smooth impression instead of a sharp one that happens if you have multiple vertices with different nromals for adjacent triangles.

You should be able to select the model in Blender and then select “Shade Smooth” on the pane left of the 3D View.

So Blender should export the vertices with already averaged normals?

Yeah I’m doing that but this is what my model looks like imported. Must be exporting something wrong…

That model looks smooth to me. What is it supposed to look like?

Like this:

Just making sure, you did select “Export Normals” when saving the OBJ right?

OBJs work fine. I’m working on my own format, for fun. I want to know how/where OBJs calc their smooth faces. Is it already averaged in exported OBJ or is it done on import?

The normals are exported here:

jME does not do any averaging, it writes the normals verbatim:

Blender is capable of calculating per-vertex normals (as opposed to per-face). That’s what you’re seeing when the model is displayed in the preview. You need to make sure you’re exporting per-vertex normals and not per-face normals.

Okay this is what I have thought. I don’t get where smoothing is happening there.

Check out:

Is this pair being sorted that makes it smooth? I cannot pinpoint it.

But the model is still smooth when you enable “Keep Vertex Order”.

Interesting, now I’m more lost. So where is the smoothing happening?

Or does it not happen on export. Does hitting the smooth faces alter the model itself?

Yes, it recomputes the normals for all the vertices.

Weird. So why is my exporter messing it up? If I don’t do anything for cases where face.use_smooth it just comes out flat…

Are you exporting vertex normals or triangle normals?

“loop” normals? I am learning using the IQM format. This is the function that I inherited into my exporter:(minus the alpha vertcol and materials)

Nevermind. I’m just going to use the OBJ method.

Edit: I got it. I had messed something up.