Comments (9)
Hi, I made some changes to the file reader, can you run the latest code and tell me if it works for you?
from obj2gltf.
Now I get
melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node bin/obj2gltf.js ../obj/test5.obj ../obj/test5.gltf
buffer.js:803
this.parent.writeFloatLE(value, this.offset + offset, !!noAssert);
^
TypeError: value not a number
at Buffer.writeFloatLE (buffer.js:803:15)
at createGltf (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/gltf.js:69:16)
at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/convert.js:37:9
at LineStream.<anonymous> (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/obj.js:224:9)
at LineStream.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:448:13)
from obj2gltf.
I've tried a different OBJ file and found this:
/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17
var min = new Array(numberOfComponents).fill(Number.POSITIVE_INFINITY);
^
TypeError: Object has no method 'fill'
at findAccessorMinMax (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17:45)
at accessorDefaults (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/addDefaults.js:24:30)
at addDefaults (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/addDefaults.js:561:5)
at processJSONWithExtras (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/gltfPipeline.js:57:5)
at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/gltfPipeline.js:115:9
at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/loadGltfUris.js:36:9
at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:52:16
at done (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:246:17)
at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:44:16
at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/loadGltfUris.js:119:17
I'll past the OBJ file here so you can try it out yourself:
mtllib /melkor/d1/guenther/projects/threejs/obj/test3.mtl
v 10 10 10
v 20 20 20
v 0 0 0
v 0 -51.2692 269.668
g grp1
usemtl mtl1
l 1 2 3 4
f 1
f 2
f 3
f 4
from obj2gltf.
Thank you so much for your quick responses!
from obj2gltf.
For the example you posted we don't support line segments like l 1 2 3 4
right now. Rearranging your example a bit works, but it may not be exactly what you want:
mtllib /melkor/d1/guenther/projects/threejs/obj/test3.mtl
v 10 10 10
v 20 20 20
v 0 0 0
v 0 -51.2692 269.668
g grp1
usemtl mtl1
f 1 2 3 4
Can you also send over your other obj?
/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17
var min = new Array(numberOfComponents).fill(Number.POSITIVE_INFINITY);
^
TypeError: Object has no method 'fill'
What version of Node do you have installed? Updating may fix that problem.
from obj2gltf.
The other file is a lot bigger (> 15 MB), and it also contains line line segments, so that's probably a related error.
I'm visualizing a ray-trace simulation for a scientific instrument and rays are lines, so I cannot really do without lines. I'll try to work directly with the OBJ format for now, but I'll keep your converter in mind and come back to it later if I have the opportunity!
melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node --version
v0.10.42
(I'm using CentOS and that's the version I get through my package manager.)
from obj2gltf.
Ok, thanks for all the info. Adding support for line segments shouldn't be too bad and I'll update this issue when it's ready.
from obj2gltf.
@lilleyse hi,i got the same error. i tried to read a file like xx.html.
here is my code
from obj2gltf.
obj2gltf
isn't using the readline
package anymore, you should investigate with them instead. You could also check out the byline
package which seems to be very solid so far.
from obj2gltf.
Related Issues (20)
- Blob is not defined at configureWebWorker HOT 5
- Loss of precision due to 32 bit floating point numbers
- Unlock cesium npm package from 1.84.0 HOT 2
- textures not loaded via mtl file HOT 2
- How can i use in Core PHP or LARAVEL?
- How to use obj2gltf at vite2?
- SyntaxError: Unexpected token '.' HOT 1
- losing colors when converting Obj->Glb/glTF HOT 1
- Install Error HOT 1
- include .mtl and textures in node js? HOT 1
- Add network path support
- JavaScript heap out of memory HOT 3
- Normal index 303 is out of bounds -causing socket hung and memory issue HOT 1
- Override texture flags not having any effect
- [suggestion] In obj2gltf, create a flag --doubleSidedMaterial to allow materials to be doubleSided regardless of transparency
- SyntaxError: Unexpected token '.' HOT 1
- glib? HOT 1
- Unpin mime and update to v4 or latest
- Emissive and base colors are incorrectly converted HOT 2
- Lines keep processing after Normal index 2412 is out of bounds Error causing Socket hanging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obj2gltf.