Models that use a palette?

I find that a lot of low polymodels are colored with a palette image. No matter how I export these from blender, they lose the color going to cge. Here is an example of a van with simple colors it gets from this texture image. Is there a way to maintain the colors exporting and importing to cge?


If this palette image is just a texture, from which artist takes colors by using proper texture coordinates – then it should just work “out of the box”. If you export it to glTF, the texture should be displayed and used properly.

Note: To avoid smoothing the texture (which will happen because of using bilinear filtering or mipmaps) set filtering to “nearest”. In case of Blender → glTF, the filtering is stored in glTF, so you should set in Blender: “Texture Interpolation” set to “Closest” (default is “Linear”).

( Setting the MinificationFilter and MagnificationFilter to ..Nearest in RenderOptions in this case will not help, as glTF overrides these options per each texture. )

I’ve made a simple test 3D model in Blender, using 1x4 texture, to confirm it is OK.

Sources in Blender and output in glTF: https://github.com/castle-engine/demo-models/tree/master/blender/using_texture_as_palette

Screenshots:


So… things seem to work on my end. Can you attach a model that shows the issue (here or in a GitHub issue, or send it privately to me if you cannot share it publicly) so that I can investigate it?