# Updating Model Color and Texture/Skin

**URL:** <https://community.cesium.com/t/updating-model-color-and-texture-skin/5085>\
**Category:** CesiumJS\
**Created:** [January 27, 2017, 5:08pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085 "2017-01-27T17:08:14Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/rob/32/5906_2.png) [@Rob](https://community.cesium.com/u/Rob)\
**Post date:** [January 27, 2017, 5:08pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/1 "2017-01-27T17:08:14Z")

</div>

**Model Color…**

I see that color has been added as a property for models. This is a great new feature! However, I’m having trouble getting it to work in my scenario.

I am using Cesium 1.29, and we are creating models using Cesium.Model.fromGltf and adding the result to the primitives collection. So far I have not been able to change the color property by setting model.color. Does this new color property only work for entities? I only see examples for entities, but the documentation makes it seem like this should work for primitives.

**Model Texture/Skin…**

We have the need to display multiple instances of the same model with different textures/skins. Is there a way to change/update/assign the texture/skin on a model programmatically (during runtime)?

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [January 27, 2017, 6:52pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/2 "2017-01-27T18:52:43Z")

</div>

Hello,

Yes, you can set model.color if you’re using Model.fromGltf. You can see an example of this in the 3D models development sandcastle example: [https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Apps/Sandcastle/gallery/development/3D%20Models.html](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Apps/Sandcastle/gallery/development/3D%20Models.html)

If that’s not working, could you paste a code sample to reproduce the problem?

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Rob](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/rob/32/5906_2.png) [@Rob](https://community.cesium.com/u/Rob)\
**Post date:** [January 27, 2017, 8:21pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/3 "2017-01-27T20:21:00Z")

</div>

Thank you, Hannah, for the response. It turns out since I use Google’s closure compiler I needed to include extern references for the other color related properties. Once I did this the models get colored great!

I have another color question: How do I remove the color?

I have models that have a texture “baked” on. I want to toggle the color of the model based on a switch the user selects and then return the model to no color with the original texture appearance when the user turns off the switch. How do I go about removing the color from a model once it has been applied?

The Sandcastle color example has a property called colorBlendAmountEnabled, but I don’t see that in the API. I’ve tried setting that flag to true and setting the colorBlendAmount to 0. I’ve also tried setting the color to white with an alpha of 0. But none of these approaches remove the color from the model once the color has been applied.

---

<div class="post-metadata">

**Author:** ![Rob](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/rob/32/5906_2.png) [@Rob](https://community.cesium.com/u/Rob)\
**Post date:** [January 27, 2017, 8:55pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/4 "2017-01-27T20:55:15Z")

</div>

I figured it out. To remove the applied color from the model you set the colorBlendMode to ColorBlendMode.MIX and set the colorBlendAmount to 0.

It works great! Thanks for the new feature!

Any input on the ability to apply or bind a different texture to a model during runtime?

---

<div class="post-metadata">

**Author:** ![sean\_lilley](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sean_lilley/32/2083_2.png) [@sean\_lilley](https://community.cesium.com/u/sean_lilley)\
**Post date:** [January 28, 2017, 12:12am UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/5 "2017-01-28T00:12:46Z")

</div>

Alternatively to remove the color set colorBlendMode to ColorBlendMode.HIGHLIGHT and color to Color.WHITE, this is the default state at least. Your way works too though.

Right now there’s no ability to apply different textures on the fly.

---

<div class="post-metadata">

**Author:** ![Frederic\_Brodbeck](https://avatars.discourse-cdn.com/v4/letter/f/c68b51/32.png) [@Frederic\_Brodbeck](https://community.cesium.com/u/Frederic_Brodbeck)\
**Post date:** [March 8, 2017, 12:42pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/6 "2017-03-08T12:42:53Z")

</div>

what about dynamically changing the texture of a model? – how would you do that?

---

<div class="post-metadata">

**Author:** ![Rob](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/rob/32/5906_2.png) [@Rob](https://community.cesium.com/u/Rob)\
**Post date:** [March 8, 2017, 2:38pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/7 "2017-03-08T14:38:39Z")

</div>

I definitely want this feature as well! My understanding is that the answer has been you cannot do that (apply texture to a model during run time) so far. However, I’m hopeful that the new support for compressed textures (KTX) may also introduce some method for applying those textures dynamically. I don’t see anything about this in the change log, however, so I’m not holding my breath. It seems that when support is added to apply textures dynamically it will be advertised significantly since it will definitely be a big deal!

---

<div class="post-metadata">

**Author:** ![sean\_lilley](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sean_lilley/32/2083_2.png) [@sean\_lilley](https://community.cesium.com/u/sean_lilley)\
**Post date:** [March 9, 2017, 12:19am UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/8 "2017-03-09T00:19:39Z")

</div>

I actually don’t think this would be too hard to do, in fact I remember someone posting a hacked up solution for this not too long ago (I can’t find the thread though). This sounds like a good code sprint idea…

---

<div class="post-metadata">

**Author:** ![Frederic\_Brodbeck](https://avatars.discourse-cdn.com/v4/letter/f/c68b51/32.png) [@Frederic\_Brodbeck](https://community.cesium.com/u/Frederic_Brodbeck)\
**Post date:** [March 9, 2017, 2:14pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/9 "2017-03-09T14:14:33Z")

</div>

> I actually don't think this would be too hard to do, in fact I remember someone posting a hacked up solution for this not too long ago (I can't find the thread though). This sounds like a good code sprint idea..

👍

---

<div class="post-metadata">

**Author:** ![Rob](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/rob/32/5906_2.png) [@Rob](https://community.cesium.com/u/Rob)\
**Post date:** [March 10, 2017, 9:09pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/10 "2017-03-10T21:09:29Z")

</div>

Hey Sean,

It would be GREAT if this could be addressed in a code sprint! Is there anything I can do to make a formal request for this?

Rob

---

<div class="post-metadata">

**Author:** ![sean\_lilley](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sean_lilley/32/2083_2.png) [@sean\_lilley](https://community.cesium.com/u/sean_lilley)\
**Post date:** [March 11, 2017, 12:55am UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/11 "2017-03-11T00:55:20Z")

</div>

I opened up an issue so we can at least track progress on github. This one is open to anyone, not just the core team.

---

<div class="post-metadata">

**Author:** ![sean\_lilley](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sean_lilley/32/2083_2.png) [@sean\_lilley](https://community.cesium.com/u/sean_lilley)\
**Post date:** [March 11, 2017, 12:55am UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/12 "2017-03-11T00:55:37Z")

</div>

Link: [https://github.com/AnalyticalGraphicsInc/cesium/issues/5094](https://github.com/AnalyticalGraphicsInc/cesium/issues/5094)

---

<div class="post-metadata">

**Author:** ![Rob](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/rob/32/5906_2.png) [@Rob](https://community.cesium.com/u/Rob)\
**Post date:** [March 11, 2017, 11:08am UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/13 "2017-03-11T11:08:59Z")

</div>

Thanks, Sean!

This would be a great feature  
that we would definitely put to use immediately. We display aircraft around airports, and the  
ability to apply the textures during run time would be great (we do this in a  
Java application). I assume this would  
also reduce memory consumption. Since Cesium caches the models I would think applying a texture to different instances of the same model would be less expensive than loading a unique aircraft model with “baked on”  
airline texture for each aircraft displayed.

Thanks again,

Rob

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [March 12, 2017, 9:05pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/14 "2017-03-12T21:05:11Z")

</div>

Rob - sounds like you are developing a cool app, let me know if we can showcase your work on the Cesium website: [http://cesiumjs.org/demos.html](http://cesiumjs.org/demos.html)

Patrick

---

<div class="post-metadata">

**Author:** ![Rob](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/rob/32/5906_2.png) [@Rob](https://community.cesium.com/u/Rob)\
**Post date:** [March 13, 2017, 10:01pm UTC](https://community.cesium.com/t/updating-model-color-and-texture-skin/5085/15 "2017-03-13T22:01:17Z")

</div>

Hi Patrick,

Thanks for the offer! Unfortunately almost all of the airports and entities we work with use data that has use restrictions. Maybe at some point in the future we’ll have a data source that would make a demo site feasible.

Rob
