Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add model loading support? #30

Open
ianmackenzie opened this issue Oct 10, 2019 · 7 comments
Open

Add model loading support? #30

ianmackenzie opened this issue Oct 10, 2019 · 7 comments

Comments

@ianmackenzie
Copy link
Owner

This is a bit of a placeholder issue since my current thinking is that support for different file formats should live in their own packages, so (e.g.) a COLLADA package can be focused on parsing COLLADA files into nice Elm data types and elm-3d-scene can remain focused on rendering. That said, one way or another there should definitely be an easy way to load models into elm-3d-scene. Potential file formats to support include:

  • OBJ
  • COLLADA (.dae)
  • FBX
  • glTF
  • STL

Please add a comment if there's a particular file format you'd like to see supported!

@schoening
Copy link

Models can also come with animations.
Probably good to have in mind when deciding where to put an eventual “setAnimationFrame” function 😁

@ianmackenzie
Copy link
Owner Author

@schoening what kind of setAnimationFrame function were you thinking of?

@schoening
Copy link

schoening commented Oct 12, 2019

@ianmackenzie a quick and dirty example from babylonjs, here you see I am setting the frame manually:

https://www.babylonjs-playground.com/#4HGNW#4

@ianmackenzie
Copy link
Owner Author

Ah gotcha - I thought you were referring to the browser's animation frame, e.g. https://package.elm-lang.org/packages/elm/browser/latest/Browser-Events#onAnimationFrame.

@declension
Copy link
Contributor

Hi! What's the current best way / workaround to try loading STLs with elm-3d-scene?

@ianmackenzie
Copy link
Owner Author

Currently I think the two options are:

  • Write a quick and dirty parser yourself (that likely only works on your specific files)
  • Pre-process the files offline to convert STL into a JSON format which you can then easily decode in Elm

I realize those are both kind of non-answers - once elm-3d-scene 1.0 is out I'll hopefully have time to start looking at implementing some proper import packages.

@b0oh
Copy link

b0oh commented Mar 16, 2020

Hi! What's the current best way / workaround to try loading STLs with elm-3d-scene?

I am not sure if my experience is useful but I do it that way:
parse stl to jscad: https://www.npmjs.com/package/@jscad/stl-deserializer
that will return CSG object
which will have polygons attribute
that could be sent to an Elm app from ports and can be rendered there using elm-3d-scene.
Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants