Model not rendered correctly in Babylon

I created a model in Sketchup and exported it as a .stl file.
When I view this file in default Windows application (Print 3D) it looks exactly the same as it did in Sketchup. If import this mesh into Blender, it also looks exactly the way is was originally drawn.
When I export this model from Blender as a .babylon file and load this model into Babylon within my game, the 6 triangular pieces that radiate outwards are intended rather than outdented.

I dropped the .stl, .blend and the .babylon files into the Babylon sandbox and all three files suffer the same problem

I uploaded the files to FileShare/Babylon/Model not displayed correctly at master · Bikeman868/FileShare · GitHub.

This is what it looks like in Sketchup:

This is what it looks like in Print 3D:

This is what it looks like in Blender:

This is what the .stl file looks like in the Babylon sandbox:

This is what the .blend file looks like in the Babylon sandbox:

This is what the .babylon file looks like in the Babylon sandbox:

1 Like

On mobile short answer. Think flipping your normals in Blender should fix. Blender does not cull backsides, so things some times do not show as a problem till exported.

2 Likes

Jc beat me to it, but yeah that’s the ticket seconded!

In Blender in Viewport Shader > Solid mode, you can enable backface culling here:
image

Switching to edit mode will allow you to recalculate normals or tweak them manually:

[edit] I have a Backface Culling functionnality in my ReTiCo addon, it can help to quickly enable/disable backface culling on materials & different viewport shading mode

2 Likes

This is weird because Sketchup uses different colors for front and back faces, and the 6 radial shapes and actually 6 instances of the same component just rotated. Despite this, 1 of them is displayed correctly in Babylon and the other 5 are not. I tried reversing the faces in Sketchup, and this makes them go into the “warning this is the back face” color, so it thinks they were correct originally.

However turning on the “Face Orientation” option in Blender does show the incorrectly rendered faces in the “back” color, and asking Blender to recalculate the outside faces does fix the problem - the model is drawn correctly in Babylon.

For my education, how is it possible to draw a simple shape in one drawing tool, copy it a few times, and save the file and end up with some of the faces the wrong way around. Is this a bug in Sketchup?

I think it’s come from .stl convention which is a very simple way to describe a 3D mesh (I’m not sure but I think face normals aren’t supported in this format). So it’s probably .stl Blender importer which calculate wrong normals when parsing the file.

OK, that makes sense. Thanks.

The .stl file format actually mandates normals. Each triangle consisting of exactly 12 floating point numbers; 3 for the normal vector followed by x, y and z for each of the triangle’s vertices.

See STL (file format) - Wikipedia.

I guess it will remain a mystery, and I will just have to add another step to my workflow to recalculate normals in Blender.

1 Like