Enable 16× anisotropic filtering in the 3D preview

This improves rendering quality, especially when viewing the texture
at an oblique angle.
This commit is contained in:
Hugo Locurcio 2019-10-19 22:40:28 +02:00
parent 3076b279bd
commit f91f85d005
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
2 changed files with 6 additions and 0 deletions

View File

@ -87,6 +87,8 @@ func render_textures(renderer : MMGenRenderer):
texture = ImageTexture.new() texture = ImageTexture.new()
result.copy_to_texture(texture) result.copy_to_texture(texture)
result.release() result.release()
# To work, this must be set after calling `copy_to_texture()`
texture.flags |= ImageTexture.FLAG_ANISOTROPIC_FILTER
elif t.has("ports"): elif t.has("ports"):
var context : MMGenContext = MMGenContext.new(renderer) var context : MMGenContext = MMGenContext.new(renderer)
var code = [] var code = []
@ -109,6 +111,9 @@ func render_textures(renderer : MMGenRenderer):
texture = ImageTexture.new() texture = ImageTexture.new()
result.copy_to_texture(texture) result.copy_to_texture(texture)
result.release() result.release()
# To work, this must be set after calling `copy_to_texture()`
texture.flags |= ImageTexture.FLAG_ANISOTROPIC_FILTER
generated_textures[t.texture] = texture generated_textures[t.texture] = texture
func update_materials(material_list): func update_materials(material_list):

View File

@ -179,4 +179,5 @@ file_logging/enable_file_logging=true
[rendering] [rendering]
quality/filters/anisotropic_filter_level=16
environment/default_environment="res://default_env.tres" environment/default_environment="res://default_env.tres"