CesiumGS / obj2gltf

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

failure of transfer obj to gltf #119

Closed kpeng2016 closed 6 years ago

kpeng2016 commented 6 years ago

I try some way to transfer obj to gltf, but it give me the error as below. I tried to put my obj model under "F:\obj2gltf\" or "F:\obj2gltf\node_modules\obj2gltf\", to run the command, but failed. Is there anyone can help me to solve this issue? thanks a lot! F:\Project\Public\obj2gltf\node_modules\obj2gltf>node bin\obj2gltf.js -i model.obj -o model.gltf

F:\Project\Public\obj2gltf\node_modules\_cesium@1.40.0@cesium\Source\ThirdParty\crunch.js:32
var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT
Error
    at new DeveloperError (F:\Project\Public\obj2gltf\node_modules\_cesium@1.40.0@cesium\Source\Core\DeveloperError.js:43:19)
    at Object.Check.typeOf.object (F:\Project\Public\obj2gltf\node_modules\_cesium@1.40.0@cesium\Source\Core\Check.js:150:19)
    at Function.Cartesian2.subtract (F:\Project\Public\obj2gltf\node_modules\_cesium@1.40.0@cesium\Source\Core\Cartesian2.js:480:22)
    at getTurnDirection (F:\Project\Public\obj2gltf\node_modules\_obj2gltf@2.0.0@obj2gltf\lib\loadObj.js:324:34)
    at isConvex (F:\Project\Public\obj2gltf\node_modules\_obj2gltf@2.0.0@obj2gltf\lib\loadObj.js:330:29)
    at addFace (F:\Project\Public\obj2gltf\node_modules\_obj2gltf@2.0.0@obj2gltf\lib\loadObj.js:403:17)
    at Interface.parseLine (F:\Project\Public\obj2gltf\node_modules\_obj2gltf@2.0.0@obj2gltf\lib\loadObj.js:468:17)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:238:10)
    at Interface._normalWrite (readline.js:375:12)
    at ReadStream.ondata (readline.js:98:10)
    at emitOne (events.js:96:13)
    at ReadStream.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at ReadStream.Readable.push (_stream_readable.js:136:10)
lilleyse commented 6 years ago

@kpeng2016 can you upload the model?

Does running the converter on one of the test models work?

node bin/obj2gltf.js -i specs/data/box/box.obj -o box.gltf

kpeng2016 commented 6 years ago

@lilleyse Hi thanks a lot, yes, it worked when I try your suggestion. but I try to use another tool COLLADA2GLTF ( I convert my model from .rvt to dae) to convert my model it worked. even it does not show properly in cesiumjs. would you please get my model file substation.dae here to check what's the matter? Thank you very much!!!

lilleyse commented 6 years ago

Thanks for sending over the model - I submitted a fix here: https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/120.

Here it is in Cesium (without materials):

substation