lovr.headset.newLayer

Edit

Creates a new Layer.





Arguments

NameTypeDefaultDescription
widthnumber The width of the Layer texture, in pixels.
heightnumber The height of the Layer texture, in pixels.
optionstablenil Optional options for the Layer.
.stereobooleannil Whether the Layer should be stereo. Stereo Layers use an array texture with 2 layers instead of a regular 2D texture, with the first array layer shown in the left eye and the second array layer shown in the right eye. The default is false, unless 2 images or an array texture are used to create the layer; then the default will be true.
.staticbooleannil Whether the Layer is static. Static layers use less memory, but their contents can only be changed on the frame when they're created. On subsequent frames, calling Layer:getTexture will throw an error. The default is false, unless images/textures are used to create the layer; then the default will be true. This should be used for layers that only need to display a static image.
.transparentbooleanfalse Whether the Layer is transparent. Transparent Layers will use their alpha channel to blend properly with other content behind them, at a minor performance cost.
.filterbooleantrue Whether the VR runtime is allowed to apply filtering effects to the Layer, such as sharpening and supersampling. This can improve text legibility and reduces "shimmering" artifacts, but may reduce performance. Currently only Quest will apply this automatic filtering.

Returns

NameTypeDescription
layerLayer The new Layer.

Arguments

NameTypeDefaultDescription
textureTexture A Texture to copy to the Layer.
optionstablenil Optional options for the Layer.
.stereobooleannil Whether the Layer should be stereo. Stereo Layers use an array texture with 2 layers instead of a regular 2D texture, with the first array layer shown in the left eye and the second array layer shown in the right eye. The default is false, unless 2 images or an array texture are used to create the layer; then the default will be true.
.staticbooleannil Whether the Layer is static. Static layers use less memory, but their contents can only be changed on the frame when they're created. On subsequent frames, calling Layer:getTexture will throw an error. The default is false, unless images/textures are used to create the layer; then the default will be true. This should be used for layers that only need to display a static image.
.transparentbooleanfalse Whether the Layer is transparent. Transparent Layers will use their alpha channel to blend properly with other content behind them, at a minor performance cost.
.filterbooleantrue Whether the VR runtime is allowed to apply filtering effects to the Layer, such as sharpening and supersampling. This can improve text legibility and reduces "shimmering" artifacts, but may reduce performance. Currently only Quest will apply this automatic filtering.

Returns

NameTypeDescription
layerLayer The new Layer.

Arguments

NameTypeDefaultDescription
imageImage An Image to upload to the Layer.
optionstablenil Optional options for the Layer.
.stereobooleannil Whether the Layer should be stereo. Stereo Layers use an array texture with 2 layers instead of a regular 2D texture, with the first array layer shown in the left eye and the second array layer shown in the right eye. The default is false, unless 2 images or an array texture are used to create the layer; then the default will be true.
.staticbooleannil Whether the Layer is static. Static layers use less memory, but their contents can only be changed on the frame when they're created. On subsequent frames, calling Layer:getTexture will throw an error. The default is false, unless images/textures are used to create the layer; then the default will be true. This should be used for layers that only need to display a static image.
.transparentbooleanfalse Whether the Layer is transparent. Transparent Layers will use their alpha channel to blend properly with other content behind them, at a minor performance cost.
.filterbooleantrue Whether the VR runtime is allowed to apply filtering effects to the Layer, such as sharpening and supersampling. This can improve text legibility and reduces "shimmering" artifacts, but may reduce performance. Currently only Quest will apply this automatic filtering.

Returns

NameTypeDescription
layerLayer The new Layer.

Arguments

NameTypeDefaultDescription
imagestable A table of Images to upload to the Layer.
optionstablenil Optional options for the Layer.
.stereobooleannil Whether the Layer should be stereo. Stereo Layers use an array texture with 2 layers instead of a regular 2D texture, with the first array layer shown in the left eye and the second array layer shown in the right eye. The default is false, unless 2 images or an array texture are used to create the layer; then the default will be true.
.staticbooleannil Whether the Layer is static. Static layers use less memory, but their contents can only be changed on the frame when they're created. On subsequent frames, calling Layer:getTexture will throw an error. The default is false, unless images/textures are used to create the layer; then the default will be true. This should be used for layers that only need to display a static image.
.transparentbooleanfalse Whether the Layer is transparent. Transparent Layers will use their alpha channel to blend properly with other content behind them, at a minor performance cost.
.filterbooleantrue Whether the VR runtime is allowed to apply filtering effects to the Layer, such as sharpening and supersampling. This can improve text legibility and reduces "shimmering" artifacts, but may reduce performance. Currently only Quest will apply this automatic filtering.

Returns

NameTypeDescription
layerLayer The new Layer.

Notes

Currently, images and textures used to create Layers must have the rgba8 format.

Layer textures are rgba8 and are sRGB.

See also