|Available since LÖVE 0.11.0|
|This function is not supported in earlier versions.|
|This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!|
To use a volume image in a Shader, it must be declared as a
sampler3D type (instead of
Texel(VolumeImage image, vec3 texcoords) shader function must be used to get pixel colors from the volume image. The vec3 argument is a normalized texture coordinate with the z component representing the depth to sample at (ranging from [0, 1]).
Volume images are typically used as lookup tables in shaders for color grading, for example, because sampling using a texture coordinate that is partway in between two pixels can interpolate across all 3 dimensions in the volume image, resulting in a smooth gradient even when a small-sized volume image is used as the lookup table.
Array images are a much better choice than volume images for storing multiple different sprites in a single array image for directly drawing them.
Creates a volume Image given multiple image files with matching dimensions.
image = love.graphics.newVolumeImage( layers, settings )
- A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. A table of tables can also be given, where each sub-table represents a single mipmap level and contains all layers for that mipmap.
table settings (nil)
- Optional table of settings to configure the volume image, containing the following fields:
boolean mipmaps (false)
- True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn't a compressed texture format.
boolean linear (false)
- True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB.
- A volume Image object.
Volume images are not supported on some older mobile devices. Use love.graphics.getTextureTypes to check at runtime.
Tiếng Việt –