google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

How to export metallic/roughness textured assets from 3dsmax to sceneform #152

Closed EugenioMiolo closed 6 years ago

EugenioMiolo commented 6 years ago

Hi there,

What is the proper way to export an asset from 3dsmax with metallic/roughness maps to sceneform? I've attached an example .max file that I wish to get into sceneform, with the Specular map as Metallic, and Glossiness map as Roughness.

Here's a image from Sketchfab of how it should look like. image

Thanks in advance, Eugenio

Checker.zip

gstanlo commented 6 years ago

We would recommend trying to export it as FBX or glTF/2.0.

EugenioMiolo commented 6 years ago

Thanks for the answer @gstanlo,

Unfortunately it's not that simple. Have you tried to export this cube above in FBX/glTF and got metallic/roughness maps carried over to sceneform correctly?

Since there's no PBR material in 3dsmax, which one should I use to export the FBX? With a Standard material, where should I plug the Metallic and Roughness maps?

I was trying with my Metallic map in the Specular Color map, and Roughness in the Glossiness map. But after banging my head on the wall like hell for getting a lot of "Duplicate field name: BaseColor" errors, I found out that the .sfb converter can only read the textures on 3 channels from the 3dsmax Standard material: Diffuse, Specular Color map, and Reflection Map. Put a texture anywhere else and it will try to use it as BaseColor, therefore if you already have one there, it will throw you an error. So in the end I used the Metallic map in the Specular Color and Roughness in the Reflection slots in the 3dsmax Standard material.

This will avoid errors on the conversion, but will not do what I want, which is to have textures properly applied as metallic and roughness after the conversion. For that I had to edit the .sfm to remap the properties to their proper places.

Regards, -Eugenio

AdrianAtGoogle commented 6 years ago

Hi @EugenioMiolo, thanks for submitting this issue. You're correct, the default material setup in 3dsmax does not support PBR; however, we support stingray materials. A 3dsmax asset with a stingray PBR material exported to FBX should correctly import into sceneform.

EugenioMiolo commented 6 years ago

HI @AdrianAtGoogle,

Maybe I did something wrong, but I've tested exporting with a Stingray (a.k.a Interactive) material from 3dsmax and it didn't work. The converter gives me an error. IIRC, the docs only mention support for Stingray for Maya. I suppose it's because the way to setup a stingray material is different on them. In 3dsmax we have to plug into a DirectX material , while in Maya you have full Stingray PBS material.

You could give it a try with the cube above. But again, it didn't work for me.

Kind regards, Eugenio

AdrianAtGoogle commented 6 years ago

Hi @EugenioMiolo, thanks for the clarification; what you describe definitely sounds like a bug.

Could I trouble you to export+upload the Checker.max file in your zip as an FBX? I don't have a seat of 3dsmax available.

EugenioMiolo commented 6 years ago

Sorry for the very late reply @AdrianAtGoogle, I was involved in other projects and completely forgot about this.

I've attached the cube above exported as an ASCII FBX with embedded textures. It's using the DirectX Shader set to Interactive. Here's a screenshot of the shader in 3dsmax: stingray_material

Cube.zip Kind regards, Eugenio

AdrianAtGoogle commented 6 years ago

Thanks @EugenioMiolo I'll follow up when I know more

AdrianAtGoogle commented 6 years ago

Hi @EugenioMiolo - Thank you for uploading the export.

Investigation yielded a few issues on our end to be fixed in an upcoming release. After addressing them I was able to perform a default import of your asset; here is a screenshot you'll be able to reproduce once the fixes go out: image

EugenioMiolo commented 6 years ago

Looks great @AdrianAtGoogle ! Thanks a lot! And btw, if I use a .png with alpha channel as base color, will that work as transparency as expected?

AdrianAtGoogle commented 6 years ago

Hi @EugenioMiolo - this issue should be fixed in the 1.4 release; base color alpha should control transparency as expected.