Skip to content

$draw

Draw sprites, text and shapes on screen.

154 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

allow_indicator_icons

$draw.allow_indicator_icons() -> bool

If true, performance indicator icons can be drawn on the HUD.

Returns bool: Indicator icon allowed state.

antialiasing_mode

$draw.antialiasing_mode(cmdlist: Reference, mode: int)

Sets the anti aliasing mode

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
modeintMode index

area_rect_light

$draw.area_rect_light(transform: Component, color: vec3, temperature: float, intensity: float, bounding_radius: float, outer_angle: float, inner_angle: float, width: float, height: float, force_fallback: bool, camera_mask: int, scene: Component, clip_volume: Component, fallback_start_distance: float, fallback_fade_range: float, cast_shadows: bool, dynamic_shadows: bool, shadow_cone_angles: vec2)

Draws a rectangle area light.

ParameterTypeMeaning
transformComponentReference a transform component that positions the light.
colorvec3The light's color.
temperaturefloatColor temperature
intensityfloatThe light's intensity.
bounding_radiusfloatThe bounding radius of the light.
outer_anglefloatThe outer angle of the spot falloff, in degrees.
inner_anglefloatThe inner angle of the spot falloff, in degrees.
widthfloatThe width of the light rectangle.
heightfloatThe height of the light rectangle.
force_fallbackboolIf true, forces the light to use a fallback spot light approximation instead of the full area light.
camera_maskintWhich (split-screen) cameras should draw this light.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').
clip_volumeComponent(Optional) Reference to transform component that will be used as a clipping volume for the light.
fallback_start_distancefloatThe start distance of the spotlight fallback crossfade.
fallback_fade_rangefloatThe distance over which the fallback crossfade happens.
cast_shadowsboolDoes this light cast shadows?
dynamic_shadowsboolEnable dynamic shadow casting for this light.
shadow_cone_anglesvec2Inner (x) and outer (y) cone angles for shadow cone.

box

read-only
$draw.box(center: vec3, rotation: vec4, half_extents: vec3, color: var, lifetime: float)

Draw a wireframe box.

ParameterTypeMeaning
centervec3The center of the box.
rotationvec4The rotation.
half_extentsvec3The half-extents of the box.
colorvarThe line color (vec3 or vec4).
lifetimefloatThe time in seconds for which the box should persist. Zero means a single frame.

calc_text_bounds

read-only
$draw.calc_text_bounds(text: var, font: Reference, font_size: float, width: float, args: list, force_uppercase: bool, allow_word_break: bool) -> vec2

Calculate the rendered size of a text string.

ParameterTypeMeaning
textvarThe text to calculate for.
fontReferenceFont to use.
font_sizefloatPt size for font.
widthfloatPixel width to word wrap on.
argslistList of values to insert into the message.
force_uppercaseboolWhether to force uppercase.
allow_word_breakboolWhether to allow long words to be cut when word is wider than wrap width

Returns vec2: vec2 containing width and height of text.

catch_closing_ring

$draw.catch_closing_ring(cmdlist: Reference, position: vec2, radius: float, opacity: float)

Catch specific. Draws tint effect based on inside or outside of closing ring

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
positionvec2The center of closing ring, ignoring height
radiusfloatThe radius of closing ring.
opacityfloatThe opacity of closing ring. Disabled if 0.0

catch_holowood_lighting_override

$draw.catch_holowood_lighting_override(cmdlist: Reference, color: vec3, temperature: float, direction: vec3, intensity: float, recolor_target: vec3, recolor_alpha: float)

Catch specific. Override the sun light for holowood vignettes.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
colorvec3The light's color.
temperaturefloatColor temperature
directionvec3The direction of the sun light.
intensityfloatThe light's intensity.
recolor_targetvec3The target color to recolor to
recolor_alphafloat0 to 1 value of how much vignettes should be recolored.

catch_holowood_settings

$draw.catch_holowood_settings(cmdlist: Reference, vignette_appear_effect_strength: float, vignette_disappear_effect_strength: float, vignette_disappear_progress: float)

Catch specific. Controls special visual effects for holowood map

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
vignette_appear_effect_strengthfloatThe intensity of vignette appearing effect
vignette_disappear_effect_strengthfloatThe intensity of vignette disappearing effect.
vignette_disappear_progressfloatHow much the vignette has disappeared. 1.0 means fully disappear.

character_light

$draw.character_light(cmdlist: Reference, color: vec3, direction: vec3, temperature: float, intensity: float, shadow_scale: float, rim_light_scale: float, hair_aniso_glow_scale: float)

Draws character light

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
colorvec3Character Light Color.
directionvec3Character Light Direction
temperaturefloatCharacter Light Temperature
intensityfloatCharacter Light Intensity
shadow_scalefloatCharacter Shadow Scale
rim_light_scalefloatCharacter rim light scale.
hair_aniso_glow_scalefloatCharacter hair aniso glow scale.

cmdlist_begin

$draw.cmdlist_begin(priority: int) -> Reference

Open a generic cmdlist. Prefer drawcall3d or drawcall2d for 3d and 2d draws. @see drawcall3d_begin @see drawcall2d_begin

ParameterTypeMeaning
priorityint(optional, default 0) Priority; higher overrides lower. Only recognized by some systems like presentation_adjustments.

Returns Reference: Cmdlist handle.

cmdlist_end

$draw.cmdlist_end(cmdlist: Reference)

Close a generic cmdlist. @see cmdlist_begin

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin

contact_shadow_settings

$draw.contact_shadow_settings(cmdlist: Reference, step_count: int, max_trace_distance: float, penumbra_sharpness: float, distance_fade_start: float, distance_fade_range: float)

Sets the contact shadow settings

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
step_countintNumber of ray steps to take; rounded up to nearest 4. 0 to disable.
max_trace_distancefloatMax trace distance in centimeters
penumbra_sharpnessfloatPenumbra sharpness, 1.0 (softest) and above.
distance_fade_startfloatBegin to fade out contact shadows at this distance from camera (cm)
distance_fade_rangefloatFade out over this distance; all contact shadows disappear at distance_fade_start + distance_fade_range (cm)

cross

read-only
$draw.cross(pos: vec3, color: var, size: float, lifetime: float, draw_on_top: bool)

Draw a cross of a specified size at the specified point.

ParameterTypeMeaning
posvec3The center point.
colorvarThe line color (vec3 or vec4).
sizefloatLength of the cross lines.
lifetimefloatThe time in seconds for which the line should persist. Zero means a single frame.
draw_on_topboolIf the line should be drawn on top

decal

$draw.decal(transform: Component, type: int, priority: int, color: vec4, flags: int, channels: int, blend_radius_range: vec2, normal_cutoff: float, start_fade_percent: float, cull_percent: float, uv_panning_velocity: vec2, atlas: Reference, atlas_key: string, camera_mask: int)

Draws a decal.

ParameterTypeMeaning
transformComponentReference a transform component that positions the decal.
typeintThe decal type, see vrender_decal_type_e.
priorityintDraw order, 0..255; higher = on top.
colorvec4The decal's tint and opacity. Tint may not apply for some decal types.
flagsintDecal flags. Not all flags apply for all decal types. See _vrender_decal_flags_t.
channelsintDecal channels. Controls surfaces that the decal can be projected on.
blend_radius_rangevec2The distance from the center of the radius at which edge fade starts (x) and ends (y), 0..sqrt(2); larger start numbers effectively disable blend. End should be greater than start to be meaningful.
normal_cutofffloatHow much of an angle between the decal box and surface before projection is suppressed. 1..-1, usually something like -0.70 to cutoff at 45 degrees.
start_fade_percentfloatThe percent of the screen covered where a light should start fading.
cull_percentfloatThe percent of the screen covered at which the light should be culled.
uv_panning_velocityvec2Panning velocity of texture coordinate
atlasReferenceAtlas.
atlas_keystringAtlas key, identifying which texture to use in the atlas.
camera_maskintWhich (split-screen) cameras should draw this decal.

directional_light

$draw.directional_light(color: vec3, temperature: float, intensity: float, fade_fraction: float, start_fade_percent: float, cull_percent: float, camera_mask: int, scene: Component, clip_volume: Component)

Draws a bounded directional light.

ParameterTypeMeaning
colorvec3The light's color.
temperaturefloatColor temperature
intensityfloatThe light's intensity.
fade_fractionfloatThe fraction of the bounding box to fade, from the edge.
start_fade_percentfloatThe percent of the screen covered where a light should start fading.
cull_percentfloatThe percent of the screen covered at which the light should be culled.
camera_maskintWhich (split-screen) cameras should draw this light.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').
clip_volumeComponent(Optional) Reference to transform component that will be used as a clipping volume for the light.

dissolve_capsule

$draw.dissolve_capsule(position: vec3, rotation: vec4, channels: int, invert: bool, length: float, radius: float)

Dissolves a capsule from geometry

ParameterTypeMeaning
positionvec3Position of the center of the capsule.
rotationvec4Rotation of the capsule.
channelsintDissolve channels. Controls surfaces that the volume can dissolve.
invertboolIf the shape should be inverted or not.
lengthfloatThe length of the capsule.
radiusfloatThe radius of the capsule

drawcall2d_begin

$draw.drawcall2d_begin(texture: Reference, sampler: Reference, sort: var, render_pass_name: string) -> Reference

Initialize a draw command for a sprite.

ParameterTypeMeaning
textureReferenceReference to a texture to draw.
samplerReferenceOptional reference to a sampler to use for the texture.
sortvarSort value to use.
render_pass_namestringRender pass name (optional); if set, use the first render target instead of texture.

Returns Reference: Draw call handle.

drawcall2d_color

$draw.drawcall2d_color(drawcall: Reference, value: vec4)

Set the primary color of the sprite verts.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
valuevec4The value of the color.

drawcall2d_color_overlay

$draw.drawcall2d_color_overlay(drawcall: Reference, value: vec4)

Set the overlay color of a sprite draw

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
valuevec4The value of the color.

drawcall2d_mask

$draw.drawcall2d_mask(drawcall: Reference, texture: Reference, sampler: Reference, box_x: vec2, box_y: vec2, box_pos: vec2, opacity: float, uv_scale: vec2, uv_offset: vec2, world_locator: Component)

Set the sprite mask texture and projection.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
textureReferenceThe mask texture.
samplerReferenceOptional sampler to use for the mask texture.
box_xvec2The X-axis basis of the mask box projection.
box_yvec2The Y-axis basis of the mask box projection.
box_posvec2The position of the center of the box projection.
opacityfloatThe influence of this mask on sprites (1: full influence, 0: no influence).
uv_scalevec2The scale applied to the mask texture UVs.
uv_offsetvec2The offset applied ot the mask texture UVs.
world_locatorComponentreference to a ui_world_locator.vscript component to attach world position to

drawcall2d_material_begin

$draw.drawcall2d_material_begin(drawcall: Reference) -> Reference

Instantiate a material for the drawcall2d in the specified draw command. Cannot change material settings for the base material after the call. Note need to use the return value to feed into material attribute function's drawcall input.

ParameterTypeMeaning
drawcallReferenceReference to the draw call.

Returns Reference: Material draw call handle.

drawcall2d_material_end

$draw.drawcall2d_material_end(drawcall: Reference)

Finish a drawcall2d material instance specification.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin

drawcall2d_material_override

$draw.drawcall2d_material_override(drawcall: Reference, material: Reference)

Specify a different material instance for sprite rendering.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
materialReferenceMaterial instance to draw the sprite with.

drawcall2d_mouse_cursor

$draw.drawcall2d_mouse_cursor(drawcall: Reference)

Mark this sprite as a mouse cursor. It will be given an updated position at draw time, such that the top left corner of the quad matches the latest mouse position.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin

drawcall2d_position

$draw.drawcall2d_position(drawcall: Reference, ul: vec2, ur: vec2, ll: vec2, lr: vec2)

Set the four corners of the sprite draw.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
ulvec2Upper Left Coord.
urvec2Upper Right Coord.
llvec2Lower Left Coord.
lrvec2Lower Right Coord.

drawcall2d_scissor

$draw.drawcall2d_scissor(drawcall: Reference, ul: vec2, lr: vec2)

Define screen bounds to scissor this sprite.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
ulvec2Upper Left Scissor Box Coord.
lrvec2Lower Right Scissor Box Coord.

drawcall2d_set_additive

$draw.drawcall2d_set_additive(drawcall: Reference, value: bool)

Set the additive blend mode property of this sprite.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
valueboolTrue or false for additive setting.

drawcall2d_set_dissolve

$draw.drawcall2d_set_dissolve(drawcall: Reference, dissolve: bool)

Set the vui dissolve value.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
dissolveboolTrue or false for dissolve setting.

drawcall2d_uvs

$draw.drawcall2d_uvs(drawcall: Reference, ul: vec2, ur: vec2, ll: vec2, lr: vec2)

Override the UV coords for the four corners of the sprite.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
ulvec2Upper Left UV
urvec2Upper Right UV
llvec2Lower Left UV
lrvec2Lower Right UV

drawcall2d_world_locator

$draw.drawcall2d_world_locator(drawcall: Reference, world_locator: Component)

Attach the drawcall2d to a location in 3d world defined by a ui_world_locator component

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
world_locatorComponentreference to a ui_world_locator.vscript component to attach world position to

drawcall3d_animation

$draw.drawcall3d_animation(drawcall: Reference, model: Reference, entity: Entity, bones_bindings: list, allowed_error: float)

Sample the blended animation from the input animation lists, and set the bone transformation matrices for draw command

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
modelReferenceModel on which to animate.
entityEntityThe entity to retrive pose from, also used for combining skeletons for animation. Must be the same entity as input from animation.set_model_pose.
bones_bindingslistList of physics bones bindings
allowed_errorfloatAllowed world unit error when posing skeleton. Higher values allow faster processing

drawcall3d_begin

$draw.drawcall3d_begin(model: Reference, cmd_list_index: int, model_type: int, use_local_transform: bool, local_position: vec3, local_rotation: vec4, local_scale: vec3, interpolation_id: int) -> Reference

Open a draw command with the specified model. It will use transform component from calling entity, plus optional local transform.

ParameterTypeMeaning
modelReferenceThe model to draw.
cmd_list_indexintOptional offset for additional command lists.
model_typeintThe model type.
use_local_transformboolWhether to add local transform
local_positionvec3Local position.
local_rotationvec4Local rotation.
local_scalevec3Local scale.
interpolation_idintThe interpolation id. If this is changed during two command lists, out won't try to interpolate them.

Returns Reference: Draw call handle.

drawcall3d_bounds

$draw.drawcall3d_bounds(model: Reference, position: vec3, scale: vec3, color: vec3)

Draw bounding sphere of the specified model.

ParameterTypeMeaning
modelReferenceThe model to draw bounds of.
positionvec3The sphere position.
scalevec3The sphere scale.
colorvec3The line color.

drawcall3d_camera_mask

$draw.drawcall3d_camera_mask(drawcall: Reference, mask: int)

Specify a mask indicating the camera indices where the model should draw.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
maskintThe mask. For example, a mask of 101 means the first and third split-screen cameras should draw this model.

drawcall3d_cast_shadow

$draw.drawcall3d_cast_shadow(drawcall: Reference, cast_shadow: bool, cast_local_shadow: bool)

Specify whether to enable or disable a model's shadow casting. If not called, default to enabled.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
cast_shadowboolWhether to enable model to cast sun shadow.
cast_local_shadowboolWhether to enable model to cast local light shadow.

drawcall3d_decal_mask

$draw.drawcall3d_decal_mask(drawcall: Reference, decal_mask: int)

Specify which decal channels can cast on this model with a mask.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
decal_maskintThe decal mask.

drawcall3d_disable_draw_on_top

$draw.drawcall3d_disable_draw_on_top(drawcall: Reference, slot: int, material: Reference)

Open a material in the specified draw command on a specified slot and make it not drawn on top

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
slotintThe model material slot.
materialReferenceThe material to apply.

drawcall3d_enable_draw_on_top

$draw.drawcall3d_enable_draw_on_top(drawcall: Reference, slot: int, material: Reference)

Open a material in the specified draw command on a specified slot and make it drawn on top

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
slotintThe model material slot.
materialReferenceThe material to apply.

drawcall3d_end

$draw.drawcall3d_end(drawcall: Reference)

Close a draw command list.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin

drawcall3d_marker

$draw.drawcall3d_marker(drawcall: Reference, marker: int)

Specify a marker which this model is drawn relative to.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
markerintMarker ID.

drawcall3d_material

$draw.drawcall3d_material(drawcall: Reference, slot: int, material: Reference)

Open a material in the specified draw command on a specified slot. Note that all the following material attributes will change this material instead until next drawcall3d_material.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
slotintThe model material slot. Override all slots if -1
materialReferenceThe material to apply.

drawcall3d_material_all_outline_draws

$draw.drawcall3d_material_all_outline_draws(drawcall: Reference, material: Reference, model: Reference, invert: bool)

Open a draw command on all of materials that can draw outline, and override with outline material.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
materialReferenceThe material to apply.
modelReferenceThe model ref we are drawing
invertboolIf true, open command for all non-outline materials

drawcall3d_material_multi

$draw.drawcall3d_material_multi(drawcall: Reference, mask: int, material: Reference)

Open a material in the specified draw command on a mask for multiple material slots. Note that all the following material attributes will change this material instead until next drawcall3d_material.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
maskintThe mask indicating which materials to override
materialReferenceThe material to apply.

drawcall3d_model_bounds

$draw.drawcall3d_model_bounds(drawcall: Reference, model: Reference, position: vec3, radius: float, draw_bounds: bool)

Set bounding sphere of the specified model.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
modelReferenceThe model to set the bounds of.
positionvec3The sphere position.
radiusfloatThe radius of the bounding sphere.
draw_boundsboolDraw debug bounding-sphere

drawcall3d_model_lod_authority

$draw.drawcall3d_model_lod_authority(drawcall: Reference, lod_authority: Component, cmd_list_index: int)

Sets the model to copy this model's current LOD level from.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
lod_authorityComponentThe model which dictates this model's LOD level.
cmd_list_indexintOptional offset for additional command lists.

drawcall3d_model_lod_thresholds

$draw.drawcall3d_model_lod_thresholds(drawcall: Reference, overrides: list)

Overrides the model's LOD thresholds

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
overrideslistList of floats, each of which is a screen percent threshold.

drawcall3d_prime

$draw.drawcall3d_prime(drawcall: Reference, other_cmd_list_index: int, other_model: Reference)

If needed, inherit transforms and other data from another draw. Used to prime new drawcalls on the same model.

ParameterTypeMeaning
drawcallReferenceReference to the current draw call. @see drawcall3d_begin
other_cmd_list_indexintOther command list to use for priming. Should match the other drawcall3d_begin, not the current one.
other_modelReferenceOther model to use for priming. Should match the other drawcall3d_begin, not the current one.

drawcall_material_attribute

$draw.drawcall_material_attribute(drawcall: Reference, member: string, value: var)

Set an uniform attribute in material draw.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
memberstringThe name of the attribute.
valuevarThe value to set the attribute to.

drawcall_material_attribute_vec4_precise

$draw.drawcall_material_attribute_vec4_precise(drawcall: Reference, member: string, xyz: vec3, w: float)

Set a vec4 uniform attribute in material draw. Using a vec3 xyz and float w as input to make sure input vec4 is not packed.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
memberstringThe name of the attribute.
xyzvec3The xyz value to set the attribute to.
wfloatThe w value to set the attribute to.

drawcall_material_color

$draw.drawcall_material_color(drawcall: Reference, member: string, value: var, color_override: int)

Set the primary color in a specified material draw.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
memberstringThe name of the color parameter.
valuevarThe value of the color (vec3 or vec4).
color_overrideintHow the color parameter affects the material color (see the enum in model.vscript.)

drawcall_material_cull_mode

$draw.drawcall_material_cull_mode(drawcall: Reference, cull_mode: int)

Set cull mode of a material. Note it cannot be changed after gpu resource is readied.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
cull_modeintThe cull mode in vgpu_cull_mode_e

drawcall_material_draw_order

$draw.drawcall_material_draw_order(drawcall: Reference, draw_order: int, is_offset: bool)

Set draw order of a material

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
draw_orderintThe draw order. Should range between -16 to 15
is_offsetboolWhether to treat the draw order as an offset from original draw order

drawcall_material_sort_stage

$draw.drawcall_material_sort_stage(drawcall: Reference, sort_stage: int, ignore_opaque: bool, ignore_translucent: bool)

Set sort stage of a material

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
sort_stageintThe sort stage. See vrender_draw_call_sort_stage_t.
ignore_opaqueboolWhether to ignore if material is opaque.
ignore_translucentboolWhether to ignore if material is translucent.

drawcall_material_stencil

$draw.drawcall_material_stencil(drawcall: Reference, enabled: bool, fail_op: int, pass_op: int, depth_fail_op: int, compare_op: int, compare_mask: int, write_mask: int, ref: int)

Set stencil state overrides for material draw. All settings are optional, those not provided will fall back to defaults.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
enabledboolEnable or disable stencil entirely.
fail_opintThe operation to apply when the stencil test fails.
pass_opintThe operation to apply when the stencil test passes.
depth_fail_opintThe operation to apply when the depth test fails.
compare_opintThe comparison operation for stencil testing.
compare_maskintThe mask applied to stencil values prior to comparison. Useful for testing a subset of stencil bits. Valid range [0-255].
write_maskintThe mask applied when modifying the stencil buffer via a stencil operation. Useful to updating a subset of stencil bits. Valid range [0-255].
refintThe stencil reference value. Meaning varies depending on stencil operation. Valid range [0-255].

drawcall_material_texture

$draw.drawcall_material_texture(drawcall: Reference, slot: int, texture: Reference)

Set a texture in a specified material draw.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
slotintTexture slot index.
textureReferenceReference to texture.

drawcall_material_type_override

$draw.drawcall_material_type_override(drawcall: Reference, material_type: int)

Override the material type of a material. Note it cannot be changed after gpu resource is readied.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall3d_begin
material_typeintThe material type from vrender_material_type_e

drawcall_scene

$draw.drawcall_scene(drawcall: Reference, scene: Component)

Draw to a specific scene.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see e.g. drawcall3d_begin
sceneComponentThe scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

fog

$draw.fog(color: vec3, sun_color: vec3, density: float, height_density: float, height_falloff: float, color_exponent: float, start_distance: float, start_height: float, ibl_fog_power: float, ibl_fog_enabled: bool)

Draws exponential height fog.

ParameterTypeMeaning
colorvec3Fog color.
sun_colorvec3Fog sun color.
densityfloatDistance fog density.
height_densityfloatHeight fog density.
height_fallofffloatHeight falloff.
color_exponentfloatColor/Sun color lerp exponent.
start_distancefloatFog start disatance.
start_heightfloatFog start height.
ibl_fog_powerfloatIBL Fog Power.
ibl_fog_enabledboolIBL Fog Enabled.

force_show_indicator_icons

$draw.force_show_indicator_icons() -> bool

If true, performance indicator icons must be drawn on the HUD.

Returns bool: Indicator icon show state.

get_client_display_rate

$draw.get_client_display_rate(user: User) -> int

Get the display refresh rate for a client user.

ParameterTypeMeaning
userUserThe user whose name controls the movement pattern.

Returns int: Render refresh rate

get_client_window_state

$draw.get_client_window_state(user: User) -> int

Get the window state flags for a client user.

ParameterTypeMeaning
userUserThe user whose name controls the movement pattern.

Returns int: Window state flags; @see vwm_window_state_flags_t

get_current_display_mode_refresh_rate_hz

read-only
$draw.get_current_display_mode_refresh_rate_hz() -> int

Get the current display refresh rate of the current display mode (fullscreen display mode if we are in exclusive fullscreen, otherwise desktop display mode.)

Returns int: Refresh rate in Hz

get_default_mask_owner_only

$draw.get_default_mask_owner_only() -> bool

Get the default owner_masking boolean

Returns bool: True if owner only masking desired

get_default_material_from_model_by_slot_index

$draw.get_default_material_from_model_by_slot_index(model: Reference, slot_index: int) -> Reference

Get a reference to a model's default material by material slot index

ParameterTypeMeaning
modelReferenceThe model to draw.
slot_indexintThe material slot index

Returns Reference: The reference to default material instance (vrender_material_instance_t)

get_display_mode_list

$draw.get_display_mode_list() -> list

Get the list of supported exclusive fullscreen modes in [0-vec3(x: mode0_width, y: mode0_height, z: mode0_refresh rate), 1-int(mode0_format), 2-vec3(x: mode1_width, y: mode1_height, z: mode1_refresh rate), 3-int(mode1_surface_format), ...]

Returns list: The list of supported exclusive fullscreen modes in [0-vec3(x: mode0_width, y: mode0_height, z: mode0_refresh rate), 1-int(mode0_format), 2-vec3(x: mode1_width, y: mode1_height, z: mode1_refresh rate), 3-int(mode1_surface_format), ...]

get_exclusive_fullscreen_display_mode

$draw.get_exclusive_fullscreen_display_mode() -> list

Get current exclusive fullscreen mode in [0-vec3(x: mode0_width, y: mode0_height, z: mode0_refresh rate), 1-int(mode0_format)]

Returns list: Current exclusive fullscreen mode in [0-vec3(x: mode0_width, y: mode0_height, z: mode0_refresh rate), 1-int(mode0_format)]

get_fps_cap_for_current_display

$draw.get_fps_cap_for_current_display() -> int

Get the FPS cap setting for the current display

Returns int: Current fps_cap_level for this window while on its current display (0: Unlimited, otherwise: Display Hz / N)

get_fullscreen

$draw.get_fullscreen() -> int

Get window fullscreen mode

Returns int: 0 for windowed, 1 for borderless fullscreen, 2 for exclusive fullscreen

get_material_texture_slot_index_by_name

$draw.get_material_texture_slot_index_by_name(material: Reference, texture_slot_name: string) -> int

Get the texture slot index from a material

ParameterTypeMeaning
materialReferenceThe material instance to get texture slot index from
texture_slot_namestringName of texture slot

Returns int: Slot index, or -1 if not found

get_model_bounding_radius

read-only
$draw.get_model_bounding_radius(model: Reference, scale: vec3) -> float

Get the world scale bounding radius of a model

ParameterTypeMeaning
modelReferenceThe model.
scalevec3The world scale of the model's transform.

Returns float: Bounding radius of the given model

get_model_bounds_max

read-only
$draw.get_model_bounds_max(model: Reference, scale: vec3) -> vec3

Get the maximum of a model's bounding box

ParameterTypeMeaning
modelReferenceThe model.
scalevec3The world scale of the model's transform.

Returns vec3: The given model's bounding box maximum

get_model_bounds_min

read-only
$draw.get_model_bounds_min(model: Reference, scale: vec3) -> vec3

Get the minimum of a model's bounding box

ParameterTypeMeaning
modelReferenceThe model.
scalevec3The world scale of the model's transform.

Returns vec3: The given model's bounding box minimum

get_model_material_slot_count

$draw.get_model_material_slot_count(model: Reference) -> int

Get number of material slots in a model (from lod 0)

ParameterTypeMeaning
modelReferenceThe model to draw.

Returns int: Number of material slots

get_model_material_slot_index_by_slot_name

read-only
$draw.get_model_material_slot_index_by_slot_name(model: Reference, slot_name: string) -> int

Get the slot index from a material slot name

ParameterTypeMeaning
modelReferenceThe model to draw.
slot_namestringName of material slot

Returns int: Slot index, or -1 if not found

get_model_opaque_material_slot_mask

$draw.get_model_opaque_material_slot_mask(model: Reference) -> int

Get a bitmask containing opaque material (whatever is not transparency sorted) slots from a model.

ParameterTypeMeaning
modelReferenceThe model.

Returns int: The bitmask containing opaque material slots from a model.

get_override_slot_material

$draw.get_override_slot_material(override: Reference) -> Reference

Get the material being overridden for a given slot.

ParameterTypeMeaning
overrideReferenceThe slot override.

Returns Reference: The material being overridden.

get_override_slot_name

$draw.get_override_slot_name(override: Reference) -> string

Get the name of the slot being overridden.

ParameterTypeMeaning
overrideReferenceThe slot override.

Returns string: Name of slot being overridden.

get_pipelines_pending

$draw.get_pipelines_pending() -> bool

If true, vgpu is still working on building shader pipelines.

Returns bool: True if pipeline builds are pending.

get_platform_default_shadow_resolution_enum

$draw.get_platform_default_shadow_resolution_enum() -> int

Get the platform default shadow resolution. See vrender_shadow_resolution_t.

Returns int: The platform default shadow resolution. See vrender_shadow_resolution_t. Note this is not the shadow quality level in user settings.

get_sprite_bounds

read-only
$draw.get_sprite_bounds(texture: Reference, authored_for_1080p: bool, authored_for_4k: bool) -> vec2

Get the width and height of a texture asset.

ParameterTypeMeaning
textureReferenceReference to a texture to query.
authored_for_1080pboolIf the asset dimensions are designed for a 1080p canvas.
authored_for_4kboolIf the asset dimensions are designed for a 4k canvas.

Returns vec2: vec2 containing width and height of texture.

get_window_display_index

read-only
$draw.get_window_display_index() -> int

Get current display index for the window

Returns int: The display index

get_window_size

read-only
$draw.get_window_size(user: User) -> vec2

Get window size for a user.

ParameterTypeMeaning
userUserUser identifier.

Returns vec2: The window size.

gi_volume

$draw.gi_volume(gi_data: Reference, fade_dist: float, priority: int, scene: Component)

Draws a GI volume.

ParameterTypeMeaning
gi_dataReferenceBaked GI probe data
fade_distfloatGI volume fade distance in cm.
priorityintGI volume priority
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

is_hud_visible

read-only
$draw.is_hud_visible() -> bool

Returns true if the HUD is currently visible.

Returns bool: If hud should be visible.

is_world_point_in_view

read-only
$draw.is_world_point_in_view(point: vec3, user: User, viewport_transform: vec4) -> bool

Checks whether a world position is in viewport

ParameterTypeMeaning
pointvec3World-space point
userUserUser identifier.
viewport_transformvec4xy: viewport position, zw : viewport size, both are normalized between 0.0 and 1.0 (full window)

Returns bool: Whether the position is in viewport

line

read-only
$draw.line(a: vec3, b: vec3, color: var, width: float, lifetime: float, draw_on_top: bool)

Draw a line between two points.

ParameterTypeMeaning
avec3The first point.
bvec3The second point.
colorvarThe line color (vec3 or vec4).
widthfloatThe line width.
lifetimefloatThe time in seconds for which the line should persist. Zero means a single frame.
draw_on_topboolIf the line should be drawn on top

main_viewport_transform

$draw.main_viewport_transform(viewport_transform: vec4)

Request a specific main viewport transform.

ParameterTypeMeaning
viewport_transformvec4Vector where x,y is requested viewport origin in range [0,1] and z,w is width,height in range [0,1].

make_color

$draw.make_color(r: float, g: float, b: float, a: float) -> vec4

Build an RGBA color value.

ParameterTypeMeaning
rfloatRed in the range 0 to 1.
gfloatGreen in the range 0 to 1.
bfloatBlue in the range 0 to 1.
afloatAlpha in the range 0 to 1.

Returns vec4: A color.

make_nine_slice

$draw.make_nine_slice(window_ul: vec2, window_ur: vec2, window_ll: vec2, window_lr: vec2, box_dimensions: vec2, sprite_dimensions: vec2, border_authoring_scale: float, border_ul: vec2, border_lr: vec2) -> list

Build a list of values to use in drawing a nine slice sprite.

ParameterTypeMeaning
window_ulvec2Upper left corner.
window_urvec2Upper right corner.
window_llvec2Lower left corner.
window_lrvec2Lower right corner.
box_dimensionsvec2Dimensions of the ui box.
sprite_dimensionsvec2Dimensions of the sprite.
border_authoring_scalefloatScale to apply to all border thicknesses to account for authoring scale.
border_ulvec2Border thickness from the upper left corner in pixels.
border_lrvec2Border thickness from the bottom right in pixels.

Returns list: List of sets of 6 values (ul, ur, ll, lr, ul_uv, lr_uv).

movie_update

$draw.movie_update(cmdlist: Reference, movie: Reference, y_texture: Reference, uv_texture: Reference, min_t_ms: int, max_t_ms: int)

Updates movie textures.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
movieReferenceThe movie object.
y_textureReferenceThe y texture to update.
uv_textureReferenceThe uv texture to update.
min_t_msintWindow start in ms.
max_t_msintWindow end in ms.

music_sync

$draw.music_sync(cmdlist: Reference, beat: float, beat_duration: float, beat_count: int)

Set current music sync beat for uses in shaders.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
beatfloatThe current beat. Each integer is a whole beat.
beat_durationfloatThe current beat duration in seconds.
beat_countintThe accumulated beat count.

occlusion_query

$draw.occlusion_query(cmdlist: Reference, half_extents: vec3) -> bool

Checks if a bounding box is fully occluded. Occlusion query is done on GPU, results a several frames old.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
half_extentsvec3The half-extents of the box.

Returns bool: True if the box is fully occluded. Otherwise, false.

pipeline_prewarm_list

$draw.pipeline_prewarm_list(pipeline_list: Reference)

Send a list of pipelines to render to be prewarmed when corresponding shaders are loaded.

ParameterTypeMeaning
pipeline_listReferenceReference to a .pipelines file.

planar_reflection

$draw.planar_reflection(cmdlist: Reference, position: vec3, rotation: vec4, distance_fade: vec2, angle_fade: vec2, normal_distortion_strength: float)

Draws planar reflections.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
positionvec3The position of the reflection plane.
rotationvec4The rotation of the reflection plane.
distance_fadevec2Start and end distances for distance fade (in cm.)
angle_fadevec2Start and end angles for angle fade (in degrees).
normal_distortion_strengthfloatThe amount of normal offset applied to reflection sampling.

plot

$draw.plot(name: string, value: float)

Add a value to a named plot.

ParameterTypeMeaning
namestringThe name of the plot.
valuefloatThe value to add.

plot_clear

$draw.plot_clear(name: string)

Clear a named plot.

ParameterTypeMeaning
namestringThe name of the plot.

plot_compare

$draw.plot_compare(name: string, file: string)

Compare a named plot which one previously written to a file.

ParameterTypeMeaning
namestringThe name of the plot.
filestringThe image file name whose contents will be compared against.

point_light

$draw.point_light(transform: Component, color: vec3, temperature: float, intensity: float, bounding_radius: float, start_fade_percent: float, cull_percent: float, camera_mask: int, scene: Component, clip_volume: Component, cast_shadows: bool, dynamic_shadows: bool)

Draws a point light.

ParameterTypeMeaning
transformComponentReference a transform component that positions the light.
colorvec3The light's color.
temperaturefloatColor temperature
intensityfloatThe light's intensity.
bounding_radiusfloatThe bounding radius of the light.
start_fade_percentfloatThe percent of the screen covered where a light should start fading.
cull_percentfloatThe percent of the screen covered at which the light should be culled.
camera_maskintWhich (split-screen) cameras should draw this light.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').
clip_volumeComponent(Optional) Reference to transform component that will be used as a clipping volume for the light.
cast_shadowsboolEnable shadow casting for this light.
dynamic_shadowsboolEnable dynamic shadow casting for this light.

postprocessing_bloom

$draw.postprocessing_bloom(cmdlist: Reference, enabled: bool, input_threshold: vec3, output_scale: vec3)

Sets the bloom input threshold.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
enabledboolBloom enabled flag.
input_thresholdvec3The HDR input threshold color. max(input - threshold, 0)
output_scalevec3The HDR output scale factor.

postprocessing_brightness

$draw.postprocessing_brightness(cmdlist: Reference, brightness: float)

Sets the brightness for the display output

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
brightnessfloatValue of brightness

postprocessing_car_camera_grading

$draw.postprocessing_car_camera_grading(cmdlist: Reference, tint: vec3, intensity: float, exposure: float, brightness: float, gamma: float, contrast: float, saturation: float)

Control car camera color grading

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
tintvec3Tint Color
intensityfloatIntensity of Tint
exposurefloatIntensity of Exposure
brightnessfloatIntensity of Brightness
gammafloatIntensity of Gamma
contrastfloatIntensity of Contrast
saturationfloatIntensity of Saturation

postprocessing_contrast

$draw.postprocessing_contrast(cmdlist: Reference, contrast: float)

Sets the contrast for the display output

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
contrastfloatValue of contrast

postprocessing_distortion

$draw.postprocessing_distortion(cmdlist: Reference, scale: float)

Sets the parameters for the distortion.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
scalefloatScale to apply to distortion (valid range is greater than 0 and less than or equal to 1).

postprocessing_dof

$draw.postprocessing_dof(cmdlist: Reference, dof_enabled: bool, dof_focus_plane: float, dof_lens_radius: float, dof_blur_radius: float, firefly_suppression: float, bokeh_edge_count: int, bokeh_rotation_degrees: float, quality: int)

Sets the parameters for the depth of field

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
dof_enabledboolWhether the dof passes are enabled true/false
dof_focus_planefloatWhere the focus plane of the depth of field is, everything beyond this will be blurred
dof_lens_radiusfloatThe radius of the lens in pixels. Larger values mean faster blurring.
dof_blur_radiusfloatHow many pixels will contribute to the blur
firefly_suppressionfloatThe strength of brightness weighting to reduce flicker.
bokeh_edge_countintNumber of edges for polygonal bokeh, or circular bokeh for values < 3.
bokeh_rotation_degreesfloatRotation of polygon bokeh, in degrees.
qualityintQuality level of bokeh blur.

postprocessing_exposure

$draw.postprocessing_exposure(cmdlist: Reference, exposure: float, emissive_bias: float)

Sets the relative exposure (in EV_100) for the display output

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
exposurefloatRelative exposure in EV_100
emissive_biasfloatBias (in EV_100) applied to scene exposure for emissive surfaces.

postprocessing_hue

$draw.postprocessing_hue(cmdlist: Reference, hue: float)

Sets the hue for the display output

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
huefloatValue of hue angle in degrees -180 to 180

postprocessing_outlines

$draw.postprocessing_outlines(cmdlist: Reference, width_pixels: float, color: vec4, max_distance: float)

Sets the parameters for postprocess outlines

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
width_pixelsfloatOutline width in pixels.
colorvec4Outline color
max_distancefloatThe maximum distance; edges beyond this distance will not generate outlines.

postprocessing_outlines_glow

$draw.postprocessing_outlines_glow(cmdlist: Reference, width_pixels: float, inner_color: vec4, outer_color: vec4, stencil_compare_mask: int, stencil_reference: int)

Sets the parameters for outline-based glow postprocess

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
width_pixelsfloatOutline width in pixels.
inner_colorvec4Outline color at inner edge.
outer_colorvec4Outline color at outer edge.
stencil_compare_maskintStencil comparison bitmask.
stencil_referenceintStencil reference value.

postprocessing_radial_blur

$draw.postprocessing_radial_blur(cmdlist: Reference, enabled: bool, bias: float, max_distance: float, chromatic_aberration: float, center_offset: vec2)

Sets the radial blur settings

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist
enabledboolRadial Blur enabled flag
biasfloatThe amount to bias the center out by. making this larger makes the unblurred region larger
max_distancefloatThe max distance a blur can spread
chromatic_aberrationfloatIntensity of chromatic aberration, value is represented as a 0 to 1 range
center_offsetvec2Offset of the center of the blur

postprocessing_render_target_translation

$draw.postprocessing_render_target_translation(cmdlist: Reference, translation: vec2)

Sets the translation for render targets

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
translationvec2The translation of the render target in range of -1 to 1

postprocessing_saturation

$draw.postprocessing_saturation(cmdlist: Reference, saturation: float)

Sets the saturation for the display output

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
saturationfloatValue of saturation

postprocessing_ssao

$draw.postprocessing_ssao(cmdlist: Reference, mode: int, radius: float, intensity: float, normal_bias: float)

Sets the SSAO mode + options

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
modeintCurrent mode. Refer to vrender_postprocess_ambientocclusion_mode_t
radiusfloatWorld space radius of AO sampling, in cm.
intensityfloatScales effect intensity, higher is darker.
normal_biasfloatSmall bias value to prevent noise due to Z buffer precision.

postprocessing_sunshafts

$draw.postprocessing_sunshafts(cmdlist: Reference, enabled: bool, layer0_tint: vec3, layer1_tint: vec3, layer2_tint: vec3, final_tint: vec3, decay: float, radius: float, shaft_threshold: float, sunburst_intensity: float)

Sets the sunshaft effect settings.

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
enabledboolEnable / disable the effect.
layer0_tintvec3Tint color for blur layer 0.
layer1_tintvec3Tint color for blur layer 1.
layer2_tintvec3Tint color for blur layer 2.
final_tintvec3Tint color for final output.
decayfloatDecay multiplier for blur falloff. Range: [0, 1]
radiusfloatSampling radius for blur. Range: [0, 0.5]
shaft_thresholdfloatSunshaft Threshold
sunburst_intensityfloatIntensity of the sunburst mask [0-1].

postprocessing_tint

$draw.postprocessing_tint(cmdlist: Reference, tint: vec3, intensity: float)

Sets a tint for the display output

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
tintvec3Color of tint
intensityfloatIntensity of tint

postprocessing_tonemapping

$draw.postprocessing_tonemapping(cmdlist: Reference, tonemapping_a: float, tonemapping_b: float, tonemapping_c: float, tonemapping_d: float, tonemapping_e: float, tonemapping_f: float, tonemapping_w: float)

Sets the parameters for the tonemapping

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
tonemapping_afloatshoulder strength
tonemapping_bfloatlinear strength
tonemapping_cfloatlinear angle
tonemapping_dfloattoe strength
tonemapping_efloattoe numerator
tonemapping_ffloattoe denominator
tonemapping_wfloatlinear white point

postprocessing_vignette

$draw.postprocessing_vignette(cmdlist: Reference, inner_color: vec3, inner_intensity: float, outer_color: vec3, outer_intensity: float, center: vec2, radii: vec2, color_falloff: float, intensity_falloff: float, blend_mode: float)

Sets the parameters for the vignette

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
inner_colorvec3Inner color of vignette
inner_intensityfloatInner intensity of vignette
outer_colorvec3Outer color of vignette
outer_intensityfloatOuter intensity of vignette
centervec2Center point of the vignette
radiivec2Radius values in x and y for the vignette ellipse
color_fallofffloatFalloff parameter for controlling the blend between inner and outer color
intensity_fallofffloatFalloff parameter for controlling the alpha intensity outside of the vignette ellipse
blend_modefloatControls the blending of the vignette, 0 is additive, 1 is alpha-blend and values between mix the two

postprocessing_vui

$draw.postprocessing_vui(cmdlist: Reference, dissolve_animation_time: float, dissolve_cutoff: float, dissolve_edge_cutoff: float, dissolve_edge_blend: float, dissolve_transparency: float, dissolve_direction: float, dissolve_texture_direction: float, dissolve_texture_scroll_speed: float, dissolve_gradient_a: vec4, dissolve_gradient_b: vec4, dissolve_gradient_c: vec4, glitch_strength: vec4, glitch_grid_size: vec2, glitch_animation_speed: float)

Controls UI post-processing effects

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
dissolve_animation_timefloatAnimation time of effect
dissolve_cutofffloatTheshold for texture cutoff
dissolve_edge_cutofffloatTheshold for edge texture cutoff
dissolve_edge_blendfloatTheshold for edge texture blend
dissolve_transparencyfloatThe transparency of the dissolve
dissolve_directionfloatDirection of the dissolve on screen
dissolve_texture_directionfloatDirection of the texture scrolling
dissolve_texture_scroll_speedfloatSpeed of the texture scrolling
dissolve_gradient_avec4First color of the gradient
dissolve_gradient_bvec4Second color of the gradient
dissolve_gradient_cvec4Third color of the gradient
glitch_strengthvec4UI Glitch Strength
glitch_grid_sizevec2UI Glitch Grid Size
glitch_animation_speedfloatUI Glitch Animation Speed

probe

$draw.probe(position: vec3, rotation: vec4, scale: vec3, probe_data: Reference, fade_fractions: vec3, priority: int, camera_mask: int, scene: Component, offset: vec3, volume_type: int, distant_probe: bool)

Draws a probe.

ParameterTypeMeaning
positionvec3Position from transform component.
rotationvec4Rotation from transform component.
scalevec3Scale from transform component.
probe_dataReferenceProbe data.
fade_fractionsvec3Probe fade fractions
priorityintProbe priority.
camera_maskintWhich (split-screen) cameras should draw this probe.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').
offsetvec3The local-space offset applied when capturing the probe.
volume_typeintThe volume type: box, sphere, or cylinder.
distant_probeboolIs this a distant probe? (Disables parallax correction.)

probe_from_world

$draw.probe_from_world(probe_data: Reference, fade_fractions: vec3, priority: int, camera_mask: int, scene: Component, offset: vec3, volume_type: int, distant_probe: bool)

Draws a probe.

ParameterTypeMeaning
probe_dataReferenceProbe data.
fade_fractionsvec3Probe fade fractions
priorityintProbe priority.
camera_maskintWhich (split-screen) cameras should draw this probe.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').
offsetvec3The local-space offset applied when capturing the probe.
volume_typeintThe volume type: box, sphere, or cylinder.
distant_probeboolIs this a distant probe? (Disables parallax correction.)

select_ramp_index

$draw.select_ramp_index(index: int, texture_size: int, ramp_count: int, scene: Component)

sets the index of the color ramp to use.

ParameterTypeMeaning
indexintThe index of the requested ramp.
texture_sizeintThe size of the texture ramp.
ramp_countintThe total amount of ramps.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

set_exclusive_fullscreen_display_mode

$draw.set_exclusive_fullscreen_display_mode(resolution_and_refresh_rate: vec3, format: int)

Set target exclusive fullscreen mode

ParameterTypeMeaning
resolution_and_refresh_ratevec3xy: resolution, z: refresh rage
formatintA format which should match return value from get_exclusive_fullscreen_display_mode() or get_display_mode_list()

set_fps_cap_for_current_display

$draw.set_fps_cap_for_current_display(fps_cap_level: int)

Set the FPS cap setting for the current display

ParameterTypeMeaning
fps_cap_levelint0: Unlimited, otherwise: Display Hz / N

set_frame_buffer_count

$draw.set_frame_buffer_count(count: int)

Set the frame buffer count

ParameterTypeMeaning
countintFrame buffer count.

set_fullscreen

$draw.set_fullscreen(fullscreen: int)

Set window to windowed mode, or one of the fullscreen modes

ParameterTypeMeaning
fullscreenint0 for windowed, 1 for borderless fullscreen, 2 for exclusive fullscreen

set_global_visual_time

$draw.set_global_visual_time(time: int)

Set visual time for vfx and shader for this frame. If not called, will use virtual time * default time interval.

ParameterTypeMeaning
timeintTime in milliseconds

shader_graph_custom_globals_single

$draw.shader_graph_custom_globals_single(cmdlist: Reference, custom_globals_set_index: int, channel_index: int, value: float, no_interpolate: bool, scene: Component)

Sets shader graph custom globals data (single-channel)

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist to add this command to. @see cmdlist_begin
custom_globals_set_indexintIndex of the custom globals set to drive
channel_indexintWhich channel on the specified custom globals set to drive
valuefloatValue to drive the specified custom globals set and channel
no_interpolatebool(Optional) Disables interpolation of value from the prior frame
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

shader_graph_custom_globals_xyzw

$draw.shader_graph_custom_globals_xyzw(cmdlist: Reference, custom_globals_set_index: int, value: vec4, no_interpolate: bool, scene: Component)

Sets shader graph custom globals data (XYZW channels)

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist to add this command to. @see cmdlist_begin
custom_globals_set_indexintIndex of the custom globals set to drive
valuevec4XYZW value
no_interpolatebool(Optional) Disables interpolation of value from the prior frame
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

shadow_settings

$draw.shadow_settings(cmdlist: Reference, near_plane_override: float, far_plane: float, cascade_fade_amount: float, cascade_split_adjustment: float, cascade_count: int, resolution: int, resolution_splitscreen: int, normal_offset_bias: float, depth_plane_bias_clamp: float, disable_staggered_update: bool)

Sets the shadow settings

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
near_plane_overridefloatShadow near plane override.
far_planefloatShadow far plane
cascade_fade_amountfloatShadow cascade fade amount (0 - 1)
cascade_split_adjustmentfloatShadow cascade split distribution adjustment factor (0 - 1)
cascade_countintNumber of shadow cascade slices to render.
resolutionintEnum describing the shadow resolution to use.
resolution_splitscreenintEnum describing the shadow resolution to use for splitscreen cases.
normal_offset_biasfloatShadow bias applied by offseting sample along surface normal.
depth_plane_bias_clampfloatClamp value for automatic depth bias.
disable_staggered_updateboolDisables the staggered shadow update, so all cascades update each frame.

shadow_volume

$draw.shadow_volume(cmdlist: Reference, transform: Component, generation: int, is_static: bool)

Sets a volume to tightly limit shadow map rendering

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
transformComponentReference to a transform component describing the volume.
generationintChange this value to force the shadow to rerender (even if static).
is_staticboolIf true, indicates a shadow volume is used as a static fallback shadow map, will only be rerendered when the volume moves or the generation changes.

show_watermark_regions

$draw.show_watermark_regions(user: User, scale: vec2)

Show the regions that the on-screen watermark will be placed.

ParameterTypeMeaning
userUserThe user whose name controls the movement pattern.
scalevec2Window scale.

special_light

$draw.special_light(light_type: int, use_direction: bool, use_color: bool, direction: vec3, color: vec4, scene: Component)

sets a special light direction (sun/rim/fill).

ParameterTypeMeaning
light_typeintThe light's type.
use_directionboolDo we want to use the direction information from the light.)
use_colorboolDo we want to use the color information from the light.)
directionvec3The direction of the special light.
colorvec4The light's color.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

special_shadow

$draw.special_shadow(color: vec4, scene: Component)

sets a special shadow color.

ParameterTypeMeaning
colorvec4The shadow's color.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

sphere

read-only
$draw.sphere(position: vec3, color: var, radius: float, divisions: int, lifetime: float, use_non_uniform_scale: bool, non_uniform_scale: vec3)

Draw a sphere.

ParameterTypeMeaning
positionvec3The origin of the sphere.
colorvarThe line color (vec3 or vec4).
radiusfloatThe radius of the sphere.
divisionsintThe number of subdivisions in the sphere mesh.
lifetimefloatThe time in seconds for which the sphere should persist. Zero means a single frame.
use_non_uniform_scaleboolWhether to use 'scale' to scale the sphere
non_uniform_scalevec3Only used when use_non_uniform_scale is true. The scale of the debug sphere to be drawn. Can be non-uniform

spot_light

$draw.spot_light(transform: Component, color: vec3, temperature: float, direction: vec3, intensity: float, bounding_radius: float, start_fade_percent: float, cull_percent: float, outer_angle: float, inner_angle: float, camera_mask: int, scene: Component, clip_volume: Component, cast_shadows: bool, dynamic_shadows: bool, inner_shadow_angle: float, outer_shadow_angle: float)

Draws a spot light.

ParameterTypeMeaning
transformComponentReference a transform component that positions the light.
colorvec3The light's color.
temperaturefloatColor temperature
directionvec3The direction of the spot light.
intensityfloatThe light's intensity.
bounding_radiusfloatThe bounding radius of the light.
start_fade_percentfloatThe percent of the screen covered where a light should start fading.
cull_percentfloatThe percent of the screen covered at which the light should be culled.
outer_anglefloatThe outer angle of the spot light, in degrees.
inner_anglefloatThe inner angle of the spot light, in degrees.
camera_maskintWhich (split-screen) cameras should draw this light.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').
clip_volumeComponent(Optional) Reference to transform component that will be used as a clipping volume for the light.
cast_shadowsboolEnable shadow casting for this light.
dynamic_shadowsboolEnable dynamic shadow casting for this light.
inner_shadow_anglefloatInner cone angle for shadow cone.
outer_shadow_anglefloatOuter cone angle for shadow cone.

sun_disc

$draw.sun_disc(direction: vec3)

Sets direction of the sun's visual disc.

ParameterTypeMeaning
directionvec3The direction of the sun disc.

sun_light

$draw.sun_light(color: vec3, temperature: float, direction: vec3, intensity: float, scene: Component)

Draws the sun light.

ParameterTypeMeaning
colorvec3The light's color.
temperaturefloatColor temperature
directionvec3The direction of the sun light.
intensityfloatThe light's intensity.
sceneComponent(Optional) The scene component, e.g. entity.get_hierarchy_singleton(type: 'scene.vscript').

text

$draw.text(text: string, pos: vec2, alignment: vec2, font: Reference, font_size: float, color: vec4, wrap: float, args: list, sort: var, dissolve_ui: bool)

Draw some text to screen.

ParameterTypeMeaning
textstringThe text to draw.
posvec2Location of the text.
alignmentvec2Used for justification.
fontReferenceFont to use.
font_sizefloatPt size for font.
colorvec4Color of the text.
wrapfloatPixel width to word wrap on.
argslistList of values to insert into the message.
sortvarSort value to use (optional, otherwise assumes debug text).
dissolve_uiboolWhether the ui element should be dissolved or not

text_color_overlay

$draw.text_color_overlay(drawcall: Reference, value: vec4)

Set the color overlay for a text draw that affect both the text and the glyph

ParameterTypeMeaning
drawcallReferenceReference to the text draw call.
valuevec4The overlay color

text_mask

$draw.text_mask(drawcall: Reference, texture: Reference, sampler: Reference, box_x: vec2, box_y: vec2, box_pos: vec2, opacity: float, uv_scale: vec2, uv_offset: vec2, world_locator: Component)

Set the sprite mask texture and projection for a text draw.

ParameterTypeMeaning
drawcallReferenceReference to the draw call. @see drawcall2d_begin
textureReferenceThe mask texture.
samplerReferenceOptional sampler to use for the mask texture.
box_xvec2The X-axis basis of the mask box projection.
box_yvec2The Y-axis basis of the mask box projection.
box_posvec2The position of the center of the box projection.
opacityfloatThe influence of this mask on sprites (1: full influence, 0: no influence).
uv_scalevec2The scale applied to the mask texture UVs.
uv_offsetvec2The offset applied ot the mask texture UVs.
world_locatorComponentreference to a ui_world_locator.vscript component to attach world position to

text_material_begin

$draw.text_material_begin(drawcall: Reference, material: Reference, cmd_list_index: int) -> Reference

Instantiate a material for the text in the specified draw command. Note that we need to use the return value to feed into material attribute function's drawcall input.

ParameterTypeMeaning
drawcallReferenceReference to the draw call.
materialReferenceReference to the custom material.
cmd_list_indexintIndex of cmdlist, need to be different if we have multiple text draws in one component.

Returns Reference: Material draw call handle.

text_material_end

$draw.text_material_end(drawcall: Reference)

Finish a text material instance specification.

ParameterTypeMeaning
drawcallReferenceReference to the material draw call. @see text_material_begin

text_material_set_dissolve

$draw.text_material_set_dissolve(drawcall: Reference, dissolve: bool)

Set the vui dissolve value.

ParameterTypeMeaning
drawcallReferenceReference to the draw call
dissolveboolTrue or false for dissolve setting.

ui_world_locator

$draw.ui_world_locator(position: vec3, camera_index: int, pin_to_edge: bool, margin: vec4)

Place a locator in world space for ui to attach to. (For example, overhead widget and offscreen indicator).

ParameterTypeMeaning
positionvec3The position.
camera_indexintThe camera index to use for projection
pin_to_edgeboolPin to edge if off-screen.
marginvec4How much to inset from left, top, right and bottom when pinned to edge of screen (normalized so 1.0 is half viewport width or height). 0 means no margin and the point will be pinned to the exact edge of the screen. Positive moves the pinned point in as a percentage of screen width.

update_watermark_position

$draw.update_watermark_position(user: User, octal_index: int, bounds: vec2, scale: vec2) -> list

Gets the next position of an on-screen watermark. As an anti-leak measure, the position changes in a pattern based on user's ID.

ParameterTypeMeaning
userUserThe user whose name controls the movement pattern.
octal_indexintThe current octal index into the user's publisher ID.
boundsvec2Size of the watermark.
scalevec2Window scale.

Returns list: The new octal index and the current screen position of the watermark.

user_settings

$draw.user_settings(cmdlist: Reference, gamma_correction: float, bloom_allowed: bool, ssao_enabled: bool, vsync_enabled: int, refresh_rate: int, resolution_scale: float, dynamic_resolution_enabled: bool, dof_enabled: bool, shadow_cascade_max_count: int, shadow_resolution_enum: int, sunshafts_enabled: bool, dynamic_resolution_explicit_frame_time_target_ms: float, local_light_shadows_enabled: bool, gi_volumes_enabled: bool, aniso_filtering_boost: int)

Sets the user graphics settings

ParameterTypeMeaning
cmdlistReferenceReference to the cmdlist. @see cmdlist_begin
gamma_correctionfloatThe gamma correction.
bloom_allowedboolWhether bloom is allowed
ssao_enabledboolWhether ssao is enabled
vsync_enabledintWhether vsync is enabled (0 = off, 1 = on, 2 = adaptive)
refresh_rateintDisplay refresh rate
resolution_scalefloatThe resolution scale
dynamic_resolution_enabledboolWhether dynamic resolution scaling is enabled
dof_enabledboolWhether depth of field is enabled
shadow_cascade_max_countintMaximum number of shadow cascades.
shadow_resolution_enumintShadow resolution. See vrender_shadow_resolution_t.
sunshafts_enabledboolWhether sunshafts are enabled
dynamic_resolution_explicit_frame_time_target_msfloatExplicit target ms for dynamic resolution (0 disables explicit setting and uses refresh rate).
local_light_shadows_enabledboolWhether local light shadows are enabled
gi_volumes_enabledboolWhether GI volumes are enabled
aniso_filtering_boostintAnisotropic filtering boost for compatible textures (0: None)

viewport

$draw.viewport(scene_view: string, camera: string, tl: vec2, dimensions: vec2)

For a given scene view, set viewport override. Optionally update camera width and height as well.

ParameterTypeMeaning
scene_viewstringscene_view name, should match scene_view.vscript.
camerastringOptional camera name, should match e.g. fixed_camera.vscript.
tlvec2Top left of viewport.
dimensionsvec2Viewport dimensions.

vui_calculate_window

$draw.vui_calculate_window(parent_ui_box: Component, attach_to_world: bool, position: vec2, dimensions: vec2, rotation: float, scale: vec2, pivot: vec2, anchor: vec2, alpha: float, manual_sort: int, position_is_screen_space: bool, is_distorted_box: bool, apply_safe_zone_margins: bool)

Calculate the window for this UI box given a parent.

ParameterTypeMeaning
parent_ui_boxComponentReference to parent UI box.
attach_to_worldboolTrue or false to attach to world.
positionvec2Position of this UI box.
dimensionsvec2Dimensions of this UI box.
rotationfloatRotation of this UI box.
scalevec2Scale of this UI box.
pivotvec2Pivot of this UI box.
anchorvec2Anchor of this UI box.
alphafloatAlpha of this UI box.
manual_sortintManual sort value of this UI box.
position_is_screen_spaceboolTrue or false if position is in screen space.
is_distorted_boxboolTrue or false if ui_box is a distorted box type.
apply_safe_zone_marginsboolTrue or false if ui_box should apply safe zone margins.

vui_get_canvas_size

read-only
$draw.vui_get_canvas_size() -> vec2

Get the canvas size for UI. A canvas sized ui element will fill the whole screen.

Returns vec2: The canvas size.

vui_get_default_window

read-only
$draw.vui_get_default_window() -> list

Get the default window for relative sprite / text rendering.

Returns list: List containing x, y, width, height, x scale, y scale.

vui_get_sort_value

$draw.vui_get_sort_value(category: int, manual: int) -> var

Calculate a sorting value based on some settings and the caller's hierarchy.

ParameterTypeMeaning
categoryintMost significant sort key.
manualintMiddle significance sort override.

Returns var: Sort value to provide to drawcall2d functions.

world_point_to_screen

$draw.world_point_to_screen(point: vec3, user: User, clamp_to_screen: bool, viewport_relative: bool, viewport_coordinates: bool, viewport_transform: vec4) -> vec3

Converts a point in world space to the screen.

ParameterTypeMeaning
pointvec3World-space point
userUserUser identifier.
clamp_to_screenboolClamp to the bounds of the screen?
viewport_relativeboolIf false, absolute screen position. If true, don't offset to be relative to the user's splitscreen viewport.
viewport_coordinatesboolIf true, return viewport coordinates - [0, 1], otherwise use pixel coordinates.
viewport_transformvec4xy: viewport position, zw : viewport size, both are normalized between 0.0 and 1.0 (full window)

Returns vec3: Projected point in x, y, sign of point in z.

world_point_to_screen_pinned

$draw.world_point_to_screen_pinned(point: vec3, user: User, margin: float, viewport_relative: bool, viewport_transform: vec4) -> list

Converts a point in world space to the screen. The resultant point is pinned to the edge of the screen, less the margin.

ParameterTypeMeaning
pointvec3World-space point
userUserUser identifier.
marginfloatHow much to inset. [-1, 1). 0 means no margin and the point will be pinned to the exact edge of the screen. Positive moves the pinned point in as a percentage of screen width.
viewport_relativeboolIf false, absolute screen position. If true, don't offset to be relative to the user's splitscreen viewport.
viewport_transformvec4xy: viewport position, zw : viewport size, both are normalized between 0.0 and 1.0 (full window)

Returns list: A list of [0: projected point x, 1: projected point y, 2: was the point pinned?, 3: vec2(min screen x, max screen x), 4: vec2(min screen y, max screen y)].