File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -105,13 +105,24 @@ instead of the filesystem. This is useful to send the image over the network or
105105into a ZIP archive without having to write it on the filesystem. This can
106106increase performance by reducing I/O utilization.
107107
108+ .. note ::
109+
110+ If displaying the loaded image on a 3D surface, make sure to call
111+ :ref: `Image.generate_mipmaps <class_Image_method_generate_mipmaps >`
112+ so that the texture doesn't look grainy when viewed at a distance.
113+ This is also useful in 2D when following instructions on
114+ :ref: `reducing aliasing when downsampling <doc_multiple_resolutions_reducing_aliasing_on_downsampling >`.
115+
108116Example of loading an image and displaying it in a :ref: `class_TextureRect ` node
109117(which requires conversion to :ref: `class_ImageTexture `):
110118
111119::
112120
113121 # Load an image of any format supported by Godot from the filesystem.
114122 var image = Image.load_from_file(path)
123+ # Optionally, generate mipmaps if displaying the texture on a 3D surface
124+ # so that the texture doesn't look grainy when viewed at a distance.
125+ #image.generate_mipmaps()
115126 $TextureRect.texture = ImageTexture.create_from_image(image)
116127
117128 # Save the loaded Image to a PNG image.
You can’t perform that action at this time.
0 commit comments