archilogic-com / 3dio-js

JavaScript toolkit for interior apps

Home Page:https://3d.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convert scene structure to data3d

mope1 opened this issue · comments

Scope

  • The scene structure is the JSON representation of a scene where the models are either expressed in parameters or linked in as gz.data3d.buffer
  • Before the models can be processed (e.g. exported as some format), they need to be converted to a 3d model in the data3d format, which looks something like this:
"meshes": {
    "foo": {
        "positions": [4,0,0,0,0,0,0,0,4,0,0,4,4,0,4,4,0,0],
        "normals": [0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0],
        "uvs": [-3.1,-8.55,-3.1,-12.55,0.9,-12.55,0.9,-12.55,0.9,-8.55,-3.1,-8.55],
        "material": "foo",
        ...
    },
   ...
}
  • The materials may need to be resolved using the default materials library
  • It's currently not possible to use the 3dio-js API in a meaningful standalone fashion

Behaviour

  • Method in 3dio-js where i can put in scene structure JSON and get data3d JSON

Implications

  • No breaking changes to existing stuff necessary

Steps

  • Separate param model resolver from aframe param model components (so called "architectural toolkit")
  • Call param model resolvers
  • Strategy for supporting "custom meshes", meaning objects that data3d meshes that are linked into the scene structure by path on S3 (update this issue when finished)
    Update: It turns out 3dio-js has functions for loading the sceneStructure from s3 bucket paths (aka "keys"). Added calls to storage.get to recursive scenestructure-to-data3d for now (scene/structure/to-data3d.js)
  • Refactor storage.get to not only work for files with data3d.buffer/json extension and file format #140 ?
  • Eval if we need to flatten hierarchy and do so if necessary
  • resolve materials from standard lib and s3 paths ("keys")
  • Call utils/data3d/encode-binary
  • compile list of all material textures recursively
  • consider adding options to include furniture and other parts of the models or not (like editor)
  • Support baked models
  • Extensive testing and bugfixing to avoid breakage

updated to reflect progress