Available since LÖVE 11.0 |
This function is not supported in earlier versions. |
Creates a new volume (3D) Image.
![]() |
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! |
Volume images are 3D textures with width, height, and depth. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send).
To use a volume image in a Shader, it must be declared as a VolumeImage
or sampler3D
type (instead of Image
or sampler2D
). The 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 )
table layers
table settings (nil)
boolean mipmaps (false)
boolean linear (false)
Image image
Volume images are not supported on some older mobile devices. Use love.graphics.getTextureTypes to check at runtime.