# How to prepare glTF models with mipmaps?

**URL:** <https://community.cesium.com/t/how-to-prepare-gltf-models-with-mipmaps/12423>\
**Category:** CesiumJS\
**Created:** [February 22, 2021, 8:29pm UTC](https://community.cesium.com/t/how-to-prepare-gltf-models-with-mipmaps/12423 "2021-02-22T20:29:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vojtech-frodl](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/vojtech-frodl/32/4178_2.png) [@vojtech-frodl](https://community.cesium.com/u/vojtech-frodl)\
**Post date:** [February 22, 2021, 8:29pm UTC](https://community.cesium.com/t/how-to-prepare-gltf-models-with-mipmaps/12423/1 "2021-02-22T20:29:17Z")

</div>

Hi, I’m trying to get rid of the [texture alias](https://www.youtube.com/watch?v=rn3oP1OhZ8c) on buildings in Cesium. I’m not sure if I need to build the mipmap levels to my glTF models myself or if it’s enough to define a sampler with minFilter 9987 and let Cesium generate the mip levels.  
I’m using this sampler for all models:  
“samplers”: [  
{  
“magFilter”: 9729,  
“minFilter”: 9987,  
“wrapR”: 10497,  
“wrapS”: 10497,  
“wrapT”: 10497  
}  
],  
But I export each texture as a single JPEG or PNG (no mip levels). Can someone give me a hint?  
I’m trying this on branch 3d-tiles-next-experimental.

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [February 23, 2021, 6:03pm UTC](https://community.cesium.com/t/how-to-prepare-gltf-models-with-mipmaps/12423/2 "2021-02-23T18:03:03Z")

</div>

According to the specification, the engine should automatically generate mimaps:

> **Mipmapping Implementation Note** : When a sampler’s minification filter ( `minFilter` ) uses mipmapping ( `NEAREST_MIPMAP_NEAREST` , `NEAREST_MIPMAP_LINEAR` , `LINEAR_MIPMAP_NEAREST` , or `LINEAR_MIPMAP_LINEAR` ), any texture referencing the sampler needs to have mipmaps, e.g., by calling GL’s `generateMipmap()` function.

From: [https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#samplers](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#samplers)

So I would expect that to just work. Are you not seeing mipmaps when loading this glTF in CesiumJS? Can you share the model?

---

<div class="post-metadata">

**Author:** ![vojtech-frodl](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/vojtech-frodl/32/4178_2.png) [@vojtech-frodl](https://community.cesium.com/u/vojtech-frodl)\
**Post date:** [February 23, 2021, 9:18pm UTC](https://community.cesium.com/t/how-to-prepare-gltf-models-with-mipmaps/12423/3 "2021-02-23T21:18:10Z")

</div>

I thought that part of the specification was rather ambiguous. Granted, it says

> any texture referencing the sampler needs to have mipmaps

but it can still mean that the model generator needs to provide them.

Anyway, if you say that Cesium should be able to generate them, let’s work with that. I can’t share the same model from the linked video but I created another one with the same issue. It’s actually a small tileset: [3323.zip](https://community.cesium.com/uploads/short-url/8mnl5CRZ5ybCET1oeaTNgUAd6UZ.zip) (50.9 KB)

It’s also possible that Cesium generates mipmaps and the alias is caused by something else.

Your help is much appreciated!

---

<div class="post-metadata">

**Author:** ![vojtech-frodl](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/vojtech-frodl/32/4178_2.png) [@vojtech-frodl](https://community.cesium.com/u/vojtech-frodl)\
**Post date:** [February 26, 2021, 9:34am UTC](https://community.cesium.com/t/how-to-prepare-gltf-models-with-mipmaps/12423/4 "2021-02-26T09:34:43Z")

</div>

Hi again, I still haven’t resolved this. Can anyone help me please?

---

<div class="post-metadata">

**Author:** ![ejk](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ejk/32/3476_2.png) [@ejk](https://community.cesium.com/u/ejk)\
**Post date:** [February 26, 2021, 1:28pm UTC](https://community.cesium.com/t/how-to-prepare-gltf-models-with-mipmaps/12423/5 "2021-02-26T13:28:23Z")

</div>

I am having a similar issue, eager to hear if there is any answer to the original question!
