CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.71k stars 307 forks source link

Consider adding flag for KHR_materials_common #52

Closed donmccurdy closed 7 years ago

donmccurdy commented 7 years ago

Similar to -k in COLLADA2GLTF, which an upcoming PR may rename to -m.

Some A-Frame users have been surprised when lighting/shadows do not work, and three.js has a bug (fixed but not yet released) with glTF custom shaders used in VREffect, so the common materials are preferable in several cases.

lilleyse commented 7 years ago

In a bit of a roundabout way this is supported in https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/49 with the --bypassPipeline flag. obj2gltf works with HKR_materials_common by default, but then sends it through gltf-pipeline to create techniques/shaders. This can be bypassed with that flag.

An explicit option for this seems like a good idea though.

lilleyse commented 7 years ago

A --kmc flag is added in https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/49 with a few caveats right now that would need fixing in gltf-pipeline:

gltf-pipeline uses the same kmc options for each material and doesn't recognize the transparent flag

donmccurdy commented 7 years ago

The new flag looks good, thanks!

lilleyse commented 7 years ago

Another comment from the code to add here and keep track of:

It's not completely clear whether transparent and doubleSided belong under values or KHR_materials_common Put under both for now to handle both situations. https://github.com/KhronosGroup/glTF/tree/master/extensions/Khronos/KHR_materials_common https://github.com/KhronosGroup/glTF/issues/632

lilleyse commented 7 years ago

Now in master with the --materialsCommon flag.