Git Product home page Git Product logo

obj2gltf's Issues

Conversion Always Missing One Box.

draw some boxes in 3ds max 2015,for example,draw six boxes and export as an OBJ file as show below. Then, use the obj2gltf tool to convert this OBJ file to binary gltf and load it in Cesium, as show below, there is always one box missing! Only five boxes instead of six box are in the scene. I have tried other cases like five or seven boxes, after the conversion, always one box was gone.

sixbox_3dsmax2015
fivebox_cesium

Conversion error (after >1 hour of converting)

Here is what I'm trying to convert: https://dl.dropboxusercontent.com/u/705999/Paris.zip

Command I ran
node node_modules/obj2gltf/bin/obj2gltf.js "Paris2010_0.obj" model.gltf -s

After seemingly stuck converting, I decided to let it run for the rest of the day. After about 1.5 hours or so, a js error finally came up:

    { Error
        at new DeveloperError (c:\Users\Flux\Documents\assetdev\Paris\node_modules\cesium\Source\Core\DeveloperError.js:44:19)
        at Object.Tipsify.tipsify (c:\Users\Flux\Documents\assetdev\Paris\node_modules\cesium\Source\Core\Tipsify.js:189:19)
        at Object.GeometryPipeline.reorderForPostVertexCache (c:\Users\Flux\Documents\assetdev\Paris\node_modules\cesium\Source\Core\GeometryPipeline.js:433:40)
        at optimizeForVertexCache (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\lib\optimizeForVertexCache.js:93:38)
        at Function.Pipeline.processJSONWithExtras (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\lib\Pipeline.js:95:5)
        at c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\lib\Pipeline.js:177:29
        at tryCatcher (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\util.js:16:23)
        at Promise._settlePromiseFromHandler (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:504:31)
        at Promise._settlePromise (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:561:18)
        at Promise._settlePromise0 (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:606:10)
        at Promise._settlePromises (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:685:18)
        at Promise._fulfill (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:630:18)
        at Promise._resolveCallback (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:425:57)
        at Promise._settlePromiseFromHandler (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:516:17)
        at Promise._settlePromise (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:561:18)
        at Promise._settlePromise0 (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:606:10)
        at Promise._settlePromises (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:685:18)
        at Promise._fulfill (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:630:18)
        at PromiseArray._resolve (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise_array.js:125:19)
        at PromiseArray._promiseFulfilled (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise_array.js:143:14)
        at Promise._settlePromise (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:566:26)
        at Promise._settlePromise0 (c:\Users\Flux\Documents\assetdev\Paris\node_modules\gltf-pipeline\node_modules\bluebird\js\release\promise.js:606:10)
      name: 'DeveloperError',
      message: 'indices length must be a multiple of three.',
      stack: 'Error\n    at new DeveloperError (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\cesium\\Source\\Core\\DeveloperError.js:44:19)\n    at Object.Tipsify.tipsify (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\cesium\\Source\\Core\\Tipsify.js:189:19)\n    at Object.GeometryPipeline.reorderForPostVertexCache (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\cesium\\Source\\Core\\GeometryPipeline.js:433:40)\n    at optimizeForVertexCache (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\lib\\optimizeForVertexCache.js:93:38)\n    at Function.Pipeline.processJSONWithExtras (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\lib\\Pipeline.js:95:5)\n    at c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\lib\\Pipeline.js:177:29\n    at tryCatcher (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\util.js:16:23)\n    at Promise._settlePromiseFromHandler (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:504:31)\n    at Promise._settlePromise (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:561:18)\n    at Promise._settlePromise0 (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:606:10)\n    at Promise._settlePromises (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:685:18)\n    at Promise._fulfill (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:630:18)\n    at Promise._resolveCallback (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:425:57)\n    at Promise._settlePromiseFromHandler (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:516:17)\n    at Promise._settlePromise (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:561:18)\n    at Promise._settlePromise0 (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:606:10)\n    at Promise._settlePromises (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:685:18)\n    at Promise._fulfill (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:630:18)\n    at PromiseArray._resolve (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise_array.js:125:19)\n    at PromiseArray._promiseFulfilled (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise_array.js:143:14)\n    at Promise._settlePromise (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:566:26)\n    at Promise._settlePromise0 (c:\\Users\\Flux\\Documents\\assetdev\\Paris\\node_modules\\gltf-pipeline\\node_modules\\bluebird\\js\\release\\promise.js:606:10)' }

Any ideas on what could be going wrong? It's not that big of an obj (around 40 mb with 30 mb of textures).

gltf are always black and no texture.

success from obj to gltf. But gltf are always black and no texture.
How to check texture coordinate problem and how to solve it.
(some friends said my gltf's Normal coordinate are wrong )

Node string limitations

Buffers larger than ~192MB cannot be base64 encoded due to a NodeJS limitation. nodejs/node#4266

It would be good to get around this. In most cases however using the --separate flag is the way go.

Consider replacing period usage in command line parameters

I noticed we have periods in our cmd arguments, for example --ao.enable. It's standard to use a hyphen to separate words, I've never seen periods used like this: --ao-enable. Hyphens are standard enough that yargs automatically duplicated this to aoEnable on the parsed object to make it easily indexable from JavaScript without having string literals everywhere.

Slow Conversion Time

I'm not sure if this is really an issue, but it took 163 minutes to convert a 25mb .obj. Is this normal?

[piero@acer texturing]$ time node test.js
Converted model

real 163m7.272s
user 163m47.696s
sys 0m1.987s

I used this code to convert:

var obj2gltf = require('obj2gltf');
var convert = obj2gltf.convert;
var options = {
	    embedImage : true // Don't embed image in the converted glTF
}
convert('odm_textured_model_geo.obj', 'model.gltf', options)
    .then(function() {
	            console.log('Converted model');
	        });

There were some ~30mb of textures embedded.

Is there a way to speed things up?

Saves two bin files when separate flag is used

The first is written by obj2gltf prior to sending to gltf-pipeline, and the second is written by gltf-pipeline. This can be solved by removing the first bin file after passing along to gltf-pipeline, or changing gltf-pipeline to use the same naming scheme for separate buffers.

Blender OBJ

How to export OBJ file from Blender to keep meshes separated. If I use OBJ2GLTF -e all meshes will be combined using only one material.

node bin/obj2gltf.js test.obj -e

Thanks for help!
Peter

npm install failed

D:\workspace>npm install --save obj2gltf
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "D:\\app\\nodejs\\node.exe" "D:\\app\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "obj2gltf"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10

npm ERR! shasum check failed for C:\Users\bugki\AppData\Local\Temp\npm-11172-df6ce304\registry.npmjs.org\cesium\-\cesium-1.33.0.tgz
npm ERR! Expected: c2471be888dad49a45d47a28cd8c2742eccc34ef
npm ERR! Actual:   1e0a0de7817d955da39ae12cea62cd755325a813
npm ERR! From:     https://registry.npmjs.org/cesium/-/cesium-1.33.0.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     D:\workspace\npm-debug.log

Consider adding flag for KHR_materials_common

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.

Remove git dependancy in package.json

  1. We should never use a git dependancy without a specific hash appended to it, otherwise you end up just using whatever is in master wen you npm install.
  2. We should never merge a package.json with git references to master. Package in master should either be published npm modules or git submodules.

Crash when flag bypassPipeline is used

I'm getting this output when using bypassPipeline.

node ~/lib/obj2gltf/bin/obj2gltf.js -i box.obj -o sample.glb -b --bypassPipeline

~/node_modules/cesium/Source/ThirdParty/crunch.js:43
    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=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"]
Error
    at new DeveloperError (~/node_modules/cesium/Source/Core/DeveloperError.js:44:19)
    at obj2gltf (~/lib/obj2gltf/lib/obj2gltf.js:88:15)
    at Object.<anonymous> (~/lib/obj2gltf/bin/obj2gltf.js:141:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

I tried both with 1.1.1 and master branch as of today. cesium version is 1.32.1

UV's are discarded if no material is referenced in .obj

As an addendum to #32, I've found that obj2gltf (via gltf-pipeline) is discarding my UV's (vt data from .obj), this was why I was struggling to get glTF to render in three.js - I thought the issue was confusion over default materials loaded from the glTF but really it just didn't have an texture coordinates so materials were appearing as solid colour instead of textured. Example source .obj and output gltf attached. I need an option to preserve that information as I am texture mapping based on user choices in the browser.

body-top.zip

Not working when used as a library inside an existing Node.js app

I have a project that generates models using OpenDroneMap, and I'm trying to convert those .obj models to be viewable on the web. I can view the .obj models using meshlab without any issues. When I try to use obj2gltf to convert them as part of my workflow inside of a Node.js app, it does nothing. I never get any response from the promise (no success, no error), and no console output. It just hangs. I left it running for about 20 minutes to see if it was just taking a really long time, but finally killed it when nothing happened.

My code looks like this:

var filePrefix = __dirname + "/" + rootDirName + "/" + currentDocument.id + '/odm_texturing/odm_textured_model_geo';
var options = {
    embedImage : false // Don't embed image in the converted glTF
}
var objFile = filePrefix +'.obj';
var gltfFile = filePrefix +'.gltf';
console.log(objFile);
console.log(gltfFile);

convert(objFile, gltfFile, options)
    .then(function() {
        console.log('Converted model');
        callback();
    })
    .catch(function(err){
        console.log("ERROR:" + err.toString());
        callback(err);
    });

My output only shows the file names, nothing else:

/root/analysis-baremetal/temp/6f5ddb39312feefc5e37bad7baf71cdd/odm_texturing/odm_textured_model_geo.obj
/root/analysis-baremetal/temp/6f5ddb39312feefc5e37bad7baf71cdd/odm_texturing/odm_textured_model_geo.gltf

I assume this is just failing silently - there are no other indications of an error, and no stack trace. The .obj file is about 25 MB, which isn't tiny, but again, it also is not huge so I wouldn't expect it to take this long.

Windows line endings break #! parsing on Linux

Although the git repo has unix-style line endings, the version of obj2gltf on npm has Windows line endings. When running the command line tool the extra \r confuses the Linux #! parser:

$ lsb_release -d
Description:    Ubuntu 16.04.1 LTS

$ npm install -g obj2gltf
[...]

$ obj2gltf
/usr/bin/env: ‘node\r’: No such file or directory

$ dos2unix ~/.local/node/lib/node_modules/obj2gltf/bin/obj2gltf.js
dos2unix: converting file /home/josh/.local/node/lib/node_modules/obj2gltf/bin/obj2gltf.js to Unix format ...

$ obj2gltf
Usage: ./bin/obj2gltf.js [INPUT] [OPTIONS]
[...]

convert issue

I try to convert some files from obj to gltf.prompt "[TypeError: Object has no method 'fill']" . Looks like the tool has a problem. All steps use npm install. How can i fix it?

conversion error "Cannot read property 'buffers' of undefined"

I am getting the following error:

Unhandled rejection TypeError: Cannot read property 'buffers' of undefined
at loadURI (node_modules/obj2gltf/node_modules/gltf-pipeline/lib/loadGltfUris.js:47:23)
at loadGltfUris (node_modules/obj2gltf/node_modules/gltf-pipeline/lib/loadGltfUris.js:35:9)
at Function.Pipeline.processJSONToDisk (node_modules/obj2gltf/node_modules/gltf-pipeline/lib/Pipeline.js:192:12)

Is this a problem with my OBJ file?

Thanks!

What texture formats are currently supported?

I couldn't find what texture formats are currently supported for input files. We should update the README with an exact list.

It would be nice if we could auto-convert textures to glTF friendly formats, perhaps via imagemagick or whatever node-friendly libraries are available.

Texture coordinates are flipped vertically

This has already been mentioned in #6 . The recommendation there was to flip the input image vertically. But this seems to be a dubious workaround.

Attached is a file that contains the Duck, as an OBJ. This OBJ is displayed properly in http://www.open3mod.com/ and http://meshlab.sourceforge.net/ . Converting it with OBJ2GLTF results in the second attached file (where I only fixed CesiumGS/gltf-pipeline#114 in the shader manually). In this glTF, the texture coordinates are flipped vertically. (I only checked this with my own glTF viewer, but it properly displays Duck model from the glTF samples, so something must be wrong with the converted one...)

DuckObj.zip
DuckGltf.zip

Add support for Nodes

It seems that currently the obj2gltf conversion does not include the transforms / pivots / matrices of the obj file. Adding this would make this tool a whole lot more useful.

obj2gltf convert error

convert error:mime must be a string , what this mean :

E:\work\obj2gltf-master\bin>node obj2gltf.js -i gugong/gugong.obj -o gugong/gugong.gltf -s
Error: mime must be a string
at Jimp.throwError (E:\work\obj2gltf-master\node_modules\jimp\index.js:82:43)
at new Jimp (E:\work\obj2gltf-master\node_modules\jimp\index.js:212:31)
at E:\work\obj2gltf-master\node_modules\jimp\index.js:237:23
at Function.Jimp.read (E:\work\obj2gltf-master\node_modules\jimp\index.js:229:19)
at generateJimpImage (E:\work\obj2gltf-master\node_modules\gltf-pipeline\lib\loadGltfUris.js:151:17)
at loadURI (E:\work\obj2gltf-master\node_modules\gltf-pipeline\lib\loadGltfUris.js:79:39)
at loadGltfUris (E:\work\obj2gltf-master\node_modules\gltf-pipeline\lib\loadGltfUris.js:36:9)
at Function.Pipeline.processJSONToDisk (E:\work\obj2gltf-master\node_modules\gltf-pipeline\lib\Pipeline.js:192:12)
at E:\work\obj2gltf-master\lib\convert.js:58:33
at tryCatcher (E:\work\obj2gltf-master\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (E:\work\obj2gltf-master\node_modules\bluebird\js\release\promise.js:510:31)
at Promise._settlePromise (E:\work\obj2gltf-master\node_modules\bluebird\js\release\promise.js:567:18)
at Promise._settlePromise0 (E:\work\obj2gltf-master\node_modules\bluebird\js\release\promise.js:612:10)
at Promise._settlePromises (E:\work\obj2gltf-master\node_modules\bluebird\js\release\promise.js:691:18)
at Async._drainQueue (E:\work\obj2gltf-master\node_modules\bluebird\js\release\async.js:133:16)
at Async._drainQueues (E:\work\obj2gltf-master\node_modules\bluebird\js\release\async.js:143:10)

Freezing with any command line

Hello! I'm trying to use the tool to convert some 3D objects to GLTF, but I must be doing something wrong, as any command line I try the tool just shows an empty line and freezes until I hit Ctrl C. I installed the tool using the

npm install --save obj2gltf

command line from the instructions.
From there I proceeded to go to the obj2gltf folder inside the "node_modules" folder and, from there, run some command lines, but with all of the the tool just freezes. Even a simple

node bin\obj2gltf.js -h

doesn't work, which is why I think I must be doing something wrong... I'm new to Node.js, so please excuse me if I'm doing something obviously wrong...

Thanks for any help!

OBJ2GLTF can't handle with Tile_+000_+000_0.dds

I have one group file (
Tile_+000_+000_0.obj
Tile_+000_+000_0.mtl ------------(link Tile_+000_+000_0.dds )
Tile_+000_+000_0.dds) .

These files are from osgconv (osgb --> obj)

I don't find any error :\OBJ2GLTF>node bin/obj2gltf.js -i testobj/obj/Tile_+000_+000.obj -o testobj/o
/Tile_+000_+000.gltf -e
otal: 391ms.

But this gltf can't run in ceseam.js (
Error is "images": {
"Tile_+000_+000_0": {
"uri": "data:application/octet-stream;base64,RERTIHwAAAAHEAoAAAE

ThreeJS GLTF Loader Fails

Hello! I'm trying to load in a GLTF file converted from obj with Three.JS, however it complains when it tries to unpack the buffer that holds the geometry.
screen shot 2016-06-23 at 5 51 41 pm
screen shot 2016-06-23 at 5 55 07 pm

The componentType seems to not match any of the builtin ones (such as WebGLRenderingContext.FLOAT, etc)

Would appreciate any guidance/help.

Cannot read property 'isTTY' of undefined

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node bin/obj2gltf.js ../obj/test5.obj ../obj/test5.gltf

readline.js:74
    terminal = !!output.isTTY;
                       ^
TypeError: Cannot read property 'isTTY' of undefined
    at new Interface (readline.js:74:24)
    at Object.exports.createInterface (readline.js:40:10)
    at getObjInfo (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/obj.js:310:27)
    at parseObj (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/obj.js:17:5)
    at convert (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/convert.js:36:5)
    at Object.<anonymous> (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/bin/obj2gltf.js:35:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

conversion error

I've installed obj2gltf v0.1.7 using npm install -g obj2gltf.
My node version is v7.5.0.
When I try to convert my file wall_and_door.obj, which you can find at https://github.com/andyli/aframe-test/tree/1fe0f0cc8af332b9a8c7880437a8678e99e3b6e2/wall_and_door, there is an error:

D:\andy\workspace\VRWorkshop\wall_and_door>obj2gltf wall_and_door.obj

C:\ProgramData\nvm\v7.5.0\node_modules\obj2gltf\node_modules\cesium\Source\ThirdParty\crunch.js:43
    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=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=no
Error
    at new DeveloperError (C:\ProgramData\nvm\v7.5.0\node_modules\obj2gltf\node_modules\cesium\Source\Core\DeveloperError.js:44:19)
    at Function.Cartesian3.normalize (C:\ProgramData\nvm\v7.5.0\node_modules\obj2gltf\node_modules\cesium\Source\Core\Cartesian3.js:422:19)
    at LineStream.<anonymous> (C:\ProgramData\nvm\v7.5.0\node_modules\obj2gltf\lib\obj.js:192:41)
    at emitOne (events.js:96:13)
    at LineStream.emit (events.js:189:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at LineStream.Readable.push (_stream_readable.js:134:10)
    at LineStream.Transform.push (_stream_transform.js:128:32)
    at LineStream._pushBuffer (C:\ProgramData\nvm\v7.5.0\node_modules\obj2gltf\node_modules\byline\lib\byline.js:126:17)
    at LineStream._transform (C:\ProgramData\nvm\v7.5.0\node_modules\obj2gltf\node_modules\byline\lib\byline.js:117:8)
    at LineStream.Transform._read (_stream_transform.js:167:10)
    at LineStream.Transform._write (_stream_transform.js:155:12)
    at doWrite (_stream_writable.js:329:12)
    at writeOrBuffer (_stream_writable.js:315:5)
    at LineStream.Writable.write (_stream_writable.js:241:11)
    at ReadStream.ondata (_stream_readable.js:555:20)

Ability to find external files and textures

I have models where the obj paths are incorrect or absolute but the files themselves are all there and located in the same directory as the obj file. It would be great if we either:

  • Always looked in the same directory as the obj file if the initial texture/mtl/etc.. isn't where the model says it should be.

or

  • Allowed an array of directories to be passed to the converter and it would search those directories for the file is not found in the obj specified location.

The first one is probably easier and I'm fine with that until we have a good use case for the more robust feature.

ability to change up axis

A lot of models going through obj2gltf right now come out sideways, since gltf assumes a Y-up axis.
Does obj assume anything? Otherwise, should we add a flag for changing the up axis, along with some notes?

As observed by @mramato, it's probably also better to bake this transformation straight into the geometry by flipping components of vertices rather than slap a rotation quaternion onto the gltf scenegraph.

help:my obj isn't converted correctly

Inconsistency error: this asset probably refers to invalid image Ids within

warning:
PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile PNG lib warning : iCCP: known incorrect sRGB profile

too much error

\OBJ2GLTF\node_modules\gltf-pipeline\lib\findAccessorMinMax.js:17
var min = new Array(numberOfComponents).fill(Number.POSITIVE_INFINITY);
^
peError: Object has no method 'fill'
at findAccessorMinMax (C:\OBJ2GLTF\node_modules\gltf-pipeline\lib\findAccess
MinMax.js:17:45)
at accessorDefaults (C:\OBJ2GLTF\node_modules\gltf-pipeline\lib\addDefaults.
:24:30)
at addDefaults (C:\OBJ2GLTF\node_modules\gltf-pipeline\lib\addDefaults.js:56
5)
at processJSONWithExtras (C:\OBJ2GLTF\node_modules\gltf-pipeline\lib\gltfPip
ine.js:62:5)
at C:\OBJ2GLTF\node_modules\gltf-pipeline\lib\gltfPipeline.js:145:9
at C:\OBJ2GLTF\node_modules\gltf-pipeline\lib\loadGltfUris.js:36:9
at C:\OBJ2GLTF\node_modules\async\lib\async.js:52:16
at done (C:\OBJ2GLTF\node_modules\async\lib\async.js:246:17)
at C:\OBJ2GLTF\node_modules\async\lib\async.js:4

Problem with missing dependencies

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node bin/obj2gltf.js ../obj/test5.obj ../obj/test5.gltf

module.js:340
    throw err;
          ^
Error: Cannot find module 'Cesium'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/bin/obj2gltf.js:4:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

So, I tried to install Cesium, but that failed:

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> npm install Cesium        
npm http GET https://registry.npmjs.org/Cesium
npm http 404 https://registry.npmjs.org/Cesium
npm ERR! TypeError: Cannot read property 'latest' of undefined
npm ERR!     at next (/usr/lib/node_modules/npm/lib/cache.js:687:35)
npm ERR!     at /usr/lib/node_modules/npm/lib/cache.js:675:5
npm ERR!     at saved (/usr/lib/node_modules/npm-registry-client/lib/get.js:148:7)
npm ERR!     at /usr/lib/node_modules/graceful-fs/polyfills.js:133:7
npm ERR!     at Object.oncomplete (fs.js:108:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Linux 3.10.0-327.13.1.el7.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "Cesium"
npm ERR! cwd /melkor/d1/guenther/projects/threejs/OBJ2GLTF
npm ERR! node -v v0.10.42
npm ERR! npm -v 1.3.6
npm ERR! type non_object_property_load
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /melkor/d1/guenther/projects/threejs/OBJ2GLTF/npm-debug.log
npm ERR! not ok code 0

Converted models are washed out by ambient settings

We've discussed this offline, but I couldn't find an issue for it. I've come across quite a few obj files with their ambient values set to 1.0 1.0 1.0, which looks like we translate into additive values in the glTF when they were intended as multiplicative values. The end result is a model with washed out textures.

I believe @lilleyse suggested we keep using additive but discarding "full-white" values of 1.0 1.0 1.0.

I tried to find a clear answer in the obj/mtl spec, but it wasn't very helpful.

These same obj models load fine in Three.js without being washed out, so it's also either ignoring the values or always treating them as multiplicative.

CC @lilleyse @likangning93

Implement feature to export geometry only

Currently when I use this tool to convert a .obj (geometry only export from Rhino3D) it introduces default materials and shaders. I'm assuming it does this so that the model will show up in a simple glTF viewer. I'm using glTF as a model format and then applying materials and shader (in three.js) programatically.

Could we/should we have an option to export a .gltf with only geometry/nodes/meshes (discarding shaders and materials)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.