Shadow

gfx.shadow.set_positional_atlas_size

Client

Sets the size and depth precision of the positional shadow atlas

Syntax

local status = gfx.shadow.set_positional_atlas_size(
    size,
    is_16bits = nil
)

A larger atlas gives sharper omni and spot light shadows at a memory cost.

  • Shared — used by every omni and spot light with shadows.
  • Quadrants — split into four quadrants, see gfx.shadow.set_positional_atlas_quadrant_subdiv.
  • Cost — memory and GPU cost grow with the square of the size, so 8192 uses four times as much as 4096.
  • Default — 4096 with a 16-bit depth buffer.

Parameters

TypeNameDescription
intsizeAtlas size in pixels
Must be between 256 and 16384, values that are not a power of two are rounded up to the next one
An error is raised if the value is out of range
boolis_16bitsDetermines the depth precision of the atlas:
• When true - uses a 16-bit depth buffer, lower memory usage and faster
• When false - uses a 32-bit depth buffer, higher precision at double the memory cost
• When omitted - keeps the current setting

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Set an 8192 positional atlas
gfx.shadow.set_positional_atlas_size(8192)
Set a 2048 positional atlas with 16-bit depth
gfx.shadow.set_positional_atlas_size(2048, true)

On this page