How to prepare glTF models with mipmaps?

Hi, I’m trying to get rid of the texture alias 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.

1 Like

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

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

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 (50.9 KB)

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

Your help is much appreciated!

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

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