Code Monkey home page Code Monkey logo

Comments (6)

ryancrunchi avatar ryancrunchi commented on May 29, 2024 1

This should be in the readme as technical documentation.

from gltfscenekit.

digitallysavvy avatar digitallysavvy commented on May 29, 2024 1

Given its been almost a year since this issue has been opened without much response from @magicien ... whomever else is running into this issue, please check out my fork. I fixed the node structure issue. In the fork below, the scene graph in SceneKit is a 1:1 match of the structure of the GLB and doesn't distort the scene hierarchy with arbitrary nodes in the way this library does.

https://github.com/digitallysavvy/GLTFSceneKit

from gltfscenekit.

magicien avatar magicien commented on May 29, 2024

I mapped each node/mesh/primitive onto SCNNode, so WaterBottleEmptyNode is mapped onto mesh.
Actually, mesh SCNNode doesn't have any 3D data. It has only 'name'.
It's possible to omit mesh nodes, but it could be confusing if child nodes and primitive nodes are in the same layer.

How do you think?

from gltfscenekit.

johanos avatar johanos commented on May 29, 2024

What do you mean exactly?

From what I understand the primitives are part of the mesh object. which point to indices and materials. but mesh[0] defines a mesh with geometry and materials. so I see it more confusing to interpret that as

WaterBottle                     -- start of gltf asset
    -WaterBottleEmptyNode       -- mesh[0] object, but its an empty container
        -WaterBottleMesh        -- primitives of mesh[0], contains Normal, UV, Position, Tangent info

than

WaterBottle                      -- start of gltf asset
    -WaterBottleMesh             -- mesh[0] object, + primitives: UV, Normal, Position, Tangent info.

SCNNode is capable of having the format be this way and it would be less confusing to work with the nodes this way

here's a screenshot of the babylon js inspector ( __root would be what we are calling WaterBottle) and then the only child node is WaterBottle.

image

edit: and the child nodes of these meshes could just be children of the base mesh

WaterBottle                      -- start of gltf asset
    -WaterBottleMesh             -- mesh[0] object, + primitives: UV, Normal, Position, Tangent info.
        -WaterBottleChild1
    -WaterBottleSiblingNode

from gltfscenekit.

magicien avatar magicien commented on May 29, 2024

Thank you for your explanation!

Current mapping between glTF and SceneKit looks like this:
gltf_scenekit_map_current

I don't think I can change the mapping into this way because SCNNode can have only one geometry. I'm not sure, but I think if SCNGeometry has 2 or more vertex SCNGeometrySources, SceneKit will use only the first source.
gltf_scenekit_map_new_1

This is possible, but I'm worried about putting primitives and children nodes in the same layer could be confusing.
gltf_scenekit_map_new_2

from gltfscenekit.

digitallysavvy avatar digitallysavvy commented on May 29, 2024

Bump on this issue because I ran into problems with the node hierarchy.

The issue with the extra nodes is the duplication of names and it forces the developer to write a nasty work-around.

The issue really becomes apparent when you use the childNodeWithName because the method returns the first instance of a node with this name, but with the given hierarchy that node is not the one I'm looking for but instead an arbitrary parent. To get the node I am looking for I then have to call childNodeWithName again and then use childNodes.first to get the node with the geometry I wish to affect.

This is a headache for anyone trying to do anything as simple as change a material.

I have opened a PR (#37) that addresses this issue.

@magicien I know you have some reservations about changing this structure so I'd like to find a resolution that works for all because as the current version stands this is a major hinderance to simple traversals for named nodes.

from gltfscenekit.

Related Issues (20)

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.