KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.5k stars 319 forks source link

Export Diffuse BSDF materials #1488

Closed eugeneko closed 2 years ago

eugeneko commented 3 years ago

Is your feature request related to a problem? Please describe. I am not an artist, I am only exporting existing models into the engine. And I find it mildly frustrating that Diffuse BSDF materials used by certain artist are always exported as gray into glTF.

Describe the solution you'd like I don't see any fundamental issues that prevent Blender from exporting Diffuse BSDF material as PBR material with roughness=1. Yes, we kind of lose Diffuse BSDF roughness, but it's still 100 times better than losing everything.

Moreover, I can hack the desired behavior with only a couple of lines of code:

I am not qualified enough to make proper fix and send it as PR, but I don't think it would be too hard.

Is there any reason why Diffuse BSDF should not be supported in this way?

Additional context How it works after my hack: image

JaduBen commented 2 years ago

I'm also not getting textures on BSDF materials (other than Pricipaled). So I am unable to use transparent or metallic. There is a very bad workaround of exporting a gtlf and manually editing the material in the json

add
"baseColorTexture" : { "index" : 0 }
inside
"pbrMetallicRoughness" : {}
donmccurdy commented 2 years ago

I'm also not getting textures on BSDF materials (other than Pricipaled). So I am unable to use transparent or metallic.

I'm not sure that I follow you here – the Principled BSDF supports metallic factors and textures, and several different types of transparency. Alpha Blending and Transmission transparencies can be exported to glTF. See: https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html


Is there any reason why Diffuse BSDF should not be supported in this way?

From the Principled BSDF documentation, the Principled BSDF material has an "emphasis on compatibility with other software" that Blender's other materials do not, and it's (thankfully) a very good match for the PBR materials in glTF 2.0. We could try to approximate other shading models, but there the materials would not look the same and we'd receive bugs regularly about that, all of which takes time to debug and to answer.

My own preference would be to continue to focus on the Principled BSDF material – there's still plenty of work to do on that (like https://github.com/KhronosGroup/glTF-Blender-IO/issues/1454) and rarely enough time to do it. But I'd be curious what others prefer, and open to the idea if someone is interested in adding and maintaining that addition.

JaduBen commented 2 years ago

Thank you, I was finally able to get adequate results on my object using the Principled BSDF

julienduroure commented 2 years ago

So, seems there is no more issue here. Closing this ticket. Don't hesitate to comment if needed