godotengine / godot-blender-exporter

Addon for Blender to directly export to a Godot Scene
GNU General Public License v2.0
1.15k stars 122 forks source link

Texture Interpolation "Closest" not exported #389

Open H4kor opened 3 years ago

H4kor commented 3 years ago

OS: Linux

Godot version: v3.2.3

Blender version: 2.91

Issue description:

When setting the interpolation of a texture to "Closest" this setting is not reflected in the exported scene, resulting in a blurry texture in Godot.

Minimal reproduction project:

image

  1. Create a Shader using a Image Texture (see image)
  2. Set the Interpolation to "Closest"
  3. Export to Godot
  4. Open scene in Godot: textures are blurred/do not use closest interpolation
rcorre commented 3 years ago

@H4kor can you provide an example? I frequently use "closest" interpolation for low-poly texturing (e.g. https://rcorre.itch.io/modular-mech), and it seems to work fine.

You might need to change your texture import settings in godot. Make sure your texture imports with lossless compression, no mipmaps, and no filtering (I actually don't know what "filtering" does, as there's no docstring, but I've just found experimentally that I should have it turned off for low poly art):

1609943832

I'm not sure the exporter can/should do this, as is isn't necessarily responsible for exporting the png (it does automatically, but only if the texture doesn't already exist). Also, multiple materials might use the same texture, but with different interpolation settings.

H4kor commented 3 years ago

Yes, changing the import settings and reimporting the texture fixes it. Might not be a bug but an enhancement as this can be confusing to new users at having the interpolation being exported too would be more convenient.

Here is an empty Project with just one import. Mipmaps are generated by default: Texture.zip

rcorre commented 3 years ago

Mipmaps are generated by default

I think that's the behavior of Godot, not the exporter. I don't think the exporter generates .import files at all. Though I suppose we could start.

I was thinking this was infeasible, since interpolation (e.g. closest/linear) is per-material, but import settings (e.g. filter/mipmaps/compression) are per-texture. You could have materials with different interpolation using the same texture. But I suppose that's pretty rare, and won't look good anyways, so maybe we should just assume you'd never want that.