BabylonJS / Exporters

Exporters for Babylon.js and gltf file formats
Other
610 stars 314 forks source link

Problem with exporting Babylon CD Release 20191111.2 (3D MAX 2019) in .glb files #682

Closed AndresCH10 closed 4 years ago

AndresCH10 commented 4 years ago

Good morning, today working with the babylon plugin, I export all the files with textures made by me (Substance painter) with opacity, but when I use a solid material of max, the opacity goes away.

Could it be a problem of the export options of the material in babylon or would it be of the material itself?

Thank you

----> Model Model3D.zip

vpenades commented 4 years ago

We're having the same issue on our side.

After inspecting the files, we've found the material AlphaMode property is set to BLEND instead of OPAQUE.

Drigax commented 4 years ago

@AndresCH10, what "Alpha Source" setting are you using for the texture in 3dsMax? If the texture format supports alpha (GIF, PNG, BMP, etc..), we drive the alpha blend mode of the material based off the setting.

See: https://doc.babylonjs.com/resources/3dsmax_to_gltf#alpha-mode

AndresCH10 commented 4 years ago

Good afternoon, thanks for answering, my texture is taken in PNG and these are its attributes within the max, I have the same options as in the reference image but it does not export well. ---> Captura de pantalla (148)

On the other hand, the configuration that I have used in the material has been Blinn material. With the help image, the babylon attributes option I do not have, therefore, I can not check if it works that way, could you tell me how to open that option?

---> imagen Captura de pantalla (149)

Drigax commented 4 years ago

Hmm, @AndresCH10 , I spent some time setting up a test bench to test the different texture/material export results.

I used 5 types of Materials and base color textures: 1) Base color texture in format that never has alpha channel (jpg) 2) Base color texture in format that supports alpha channel, but texture doesn't have one (png) 3) Base color texture in format that supports alpha channel, texture has channel, and texture setting in Max is set to "Alpha Source - None (Opaque)" 4) Base color texture in format that supports alpha channel, texture has channel, and texture setting in Max is set to "Alpha Source - Image Alpha" 5) Base color texture in format that supports alpha channel, texture has channel with transparent sections, and Texture setting in Max is set to "Alpha Source - Image Alpha"

This was done for both PBR (Physical) and Standard (Standard - Blinn) materials

The results appear to be as one would expect, though the simple geometry here hides the sorting errors that you see with your scene when transparency is applied, but the first three columns have alpha mode opaque and the last two have alpha mode blend: image

The third column appears to be what you're running into, we have a PNG with transparency channel, we set Alpha Source to Opaque, and export, but the resultant glTF shows that we have alphaMode opaque in my testing... image

I'm not sure if I can reproduce what you're running into. Can you send your scene so I can take a closer look?

Here is my source scene, files, and export results:

Exporters_682_repro.zip

AndresCH10 commented 4 years ago

This is my max 2019 scene. The scene you sent me, I could not open it due to the max version.

"[Model3D]"(Scene).zip](https://github.com/BabylonJS/Exporters/files/3840277/Model3D.Scene.zip)

Drigax commented 4 years ago

Sorry, I used Max 2020 to create the testbench. I'll try to recreate it in Max 2019 as well. I'll take a look at this as soon as I get to my dev machine.

Drigax commented 4 years ago

Looking at the scene, I'm not sure if I'm seeing the issue here.

image

You're using a Standard Blinn material for the mesh, the texture 2019-11-12-PlantaCarnivoraTexture.png is a PNG without an alpha channel, and we have the Alpha Source set to None (Opaque).

I reinstalled the latest exporter v20191113.4 to test on 3dsMax 2019. image

I exported the scene using these settings, and the output looks...normal?

image

@AndresCH10 Can you please confirm that you're using the latest exporter, and have the texture configured with Alpha Source = Opaque?

Drigax commented 4 years ago

Ok, revised my test scene to isolate what I think we're trying to do here:

We have 4 permutations, all using the same transparent UV checkerboard with alpha channel gradient: Physical Material with transparent base color PNG with AlphaSource = Opaque Standard Material with transparent diffuse color PNG with AlphaSource = Opaque Physical Material with transparent base color PNG with AlphaSource = ImageAlpha Standard Material with transparent diffuse color PNG with AlphaSource = ImageAlpha

When exported, both materials with opaque set textures will make the material be exported with Alpha Mode Opaque, and the materials with Image alpha set textures will be exported as Alpha Mode Blend:

image

Otherwise if the material is exported improperly we we should see it: image

Here's the source: TestAlphaSourceOpaque.zip

Drigax commented 4 years ago

@AndresCH10 and @vpenades, are you still having issues with material transparency settings?

vpenades commented 4 years ago

@Drigax yes, the main problem is that both @AndresCH10 and me are working remotely and working with different versions of Max (2019 and 2020) so we're having lots of issues on our own figuring out what's wrong with the scene.

Next week we will do additinal tests to see if we're able to create a proof of concept simple enough to verify the issue.

Drigax commented 4 years ago

Sounds good. feel free to reach out if you need any help 🙂

Drigax commented 4 years ago

I'm going to close this issue as "unable to reproduce" but if anyone can help provide a consistent repro, I'll be happy to reopen this

vpenades commented 4 years ago

Sorry, we're having lots of issues on our own with 3DSMax, so we're not sure if the problem is on our side or in the exporter.