Exported mesh from Blender is see-through

I for the life of me, cannot figure out why my mesh is see through after being textured. At first I thought it was a problem with the camera but after setting the minZ to 0, I concluded that it wasn’t. I’ve tried messing with the export settings in Blender to no success. Any help would be kindly appreciated

This is what it looks like (please ignore the sprite and observe the bench as you can see its hind legs)

removing the texture results in it acting normal:

Hope you are well on this Season Holidays.

That only means that there is something going on with your material. It appears the material is not opaque. Either you have set a level of transparency to your albedo, base or diffuse- Texture, or you have set the material to be alpha blended, or you have imported other textures that can affect the alpha, such as a light/shadow map, opacityTexture or ambient occlusion.
It would be easier to debug if you could share a PG.
Else, on import or after a promise, you can already try to set the alpha of the material to 1 (opaque) and see what this does…
Meanwhile, have a great day :sunglasses: :christmas_tree:

1 Like

Thank you for your reply.

I apologize, I am having the hardest time trying to get the model uploaded and working properly with the texture possibly because of uploading to DropBox and it’s not allowing me to change the share property of files

The material would be ‘Tiles’ https://playground.babylonjs.com/#JUKXQD#4713

Yes, I understand it can be a bit tricky at the start but you’ll eventually get used to it.
As for the issue, it is as I thought. The PBR material you are importing from blender uses alpha from the albedo texture. By setting the material to opaque and remove alpha from albedo, the problem is gone (at least, so it seems to me). Else, let me know…

1 Like

Thank you so much! That worked with just the line
albedoTexture.hasAlpha = false

Is there a reason why the albedo texture uses alpha and is there a way to disable that within Blender itself?

Merry Christmas! :christmas_tree:

1 Like

I’m not a big blender user when it comes to materials. I create my materials either with substance or simply straight in BJS. I’m sure if you check a little through the material, in transparency, or check the defaults for the blender to bjs export (if you are using it), you should find something in there.
Also note that by default (if unset) blender generates PBR materials. If you cannot find it, let me know and I can callin someone who will point you straight in the right direction.

The PBR material imported from blender uses the alpha in the albedo texture and the model is imported into the sandbox.
The effect is shown in Figure 1:

So I replaced the picture of the albedo texture of the model in Figure 1 separately, and the effect is shown in Figure 2.

The effect in blender is shown in Figure 2:

Will the pictures in the model be modified during the import process? I don’t understand why the pictures are inconsistent. Can you help me solve it? ,Thank you so much!

Thanks for reaching out. Unfortunately, I’m not quite sure of the result you want to achieve. All I see is two figures both from the sandbox. I don’t know what part of it is correct (or if both are incorrect). Could you share this PG and a SS from the result you want/get from blender and point me to the parts you have an issue with?

What I can answer at this point is that importing a texture in BJS from blender won’t change the texture/image (or picture as you say).

What happens is that, on rendering, BJS treats ‘opaque’ meshes and ‘alpha-blended’ meshes at a different stage. ‘Opaque’ meshes render earlier in the process and ‘transparent or alpha-blended meshes’ render separetely, using a rendering order that will affect how a transparent or alpha-blended mesh will render over another. The sorting makes for the depth. If a transparent mesh renders before another, it is believed to be ‘behind’ the other. So, the sorting of transparent meshes (without using OIT) comes to a combination of using the ‘alphaIndex’ to order the meshes and use ‘needDepthPrePass’ to make a first pass on the material to combine alpha-blending of multiple layers of transparent meshes.

The other thing I can quickly mention is that when you use ‘hasAlpha’ or ‘useAlphaFromAlbedoTexture’
you are actually moving this material to a transparent/alpha-tested material/mesh. Even if it has no transparency. This will make it go through the ‘alpha-test’ where if you would set an ‘alpha’ to the material, it would go through the ‘alpha-blend’. Where alpha-test is less likely to create artefacts between opaque and transparent materials because the depth buffer is still updated.

Still, in case of your window frame, it’s processed like a transparent material (with alpha-test). My first advise would be that you separate everything that is ‘structure’/opaque from everything that is ‘window/transparent’ already at mesh level. All your structures will use opaque materials and all your windows/alpha-blended objects will use transparency (and will require to be ordered unless you choose to use OIT).

1 Like