My mesh is showing the back side and I cant solve it

Hi everyone!

Below there is a link with my problem.
https://playground.babylonjs.com/#7W4MSE#5

Every code below from <<<<<>>>>> I add to try a change.
This model I created with 3dsmax and export to Substance and save direct in substance to glft.
But I try another model saved direct from 3dsmax and export with a Babylon Exporter plugin and the same issue.

I found this solution but for me doesnt work.
https://playground.babylonjs.com/#DJFQAD

Or its is my model problem or any code that I did not used…
This is my first contact with Babylon so sorry if a nooby question and sorry my english…

thanks for all.

EDIT1: If I save in .babylon from 3dsmax and NOT works. The same problem. I used a physical material with textures.
BABYLON.SceneLoader.LoadAssetContainer( “https://raw.githubusercontent.com/bisewski001/Babylon/master/”,
“teapotFromMax.babylon”, scene, function (container) {

It seems like your mesh is exported with blend mode on. It works if I turn it off:

Please make sure that your textures are flagged as opaque

(pinging @PatrickRyan for more details if required)

@bisewski, we’re happy to help you get unblocked. You mentioned that your two paths to glTF were Substance, which I see you used Substance Painter 2018.3.2, and 3ds Max. Can you share with me your setup for Painter? Did you set up an opacity channel in your texture set? Also what material mode did you set up your project in (PBR metal-rough, PBR spec-gloss, something else)?

What you have is a simple case of the wrong alphaMode being written to your file like @Deltakosh mentions above. The fastest fix for this is to simply change the glTF material definition in the file. Using the glTF shell extension you can unpack a glb and repack it again. With it unpacked, you will see the glTF json file. Open it in your favorite editor, I use VS Code because it has glTF extensions that give you a viewer as well as intellisense, and change the alphaMode on your material from BLEND to OPAQUE like below:

While that is only a work around, if I can figure out your setup I can help you export without the work around.

One more thing you may want is double sided rendering since there is a chunk of mesh missing next to the lid. That can be added in the same way:


1 Like

Many thanks for your help. I really apreciate your attention.
Here you download my substance file .spp
https://github.com/bisewski001/Babylon/blob/master/teapot.rar
And here you can download my 3dsmax file
https://github.com/bisewski001/Babylon/blob/master/teapot.max

I think like a user from complex industrial projects if is possible import direct from Substance Painter to gltf with this Blend Mode correct, will be perfect. I also will try here any option.

Thanks

1 Like

Many Thanks for your attention Deltakosh!!! You are right…I will try to export direct from Substance Paint with this option correct…

Thanks

1 Like

@bisewski, in looking at your Substance Painter file, you have an opacity channel in your material of which, only the metal base has any input and it’s input is 1.0:

When your texture set contains an opacity channel, you will end up with alphaMode set to BLEND in your glTF, even if your opacity channel is set to 1.0 (fully opaque). To get around this, you need to remove the opacity channel from your texture set:

image

To do this, click the minus icon next to the opacity channel and it will be removed. This will cause Painter to write out alphaMode OPAQUE which is what you want. If you were to need opacity in your asset, say the teapot lid was made of glass, you will want to make a separate texture set for this. You do this by assigning a new material to meshes that need opacity in 3ds Max. That way, when you get the meshes into Painter, they are assigned to the correct texture set and you then add an opacity channel to the appropriate texture set.

A good rule to remember is that you can only have one blend mode per material and if any of your meshes in your asset need to have opacity, any other mesh that shares their material will also end up in the transparent queue in the render. This will cause opaque meshes to render like you saw before because the transparent queue does not take a depth pass into account by default.

So the best practice, divide your mesh into opaque materials and transparent materials (as few as absolutely needed to hit your texel density target) and export that asset to work on in Painter. Then Painter should export your glTF correctly. Let me know if you have any other questions!

Its is perfectly Patrick…I try this solution in a more complex model and work fine…Thanks so much…

This is my first contact with babylon so I will discover many things, but I am very impressed with this Playgroung system and the attention in this support …

gratters

3 Likes

Hi guys, sorry if I’m reopening this topic but I have a problem when I export my glt with 2 materials. Everything works correctly but I have 2 different sets of textures (one for each material, 6 in total).

Is there a way to have only 3 tex in total(color, normal and ORM?).

Thanks
Carlo

Are both set of textures identical ? or would it need to make an atlas ?

@3dedintorni, would you be able to supply a little more information so we can give you the best answer?

  • What DCC tool are you using to export (Maya, Blender, 3ds Max, Substance Painter)?
  • I assume since you have multiple materials you also have multiple meshes, correct? Are any of the materials assigned to more than one mesh or is it one mesh per material?
  • What is the reason to split the materials? Are you using different alpha modes for each material? Do you need a custom shader for each material, yet sharing the same source textures?

This context will help us give you a better answer so we can unblock you.

Hi guys.
I have a 3d model (fbx from Cinema4D) with 1 mesh and 2 materials (it’s a pack with a transparent window and you can see the product inside) .
The first material is opaque and the second one has transparency.
The transparent material doesn’t have any texture at the moment but probably I’ll need to add the same normal map as the opaque material.
When I export the Gltf (through the Gltf PBR Metal Roughness Template), Substance creates 2 sets of textures (even if I don’t apply any texture to the transparent material), one for each material.
I need to create only 1 set of textures (as it happens in Blender for instance, I created the same scene there as well).
I’m using a PBR-metal-rough-with-alpha-blending material
Thanks guys!

Maybe Substance is always exporting textures. @PatrickRyan is our own Substance king so he might know if a setup exists for this ?

1 Like

@3dedintorni, there are a couple of things that stand out to me in your last post:

If you have one mesh and two materials, you are making your texture assignments by submesh elements like by face. The problem is that glTF and Babylon can’t assign materials by a submesh feature and you need one material per contiguous mesh. Since this isn’t want you are asking, I am going to assume I am reading your post incorrectly, but it is worth noting that glTF does not allow this.

In my experience with Substance Painter, the project is organized by texture set which is derived from materialID. Each texture set has its own layer stack and texture set settings. Since each texture set is exported with its individual layer stack and settings, I don’t see a way to link one texture set with another, effectively crossing materialIDs.

The glTF exporter from Painter is something we don’t have any visibility into since it was created by the Allegorithmic team (pre Adobe). But from the glTF spec, each material needs definitions for either factors or textures for material parameters so I am assuming that the exporter is just assigning each texture set to the associated materialID that is written into the glTF json.

You can manually edit the glTF file that is generated from Painter, however. Painter will write out the file as a glTF and associated textures. You can simply open the glTF file in something like VSCode and do a search for the texture names you want to replace and edit the file directly.

Most of the time I don’t export my models from Painter, but instead through a modeling package like Maya. I can then assign the textures to materials as needed and the exporter will handle sharing textures if need be. I don’t know if there is a glTF exporter for Cinema4D, but there is native glTF export in Blender which will allow you to control what textures are assigned to which materials.

I wish there were a better answer here, but I don’t think Painter is set up to export to glTF through sharing texture sets.

Hi @PatrickRyan. Yes exactly I assigned 2 different materials to 2 different selections.
I made my first test with 1 material but the transparency was applied to the entire model (I read your previous post about it). I couldn’t find any way to fix that by using masks.
For this reason, I added 2 different materials.
At this point I’ll use Blender to export Gltf directly from there.

Thanks a lot for your support

2 Likes