CesiumGS / obj2gltf

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

3D model turn black after conversion into gltf/glb #134

Open fzlavr opened 6 years ago

fzlavr commented 6 years ago

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 commented 6 years ago

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

lilleyse commented 6 years ago

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.

CrashedBboy commented 6 years ago

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?

lilleyse commented 6 years ago

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.

miguelfernandesidesign commented 2 years ago

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

Thank you