Drawing

Persistent drawing objects, shaders, compute programs, textures, meshes and effects.

16 functionssUNC 100%Lynx 0.747

The Drawing library adds shapes, text, images and shader effects to the screen. Create an object with Drawing.new, set its properties, then set Visible to true. Objects remain visible until you hide or remove them. Shader resources can also be used with DrawingImmediate.

Library functions

Drawing.new

Drawing.new(kind: string): DrawingObject

Drawing.new creates a drawing object or shader resource of the requested type.

Parameters

kindstring
The drawing or resource type to create. See the type lists below.

Returns

DrawingObject

The new Drawing object or resource. Its properties depend on the requested type.

Drawing.clear

Drawing.clear(): ()

Drawing.clear removes every active drawing object and shader resource created with Drawing.new.

Returns

()

This function does not return a value.

isrenderobj

isrenderobj(value: unknown): boolean

isrenderobj checks whether a value is a Drawing object.

Also available as is_render_obj.

Parameters

valueunknown
The value to check for Drawing-object identity.

Returns

boolean

True if the value is a Drawing object, otherwise false. This check does not report whether it has been removed.

getrenderproperty

getrenderproperty(object: DrawingObject, property: string): unknown

getrenderproperty gets a property from a Drawing object, using its name.

Also available as get_render_property.

Parameters

objectDrawingObject
The Drawing object whose property will be accessed.
propertystring
The name of the property to read or change.

Returns

unknown

The current value of the named property, with that property's type.

setrenderproperty

setrenderproperty(object: DrawingObject, property: string, value: unknown): ()

setrenderproperty changes a property on a Drawing object, using its name.

Also available as set_render_property.

Parameters

objectDrawingObject
The Drawing object whose property will be accessed.
propertystring
The name of the property to read or change.
valueunknown
The new value of the named property, using the type required by that property.

Returns

()

This function does not return a value.

cleardrawcache

cleardrawcache(): ()

cleardrawcache removes every active drawing object and shader resource created with Drawing.new.

Also available as clear_draw_cache, cleardrawingcache and clear_drawing_cache.

Returns

()

This function does not return a value.

Fonts

Drawing.Fonts entryValue
UI0
System1
Plex2
Monospace3
Montserrat4

Drawing.Fonts and DrawingImmediate.Fonts provide the font IDs listed above. New Text objects use Drawing.Fonts.Plex (2). The Font property and immediate text functions also accept a custom font returned by DrawFont.Register.

Custom fonts

DrawFont.Register

Yields
DrawFont.Register(data: string, options: DrawFontOptions): DrawFont?

DrawFont.Register loads font bytes from memory and returns a reusable, read-only font for Drawing and DrawingImmediate text.

Parameters

datastring
Raw supported font-file bytes, such as a TrueType file read with readfile. A file path or URL is not font data.
optionsDrawFontOptions
A table with required PixelSize and optional Glyphs. See the option fields below.

Returns

DrawFont?

The font after registration and atlas upload complete, or nil if the font data cannot be loaded, registration is cancelled, or the font-resource budget is exhausted.

Example

local font = DrawFont.Register(readfile("fonts/custom.ttf"), {
PixelSize = 24,
})
assert(font, "Font registration failed")
local label = Drawing.new("Text")
label.Font = font
label.Size = 24
label.Text = "Custom font"
label.Position = Vector2.new(20, 20)
label.Color = Color3.new(1, 1, 1)
label.Visible = true
local bounds = font:GetTextBounds(label.Size, label.Text)
print(bounds.X, bounds.Y)
PixelSize
Type / defaultnumber (required)
Finite rasterization size from 1 to 512 pixels. Choose a size near the one you will draw most often; text at other sizes scales this registered font.
Glyphs
Type / default{{number}}? = nil
Optional nested arrays of individual Unicode code points to preload and allow. Omit it to load the font's supported glyphs as needed. Each inner array lists code points, rather than the endpoints of a range.
local font = DrawFont.Register(readfile("fonts/custom.ttf"), {
PixelSize = 24,
Glyphs = {
{32, 65, 66, 67},
{0x03B1, 0x03B2},
},
})
assert(font, "Font registration failed")

DrawFont:GetTextBounds

DrawFont:GetTextBounds(size: number, text: string): Vector2

font:GetTextBounds measures a string using a registered custom font at the requested text size.

Parameters

sizenumber
Finite text size from 1 to 4096 pixels. This can differ from the font's registered PixelSize.
textstring
The text to measure, including any line breaks.

Returns

Vector2

The width and height of the text in logical screen pixels.

Example

local font = DrawFont.Register(readfile("fonts/custom.ttf"), {PixelSize = 24})
assert(font, "Font registration failed")
local bounds = font:GetTextBounds(24, "Hello\nWorld")
print(bounds.X, bounds.Y)

Common primitive properties

Visible
Type / defaultboolean = false
Whether the drawing is visible.
ZIndex
Type / defaultnumber = 1
Integer layer; larger layers draw later. Creation order breaks ties.
Color
Type / defaultColor3 = Color3.new(0,0,0)
Primitive RGB tint. Set an explicit color.
Transparency
Type / defaultnumber = 1
Opacity: 0 is invisible and 1 is fully visible; the inverse of Roblox Transparency.
__OBJECT_EXISTS
Type / defaultboolean (read-only)
Whether the drawing is still active.
:Remove() / :Destroy()
Type / default() -> ()
Removes the drawing. Call this explicitly when it is no longer needed.

Line

From, To
Type / defaultVector2 = (0,0)
Start/end in logical screen pixels.
Thickness
Type / defaultnumber = 0
Stroke thickness. Set it explicitly for visible strokes.

Circle

Position
Type / defaultVector2 = (0,0)
Center.
Radius
Type / defaultnumber = 1
Radius in pixels.
Thickness
Type / defaultnumber = 16
Stroke thickness.
NumSides
Type / defaultnumber = 100
Circle segment count.
Filled
Type / defaultboolean = false
Filled rather than stroked circle.

Square

Position, Size
Type / defaultVector2 = (0,0)
Top-left and dimensions.
Thickness
Type / defaultnumber = 16
Stroke thickness.
Filled
Type / defaultboolean = false
Whether to fill the rectangle instead of drawing its outline.

Triangle

PointA, PointB, PointC
Type / defaultVector2 = (0,0)
Three corners.
Thickness
Type / defaultnumber = 2
Stroke thickness.
Filled
Type / defaultboolean = false
Filled triangle.

Quad

PointA, PointB, PointC, PointD
Type / defaultVector2 = (0,0)
Four corners.
Thickness
Type / defaultnumber = 2
Stroke thickness.
Filled
Type / defaultboolean = false
Filled quad.

Text

Text
Type / defaultstring = ""
Literal displayed text.
Position
Type / defaultVector2 = (0,0)
Text anchor.
Center
Type / defaultboolean = false
Centers text horizontally.
Outline
Type / defaultboolean = false
Enables outline.
OutlineColor
Type / defaultColor3 = black
Outline RGB.
OutlineTransparency / OutlineOpacity
Type / defaultnumber = 1
Two names for the same outline opacity.
Size
Type / defaultnumber = 16
Finite text size from 1 to 4096 pixels.
Font
Type / defaultnumber | DrawFont = Drawing.Fonts.Plex
A Drawing.Fonts ID or registered custom font. Unsupported nonnegative integer IDs fall back to Plex; assigning a numeric ID replaces any custom font.
TextBounds
Type / defaultVector2 (read-only)
Measured using the current numeric or custom font, size and text.

Image

Data
Type / defaultstring
Assign encoded image bytes to display. Do not use this property to retrieve the most recently assigned input.
Uri
Type / defaultstring
Loads an image from a URL without yielding. Keep the URL separately if you need it later; reading this property does not return the latest requested URL.
Loaded
Type / defaultboolean = false
Whether the image has finished loading and is ready to appear. A completed Uri load may still fail to display; this property is writable.
Position, Size
Type / defaultVector2 = (0,0)
Screen rectangle. A loaded image supplies natural size when no positive size is set.
OriginalSize
Type / defaultVector2 (read-only)
Base dimensions used by ScaleFactor; explicit Size assignment also resets this base.
ScaleFactor
Type / defaultnumber = 1
Changes Size relative to OriginalSize.
Rounding
Type / defaultnumber = 0
Corner rounding.
local label = Drawing.new("Text")
label.Text = "Drawing"
label.Position = Vector2.new(20, 20)
label.Font = Drawing.Fonts.Montserrat
label.Size = 20
label.Color = Color3.new(1, 1, 1)
label.Outline = true
label.Visible = true
-- When this interface closes:
label:Remove()

Shader resource kinds

Shader
RoleCanvas pixel shader or Surface material, with optional vertex deformation.
Backend, Domain, Source, Vertex, Uniforms, UniformTypes, Structs, BindingTypes, Bindings; drawable Position/Size.
Compute
RoleParallel compute program.
Backend, Source, ThreadGroupSize, Groups, AutoDispatch, UpdateRate, Uniforms, Structs, BindingTypes, Bindings.
Buffer
RoleStructured storage.
Backend, Element, Structs, Count, Access, Data, Upload, Readback.
Texture
RoleSampled image or compute-write image.
Backend, Size, Format, Access, Data, Upload, Readback; drawable rectangle.
RenderTarget
RoleOff-screen render destination and sampled image.
Backend, Size, Format, Resize, Readback. Use another object's Texture/Bindings or DrawingImmediate.Texture to show it.
Mesh
RoleIndexed or non-indexed vertex geometry.
Vertices, Indices, Transform, Shader, Uniforms, Bindings, DepthTest, Bloom.
ModelEffect
RoleA shader effect over supported Model, BasePart or EditableMesh geometry.
Target, Shader, Uniforms, Bindings, DepthTest and Bloom. Follows target and camera movement.
Particles
RoleInstanced billboards read from a structured Buffer.
Buffer, optional Shader, Count, Fields, Space, Uniforms, Bindings.

Shared resource state and drawing state

Backend
Type / default"Auto" | "GPU" | "CPU" = "Auto"
Chooses CPU, GPU or automatic rendering. Choose it before Compile or first use; it cannot change afterward.
ActualBackend
Type / default"GPU" | "CPU" | nil (read-only)
The CPU or GPU backend selected after Compile or first use.
LastError
Type / defaultstring? (read-only)
nil when no error is present, otherwise "Drawing failed".
IsRemoved
Type / defaultboolean (read-only)
True after resource removal. __OBJECT_EXISTS is the inverse.
Visible, ZIndex, Transparency
Type / defaultfalse, 1, 1
Visibility, layer and opacity. Compute uses AutoDispatch instead of Visible. Resource Transparency must be from 0 to 1.
Color
Type / defaultColor3 = white
Retained shader/texture/mesh/particle tint.
Position
Type / defaultVector2 = (0,0)
Screen position for drawable objects. Buffer, Compute and RenderTarget do not have this property.
Size
Type / defaultVector2 = (1,1)
Drawable screen dimensions. Texture/RenderTarget initial integer dimensions must be 1..16384; drawable display sizes may be 0..16384.
ResolutionScale
Type / defaultnumber = 1
Off-screen render scale; >0 and <=4.
UpdateRate
Type / defaultnumber = 0
0 updates every render; >0 limits shader refresh or compute simulation to this rate, up to 16384.
Blend
Type / default"Alpha" | "Add" | "Multiply" | "Opaque" = "Alpha"
Compositing mode.
DepthTest
Type / defaultboolean = false
Whether geometry uses depth testing. Occlusion depends on compatible scene depth being available.
Bloom
Type / defaultboolean | BloomOptions = false
Enables bloom or configures Threshold=1, Strength=0.7, Radius=6; each option must be 0..256.
Shader
Type / defaultShader?
Shader used by another drawable; Shader objects refer to themselves by default.
Buffer
Type / defaultBuffer?
Particle storage.
Mesh
Type / defaultMesh?
Geometry resource reference.
Texture
Type / defaultTexture | RenderTarget | nil
Sampled/displayed image resource. Texture objects refer to themselves by default.
RenderTarget
Type / defaultRenderTarget?
Draws into this target instead of the screen. The target clears once per frame, then drawings combine in layer order.
Bindings
Type / default{[string]: DrawingResource} = {}
Named Buffer, Texture or RenderTarget resources matching BindingTypes. Reassign the map to change bindings.
Uniforms
Type / defaultUniformMap = {}
Program defaults or per-draw overrides. Getter returns a copy: reassign the table or use SetUniform to update.

CPU, GPU and shader language

Backend="GPU" runs shaders on the graphics processor. Backend="CPU" runs them on the CPU; both modes use the same HLSL source, not Luau callbacks. Auto chooses GPU when available, otherwise CPU. It does not retry invalid shader source on CPU. Use compatible backends for a program and its bound resources.

Source
Type / defaultstring = ""
Shader or Compute HLSL source, up to 2 MiB. Define the matching function listed below.
Domain
Type / default"Canvas" | "Surface" = "Canvas"
Shader pixel input domain.
Vertex
Type / defaultstring = ""
Shader vertex source. Empty uses identity deformation.
UniformTypes
Type / default{[string]: NumericType} = {}
Explicit uniform types. Define every uniform before Compile; existing types and names cannot change afterward.
Structs
Type / default{[string]: {{string, NumericType}}} = {}
Ordered named layouts shared by Shader, Compute and Buffer; up to 64 structs, 1..64 fields each. Fixed after allocation. Lua field declarations accept the primitive numeric types below.
BindingTypes
Type / default{[string]: BindingType} = {}
Defines up to 16 named shader resources. Set before Compile; call Compile again after changing it.
Canvas pixel
HLSL function to providefloat4 effect(float2 uv)
Normalized canvas UV; return RGBA.
Surface pixel
HLSL function to providefloat4 effect(Surface s)
WorldPosition, Normal, ViewDirection, UV and BaseColor.
Vertex
HLSL function to provideVertex vertex(Vertex v)
Return local Position/Normal/UV/Color before World and ViewProjection transforms. Separate Vertex source; pixel-source helpers are not automatically visible here.
Compute
HLSL function to providevoid compute(uint3 id)
Global thread coordinates. ThreadGroupSize controls the number of threads in each group.

Engine-provided HLSL inputs

Time, DeltaTime, StepDeltaTime
Typefloat
Elapsed time, render delta and simulation-step delta in seconds. Use StepDeltaTime for throttled simulation.
FrameIndex
Typeuint
Frame counter.
Resolution
Typefloat2
Current rendering dimensions.
Opacity
Typefloat
Per-draw opacity, automatically applied to the final color.
World, ViewProjection, NormalMatrix
Typerow_major float4x4
Geometry transforms.
CameraPosition
Typefloat3
World-space camera position.
CanvasRect, FullResolution
Typefloat4
Engine canvas/composition parameters; names reserved.
Vertex
Typestruct
float3 Position, float3 Normal, float2 UV, float4 Color.
Surface
Typestruct
float3 WorldPosition, float3 Normal, float3 ViewDirection, float2 UV, float4 BaseColor.
PixelInput, _EngineTint, engine padding
Typereserved
Reserved names; do not use them for your uniforms, resources or structs.

Uniform values

Uniform and binding identifiers use letters/digits/underscore, start with a letter or underscore and contain 1..128 characters. UniformMap contains at most 256 names. Every numeric component must be finite. Declare uniforms through initial Uniforms, optionally assisted by UniformTypes; changing values is supported, adding/removing program uniform names or changing their types after allocation is rejected.

float
Accepted Luau valuenumber
number
int
Accepted Luau valueinteger in signed 32-bit range; explicit type recommended
number
uint
Accepted Luau valueinteger in unsigned 32-bit range; explicit type required to distinguish from float
number
bool
Accepted Luau valueboolean or typed 0/1
boolean
float2
Accepted Luau valueVector2 or two-number array
Vector2
float3
Accepted Luau valueVector3, Color3 or three-number array
Vector3
float4
Accepted Luau valuefour-number array
four-number array
float4x4
Accepted Luau value16-number array (row-major)
16-number array
{Type = NumericType, Value = value}
Accepted Luau valueExplicit typed wrapper for any row above
Normalized value, without the wrapper

BindingType

Type
Type / default"Buffer" | "Texture" (required)
Structured buffer or 2D texture. RenderTarget values bind as Texture.
Element
Type / defaultstring
Buffer element type/Structs name; Texture float4 by default, or float for R32F.
Access
Type / default"Read" | "ReadWrite" = "Read"
Read declarations produce StructuredBuffer/Texture2D; writable declarations produce RWStructuredBuffer/RWTexture2D. Resource Access must support the requested operation.

A read-only Texture binding also provides a sampler named bindingNameSampler. Do not declare the same resource or sampler again in your HLSL. A pass supports at most 16 read bindings and 8 writable bindings; do not read and write the same resource in one pass. Compute output resources require Access="ReadWrite".

Compute properties

ThreadGroupSize
Type / default{number, number, number} = {64,1,1}
Positive integer dimensions with a product no greater than 1024. Z must not exceed 64.
Groups
Type / default{number, number, number} = {1,1,1}
Retained dispatch group counts, each 1..65535. Total threads are Groups multiplied by ThreadGroupSize.
AutoDispatch
Type / defaultboolean = false
When true, dispatches once per retained update, regardless of Visible. Disable before cleanup.

Buffer and texture storage

Element
Type / defaultstring = "float4"
Buffer numeric type or Structs layout name; fixed after allocation.
Count
Type / defaultnumber = 1
Buffer element count: 1..4194304; total allocation <=256 MiB. Fixed after allocation.
Access
Type / default"Read" | "ReadWrite" = "Read"
Buffer and Texture. Fixed after allocation.
Format
Type / default"RGBA8" | "RGBA16F" | "R32F" = "RGBA8"
Texture and RenderTarget; 4, 8 or 4 bytes per pixel respectively. Fixed after allocation.
Size
Type / defaultVector2 = (1,1)
Texture allocation size before Compile; afterward Size changes display dimensions only. Use Resize for allocation changes. RenderTarget Size addresses allocation size.
Data
Type / defaultstring | {NumericValue} | {Record}
Buffer/Texture initial bytes or decoded elements. Post-allocation writes upload from the beginning. Luau buffer userdata is not accepted by this API.
:Upload(data, firstElement?)
Type / defaultData as above; firstElement=0
Buffer indices are zero-based, and writes must fit allocated Count. Texture uploads replace the complete image and require firstElement=0.
:Readback()
Type / default(table?, string?) or (string?, string?)
Buffer returns an array of decoded elements/records; Texture/RenderTarget returns raw pixel bytes. Readback synchronizes with the device.

For raw buffer strings, store fields in Structs order with 32-bit numeric components. Texture tables contain a flat list of components: RGBA8 uses values from 0 to 1, RGBA16F uses half-floats, and R32F uses float32. Data and Upload accept at most 256 MiB. Readback reads current resource contents; Data reads the configured data and is not a substitute for Readback.

Mesh, ModelEffect and particles

Vertices
Type / default{MeshVertex} = {}
Mesh vertex array, max 4194304; requires nonempty valid geometry to Compile.
MeshVertex.Position
Type / defaultVector3 | {number,number,number}
Required local-space position.
MeshVertex.Normal
Type / defaultfloat3 value; default (0,0,1)
Optional local normal.
MeshVertex.UV
Type / defaultVector2 / two-number array; default (0,0)
Optional texture coordinate.
MeshVertex.Color
Type / defaultColor3 / float3 / float4; default white
Optional vertex RGB or RGBA.
Indices
Type / default{number} = {}
Mesh vertex references are 1-based; max 12582912 indices. Empty uses non-indexed geometry; vertex IDs must exist.
Transform
Type / defaultCFrame | {number}; identity
Mesh world transform; a numeric form must contain 16 matrix elements. Getter returns the 16-number matrix.
Target
Type / defaultInstance? = nil
The Model, BasePart or EditableMesh to draw the effect over. nil removes the target.
Count
Type / defaultnumber = 0
Particles count, 0..4194304; 0 uses available buffer count.
Fields
Type / default{Position: string?, Size: string?, Color: string?}
Particle struct-field names; defaults Position, Size, Color. Names must be valid identifiers.
Space
Type / default"Screen" | "World" = "Screen"
Particle position space; World captures the camera.
Particle position / size / color
Type / defaultnamed structured-buffer fields
Position must be float2 or float3, Size must be float2, and Color must be float4. Supply explicit compatible fields in the buffer layout.

ModelEffect draws a separate effect over supported geometry; it does not replace the target's material. The geometry must be available on the client. Some meshes, including ones requiring deformed or skinned vertices, may not be supported. Reuse resources and avoid large readbacks every frame. Remove each resource when finished.

Resource methods

DrawingResource:Remove

DrawingResource:Remove(): ()

DrawingResource:Remove removes a drawing resource and stops its rendering or automatic compute updates.

Also available as DrawingResource:Destroy.

Returns

()

This function does not return a value.

DrawingResource:Compile

DrawingResource:Compile(): (boolean, string?)

DrawingResource:Compile compiles a shader program or prepares a resource for use.

Returns

(boolean, string?)

True and nil on success, or false and an error string if compilation or allocation fails.

DrawingResource:Upload

DrawingResource:Upload(data: string | table, firstElement: number?): (boolean, string?)

DrawingResource:Upload copies new data into an existing buffer or texture.

Parameters

datastring | table
The bytes or structured values to upload, matching the buffer element layout or texture format.
firstElementnumber?
Optional.The zero-based buffer element at which the upload begins. Texture uploads start at 0. Default 0.

Returns

(boolean, string?)

True and nil on success, or false and an error string if the upload fails.

DrawingResource:Readback

DrawingResource:Readback(): (table | string | nil, string?)

DrawingResource:Readback reads the current contents of a buffer, texture or render target.

Returns

(table | string | nil, string?)

A table of buffer elements or a string of texture bytes, followed by nil. Returns nil and an error string on failure.

DrawingResource:Resize

DrawingResource:Resize(size: Vector2): (boolean, string?)

DrawingResource:Resize changes the dimensions of a texture or render target.

Parameters

sizeVector2
The new allocation dimensions. Both components must be integers from 1 to 16384.

Returns

(boolean, string?)

True and nil on success, or false and an error string if resizing fails.

DrawingResource:SetUniform

DrawingResource:SetUniform(name: string, value: NumericValue): ()

DrawingResource:SetUniform sets the value of a named shader uniform.

Parameters

namestring
The name used to declare the uniform in Uniforms.
valueNumericValue
The new uniform value, matching its declared numeric type.

Returns

()

This function does not return a value.

DrawingResource:GetUniform

DrawingResource:GetUniform(name: string): NumericValue?

DrawingResource:GetUniform gets the stored value of a named shader uniform.

Parameters

namestring
The name used to declare the uniform in Uniforms.

Returns

NumericValue?

The stored uniform value, or nil if the uniform has no stored value.

Compute:Dispatch

Compute:Dispatch(groupsX: number, groupsY: number, groupsZ: number, bindings: BindingMap?, uniforms: UniformMap?): ()

Compute:Dispatch runs a compute program with the requested number of thread groups.

Parameters

groupsXnumber
The number of compute thread groups along the X axis, from 1 to 65535.
groupsYnumber
The number of compute thread groups along the Y axis, from 1 to 65535.
groupsZnumber
The number of compute thread groups along the Z axis, from 1 to 65535.
bindingsBindingMap?
Optional.The resources assigned to the program's named bindings. If omitted, uses its Bindings property. Default program.Bindings.
uniformsUniformMap?
Optional.Named values that override the shader or compute program's declared uniform defaults. Default {}.

Returns

()

This function does not return a value.

Shader, compute and target example

local function compile(resource)
local ok, err = resource:Compile()
assert(ok, err)
return resource
end
local image = Drawing.new("Texture")
image.Backend, image.Size, image.Format, image.Access = "GPU", Vector2.new(64,64), "RGBA8", "ReadWrite"
compile(image)
local simulation = Drawing.new("Compute")
simulation.Backend = "GPU"
simulation.ThreadGroupSize = {8,8,1}
simulation.BindingTypes = {Output = {Type="Texture", Element="float4", Access="ReadWrite"}}
simulation.Bindings = {Output=image}
simulation.Source = [[
void compute(uint3 id) {
if (id.x >= 64 || id.y >= 64) return;
Output[id.xy] = float4(float2(id.xy) / 63.0, 0.5 + 0.5*sin(Time), 1);
}
]]
compile(simulation)
simulation.Groups, simulation.AutoDispatch, simulation.ZIndex = {8,8,1}, true, 0
local pass = Drawing.new("Shader")
pass.Backend, pass.Domain = "GPU", "Canvas"
pass.BindingTypes = {Input={Type="Texture", Element="float4", Access="Read"}}
pass.Bindings = {Input=image}
pass.Uniforms = {Tint={1,1,1,1}}
pass.Source = [[float4 effect(float2 uv) { return Input.Sample(InputSampler, uv) * Tint; }]]
compile(pass)
local target = Drawing.new("RenderTarget")
target.Backend, target.Size = "GPU", Vector2.new(256,256)
compile(target)
pass.Position, pass.Size, pass.RenderTarget = Vector2.zero, Vector2.new(256,256), target
pass.ZIndex, pass.Visible = 1, true
local display = Drawing.new("Texture")
display.Texture, display.Position, display.Size = target, Vector2.new(30,50), Vector2.new(256,256)
display.ZIndex, display.Visible = 2, true
-- Call when the interface closes:
local function cleanup()
simulation.AutoDispatch = false
for _, resource in {display, pass, simulation, image, target} do resource:Remove() end
end