Difference between revisions of "CanvasFormat"

m
m
Line 16: Line 16:
 
The 16 bpp formats use half as much VRAM as the 32 bpp formats, but they have significantly lower quality than regular <code>rgba8</code>.
 
The 16 bpp formats use half as much VRAM as the 32 bpp formats, but they have significantly lower quality than regular <code>rgba8</code>.
  
The HDR / floating point formats are most useful when combined with pixel shaders. Effects such as tonemapped HDR with bloom can be accomplished, or the canvas can be used to store arbitrary non-color data such as positions which can then be interpreted and use in a custom shader.
+
The HDR / floating point formats are most useful when combined with pixel shaders. Effects such as tonemapped HDR with bloom can be accomplished, or the canvas can be used to store arbitrary non-color data such as positions which can then be interpreted and used in a custom shader.
  
 
The sRGB format should only be used when doing gamma-correct rendering, which is an advanced topic and it's easy to get color-spaces mixed up. If you're not sure whether you need this, you might want to avoid it. Read more about gamma-correct rendering [http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html here], [http://filmicgames.com/archives/299 here], and [http://renderwonk.com/blog/index.php/archive/adventures-with-gamma-correct-rendering/ here].
 
The sRGB format should only be used when doing gamma-correct rendering, which is an advanced topic and it's easy to get color-spaces mixed up. If you're not sure whether you need this, you might want to avoid it. Read more about gamma-correct rendering [http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html here], [http://filmicgames.com/archives/299 here], and [http://renderwonk.com/blog/index.php/archive/adventures-with-gamma-correct-rendering/ here].

Revision as of 00:45, 11 August 2014

Available since LÖVE 0.9.2
This enum is not supported in earlier versions.

Canvas formats.

Constants

normal
The default Canvas format - an alias for the rgba8 format, normally.
rgba8
8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders.)
rgba4
4 bits per channel (16 bpp) RGBA.
rgba5a1
RGB with 5 bits each, and a 1-bit alpha channel (16 bpp.)
rgb565
RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
rgb10a2
RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp.)
hdr
A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
rgba16f
Floating point RGBA with 16 bits per channel (64 bpp.) Color values can range from [-infinity, +infinity].
rgba32f
Floating point RGBA with 32 bits per channel (128 bpp.) Color values can range from [-infinity, +infinity].
rg11b10f
Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp.) There is no alpha channel. Color values can range from [0, +infinity].
srgb
The same as rgba8, but the Canvas is interpreted as being in the sRGB color space. Everything drawn to the Canvas will be converted from linear RGB to sRGB. When the Canvas is drawn (or used in a shader), it will be decoded from sRGB to linear RGB.

Notes

The 16 bpp formats use half as much VRAM as the 32 bpp formats, but they have significantly lower quality than regular rgba8.

The HDR / floating point formats are most useful when combined with pixel shaders. Effects such as tonemapped HDR with bloom can be accomplished, or the canvas can be used to store arbitrary non-color data such as positions which can then be interpreted and used in a custom shader.

The sRGB format should only be used when doing gamma-correct rendering, which is an advanced topic and it's easy to get color-spaces mixed up. If you're not sure whether you need this, you might want to avoid it. Read more about gamma-correct rendering here, here, and here.

Not all systems support every format. Use love.graphics.getCanvasFormats to check before creating the Canvas.

See Also

Other Languages