obj2gltf icon indicating copy to clipboard operation
obj2gltf copied to clipboard

3D model turn black after conversion into gltf/glb

Open fzlavr opened this issue 8 years ago • 5 comments

Hi, i have a problem in conversion into gltf and glb. i have put all the material (.obj , .mtl , .jpg) into one folder then i convert it with basic command like this obj2gltf -i model.obj -o model.gltf But, the result is like this https://imgur.com/oH5nueG all side of the object turn into black and seems like the texture and color are not convert well.. is there anything that i miss when converting ?

FYI, this is my files which i want to convert.. https://imgur.com/9zzlG4g

fzlavr avatar Mar 14 '18 06:03 fzlavr

it solved.. my model has the texture and its color.. i should put --materialsCommon after the model name of gltf. So, it should be like this obj2gltf -i model.obj -o model.gltf --materialsCommon

fzlavr avatar Mar 14 '18 07:03 fzlavr

Good that you solved it. Eventually we will add support for unlit materials https://github.com/AnalyticalGraphicsInc/obj2gltf/issues/130, so in the future you might be using --unlit instead of --materialsCommon.

lilleyse avatar Mar 14 '18 14:03 lilleyse

Hi @fzlavr and @lilleyse ,

I've checked the option --materialsCommon's description out:

The glTF will be saved with the KHR_materials_common extension.

Why the missing of texture is related to this option? So, every model with texture should be converted with this option in order to keep the texture?

CrashedBboy avatar Apr 30 '18 06:04 CrashedBboy

The --materialsCommon option isn't required. The main issue was a Cesium bug where models without normals would get rendered as black. That was recently fixed in https://github.com/AnalyticalGraphicsInc/cesium/pull/6501.

So try without --materialsCommon and load the model in Cesium master, it should render correctly now.

lilleyse avatar Apr 30 '18 15:04 lilleyse

Hello, I'm facing the same problem. Which program are using to convert?

Thank you

miguelfernandesidesign avatar Jan 25 '22 10:01 miguelfernandesidesign