Hello.
So I created inventory UI, it is basically GridContainer ( tried with ItemList too), with texture rects as children. When item is created anew its preview is rendered behind the scenes, creating ImageTexture converted from rendered viewporttexture - and it works, I can save these images, check them out in editor, use it anywhere in sprite2d, their colour is perfect.
I wanted to use these images as previews in inventory grid.
The problem happens when Inventory screen is scaled down due to changing game window size. The smaller inventory parent node is, the more pale color of items get, they are losing brightness and at some point become invisible. Their color is good only at parents scale of 100 %. This effect does not happen when I use any already existing textures, including the very same viewport rendered pictures as long as they were saved as png files instead of created in runtime.
This is very ridicolous problem, is it a thing about storing images ??
This is a process of creating image on the go :
var img = $Control/ViewportContainer/Viewport.get_texture().get_data()
var bg = Image.new() #This is supposed to be final images background
bg.create(128,128,true,Image.FORMAT_RGBA8)
img.convert(bg.get_format())
img.resize(128,128)
bg.fill(setcolor(data["tier"])) # You know, blue for uncommon and so on
bg.blend_rect(img,Rect2(Vector2.ZERO,img.get_size()),Vector2(0,0))
model.queue_free() #model that was taken picture of is released
var pict = ImageTexture.new()
pict.create_from_image(bg)
$Control/ViewportContainer/Viewport.disable_3d = true #and studio is too
return pict