Is it possible to import a high res texture @2x, @3x etc and scale it down?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By hamoom

In other frameworks you add high density images and scale them down to be sharper. I was cheating and doing this with pixel art games. I’d add really high density art and then scale it down and use the filtering. This allowed me to have my pixel art game remain relatively sharp on different screen sizes. Can I do something similar in godot? I’m really struggling with scaling pixel art and preventing the artifacting stuff from happening.

i mean i can zoom my camera way out to get the effect i want but now i need to scale all the units in the game too. I need to multiply velocity * 4 etc… seems goofy. I just want to scale my original image down…

hamoom | 2020-01-25 23:40

I created an issue for this:

Allow high resolution art to be downscaled example: @2x = 0.5 scale. Useful for pixel art. · Issue #407 · godotengine/godot-proposals · GitHub

look at how I was able to accomplish pixel art with smooth scaling and camera movement using the technique outlined above. This was done in Corona SDK. i want to port this game to godot but I am running into a wall with the artwork scaling properly without distortion.

https://www.youtube.com/watch?v=HIARx0kW7XM

hamoom | 2020-01-26 05:24

:bust_in_silhouette: Reply From: estebanmolca

One way I am investigating is, importing the texture as an image in the import box, so you can use the Image methods such as rezise () and then convert it to a texture image. I tried it and it works, but I don’t know how the quality issue is, there are many options and interpolations and I know little and nothing about that. I keep investigating and I tell you.

extends Node2D
var img:Image
onready var tex= ImageTexture.new()
func _ready():
	img=preload("res://art/forest.jpg")
	img.resize(256,256,Image.INTERPOLATE_TRILINEAR)
	tex.create_from_image(img)
	var sp=Sprite.new()
	sp.centered=false
	sp.texture=tex
	add_child(sp)
	pass

INTERPOLATE_LANCZOS I think, it is the highest quality interpolation. I reduced an image from 1920-1080 to 240-135 and it looks good to be an 8x reduction.Try it and tell me what you think and if the loss of quality is what you are looking for, ah I forgot that the mipmaps are but I know little about the subject, what Godot does is keep copies of the texture in different sizes and use the one that best adapt to the resolution and current size … I am still investigating.
…Well, import a png 512x512 with the default options, I reduced the size by scaling the sprite, and the difference with activated mipmaps is notorious.

estebanmolca | 2020-01-26 11:26

Prueba-Mip-Maps hosted at ImgBB — ImgBB
My conclusion: activate MipMaps, it adapts to different sizes and resolution, what to convert into image, scale and then convert to texture there is no notable difference

estebanmolca | 2020-01-26 11:56