Parts of the mesh disappear in viewport

Godot Version

4.2.1

Question

Hello everyone. I hope I created the post correctly.

I created a model in Blender 4.0.2 and when I export it as a glb file and import it into godot a strange behaviour occurs.

Parts of the eyes, eyebrows, and eyelashes disappear in the viewport depending on the angle from which I look at the model. This also happens when I use the preview function of the camera.

GodotViewport3

This behaviour happens only when I join all parts of the model. When I export the head, eyes, eyelashes and eyebrows as seperate objects (still in one glb file) everything is displayed correctly.

I hope you can help me find what causes the issue and I’m thankfull for any advice :slight_smile:

1 Like

Looks like the combined version is decimated, like either you are looking at an LOD, or some sort of optimization happened that you are not aware of.

To verify, compare the wireframe view of the two, you should see different geometry, first in Godot, then in the source files.

1 Like

Hey roc4u, thanks for your reply.
I believe I did not describe the issue correctly.
The two images I posted are from the same instance of the model after I imported it into godot. Depending how I rotate the camera the viewport will display the eyelashes correctly of only part of it.

Therefor, if I understood you correctly, I would exclude some automatic decimation of the model during the export.

To me it looks like Godot has some kind of limit on how many vertices are displayed per single object on screen or something like that.

If it changes based on the angle of the camera, it sounds like z-fighting. The two meshes are too close together and the engine can’t decide which is on top.The reason this is different based on whether the meshes are merged is probably due to each mesh will have it’s own bounding box when they are separate and that might help on the sorting.

Just ensure that there is a bit more spacing between the meshes.

3 Likes

Ah ok, then you have a bounds issue like how @Arnklit is talking about, but I think it’s just that you are seeing the model change LOD based on you moving the camera around as due to the bounds or pivot of the model as a whole, it thinks you are further away from the pivot compared to visually what you see, so you might be seeing LOD1 on the left view.

The reason why I think that is if you see here, the triangles are not the same, and they look like two different meshes, which I assume are LODs.

When in the viewport and looking at the model from different angles, use the wireframe viewmode and see what you see.

1 Like

If you’re using transparency, change the Alpha mode. Typically from Pre-Pass to Scissors or Alpha Hash.

1 Like

Hello everyone.

Here is the wireframe version. I don’t know if it’s important but I noticed 3 levels of details that are rendered in the viewport.

I tried moving the eyebrows and eyelashes away from the face before merging them together as to avoid z-fighting, but the behaviour still presisted in Godot.

1 Like

I believe I don’t use transparency but I’m not sure. How could I check it in Blender? For the eye lashes and eyebrows i just use default materials with a base color.

But I use an addon “Ucupaint” to create the textures for the skin. Could the skin textures distort the other parts of the mesh, if they used the wrong alpha mode?

This is not checked in Blender, but is set in Godot in the material properties.

Well, it worked for me.

What does the bounding box look like when you select the mesh, your should see that when you zoom out a bit, also where is the pivot of that mesh?

I believe you mean this?

These are the settings for the materials for the eyebrows and eyelashes:

Transparency

If you don’t have transparency, then this is probably not the case.

With these screens, are those you manually changing the LOD, or that kind of switch in LOD or mesh detail what happens when you look at the head at different angles?

this screen

Yeah, question though, what is the node setup, like are you selecting the Mesh Instance3D node in your scene, or are you selecting something lower in the hierarchy?

Another thing to check out, is in Blender, where is the pivot of the object (or objects) in there?

Last thing you can check to make sure it’s the LODs switching on your at different angles, is to toggle Generate LODs off and re-import on your body model asset, I think that setting is available when you import as a mesh too. Then try and see if you see the rotating around the mesh show the same problem.

OMG that’s it!!
I toggled “Generate Lods” off, reimported the glb and now the quality stays constant. I didn’t know this option even existed. Thanks roc4u and everyone else to answered :slight_smile:

So you won’t want to have that off honestly, I just wanted to make sure it’s the LODs that are what you are seeing.

You’ll want to check your blender scene, the pivots especially, and even the pivots and node setup in godot, as something is making your setup think it should be showing you a lower LOD when you rotate.

Btw, what is the scale of that asset, if you place a simple godot cube or sphere in your scene, how do they compare?

Hello everyone. Please excuse the late reply.

This is the scale of the model (I overlayed the dimensions from Blender), which is too big. I hadn’t realized it myself.

But I also scaled the model down to an height of about 2 units, applied the scale and exported it. But in Godot the LODS still behave the same. But at this point I believe Godot behaves as intended. Still I will inform myself about LODs and also have a look into the pivots. With “pivot” und mean the origin of the model in Blender,right?

I will of course update this post, should I manage to improve the behaviour.

Yeah, but there are a lot of variables, like in how the mesh is setup in blender (one pieces, more than one pieces), how it’s exported (scale and units), how it’s imported and setup in godot (scale, bounds, etc).

The image you show above has an interesting pivot, which looks like it’s at the top of the head.

What I usually profess is when getting models from a modelling app (blender, maya, max, etc), that you want to make sure what you get by default when you place it in godot, matches 100% to what you see in blender scale wise. If you want a 10 foot tall statue, make sure it comes out of blender that high, and when you drop it into godot without anything beyond importing and placement, it is 10 feet tall.

One mistake I see even professionally is that the artist will import a model into the engine and notice it’s too small for what they want to use it for, so they will do the scaling and transforms in the engine to ‘fix’ it, when it should be done in the modelling program. What that can cause is bounds issues that can effect how it’s drawn, how it’s culled, and possibly many other things. I think it’s worst when you import small and scale up, but I think it’s bad both ways.

If your mesh has variable sizes, I generally say to make the mesh by default around a bit less than it’s max size in game, this will help ensure the model holds up at the larger end like for triangle density, texture resolutions, collision detail, etc. Importing it right in the middle of the potential sizes can work too, I would just make sure not to export it at it’s smallest potential size and scaling it up too much.

A good exercise is to create a 1 meter square cube in blender, and export it and import into godot, compare that new mesh to a boxmesh primitive of the same size, make sure they match, if not, see about fixing up your blender unit settings.

If you still have trouble with it, if you want you can send me an fbx or obj and I can check it out.

Hello everyone,
I read the Godot documentation on LOD generation and I find out that it is possible to control the range at which Godot will switch LODs.

I achieved it by setting the “LOD Bias” property on model node directly, but there many more ways to do it. Here’s the link to the documentation page:

1 Like