google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

Unable to access Children Nodes of 3D model (GLTF) #897

Open programmer35 opened 5 years ago

programmer35 commented 5 years ago

in SceneKit for iOS you can access children nodes by name and interact with these nodes.

In SceneForm there is a method to find the child by name, but it will not find the child node.

All children nodes are apparently converted to SubMesh and not treated as full node objects.

This severely limits the flexibility of this SDK and prevents many use cases of interacting with 3D models that are downloaded from the web that have various children nodes.

My use case in specific has 2 nodes 1-TV model 1-Screen model (perfectly aligned with screen and bezel of TV model)

The goal is to show a playing video within the screen area of the TV model. However, accessing the Screen Node is not currently possible in this SDK, it becomes a SubMesh which I can't manipulate as needed.

To separate out these models would mean multiplying (N) number of downloads per sub node It would also mean needing significant more meta-data in original model helping to align the size, height, width and of course Anchor offset xyz of the original placed 3D model Television.

I've seen another bug logged where someone was hoping to animate individual child nodes which I know is also not supported, but I don't need animation on children nodes, I just need access to them at least.

chnouman commented 5 years ago

yes, this is a big problem but what you can do right now is fetch separate models and make collection from them.

bobekos commented 5 years ago

Everything you want to do is currently possible. Yeah you are right you can't access the submeshes of your model but you can modify each material. So here is what you should do (and this is a typical stackoverflow answer and not a solution for a github "issue"):

  1. Check the custom material documentation (https://developers.google.com/ar/develop/java/sceneform/custom-material)

  2. Check the video sceneform sample project here on github (there you can find the video material)

  3. Download a simple 3d object (like a triangle) and convert it to sfb with the video material

  4. At runtime load the triangle get the material and set it to your screen model (you can access the screen model material over the getsubmesh("name") method)

  5. Implement all of the media player logic (like I already mention above just look at the sample projects)

  6. Enjoy

Ps. But yeah your are absolutely right. The feature to modify each submesh would be great.