# Iterate over loaded gltf

**URL:** <https://community.cesium.com/t/iterate-over-loaded-gltf/19134>\
**Category:** CesiumJS\
**Created:** [June 17, 2022, 7:08am UTC](https://community.cesium.com/t/iterate-over-loaded-gltf/19134 "2022-06-17T07:08:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lyror](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/lyror/32/9727_2.png) [@Lyror](https://community.cesium.com/u/Lyror)\
**Post date:** [June 17, 2022, 7:08am UTC](https://community.cesium.com/t/iterate-over-loaded-gltf/19134/1 "2022-06-17T07:08:57Z")

</div>

I’m new to cesium js. I would like to iterate over a loaded gltf file. I add my model over an url http://…/model.glb to cesium.  
`const ent = this.viewer.entities.add({ name: url, position: position, orientation: orientation, shadows: ShadowMode.ENABLED, id: url, model: { uri: url, id: url, orientation: orientation, heightReference: HeightReference.RELATIVE_TO_GROUND, scale: 1, }, });`

The code above works fine. I get my model on screen and now I would like to change visibillity or change materials or color of my model / single meshes. How can I iterate over my model? The `ent` variable is from type entity. I don’t see an option to get the data.

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jacky/32/7686_2.png) [@Jacky](https://community.cesium.com/u/Jacky)\
**Post date:** [June 17, 2022, 8:59am UTC](https://community.cesium.com/t/iterate-over-loaded-gltf/19134/2 "2022-06-17T08:59:36Z")

</div>

Hi @Lyror ,  
You can iterate over a loaded gltf model. You can transform particular node of any model But I’m not sure if you can change it’s material or not.

You may check this [example](https://sandcastle.cesium.com/index.html?src=development%2F3D%20Models%20Node%20Explorer.html&label=Development) to understand Node Explorer.

- Regards

---

<div class="post-metadata">

**Author:** ![Lyror](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/lyror/32/9727_2.png) [@Lyror](https://community.cesium.com/u/Lyror)\
**Post date:** [June 20, 2022, 8:38am UTC](https://community.cesium.com/t/iterate-over-loaded-gltf/19134/3 "2022-06-20T08:38:22Z")

</div>

Thanks for the example, that helped me a lot.

> [@Jacky](#):
>
> You can transform particular node of any model

I’m just not clear yet how I can change the color of a node. It seems to me that this possibility does not exist yet. Could that be?

My assumption is based on the open issue.

> <https://github.com/CesiumGS/cesium/issues/2387>
>
> Is there a way of changing the material linked to a primitive in a ModelMesh cre…ated from a glTF model?
> 
> The goal is to highlight the picked node by changing the material's parameters but \`ModelMaterial.selValue\` is applied over every primitive linked to that material. I think that the best solution is to temporary link the primitive to a special 'highlight' material but it does not have any effect over the rendered model. Maybe there is a better solution to solve the problem so I am open to suggestions!
> 
> Thanks!

---

<div class="post-metadata">

**Author:** ![Jacky](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jacky/32/7686_2.png) [@Jacky](https://community.cesium.com/u/Jacky)\
**Post date:** [June 20, 2022, 5:02pm UTC](https://community.cesium.com/t/iterate-over-loaded-gltf/19134/4 "2022-06-20T17:02:20Z")

</div>

> [@Lyror](#):
>
> It seems to me that this possibility does not exist yet.

You are right. I have tried whatever I could to meet that requirement. But I’m also a beginner for understanding shaders and material things. Please share with me also if you found any progress on gltf node material.
