> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: render
description: 2D drawing primitives for screen overlays
icon: monitor
---

The `render` namespace provides 2D drawing primitives, font and image loading, and screen-space helpers for overlays.

## screen\_size

```lua
render.screen_size(): vector
```

<Schema title="Returns">
  <SchemaField name="size" type="vector">
    The screen size vector.
  </SchemaField>
</Schema>

## camera\_position

```lua
render.camera_position(): vector
```

> Returns the camera position vector.

<Schema title="Returns">
  <SchemaField name="position" type="vector">
    The camera position vector.
  </SchemaField>
</Schema>

## camera\_angles

```lua
render.camera_angles([angles: vector]): vector
```

> Returns or sets the camera angles.

<Schema title="Parameters">
  <SchemaField name="angles" type="vector">
    New camera angles.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="angles" type="vector">
    The camera angles.
  </SchemaField>
</Schema>

## world\_to\_screen

```lua
render.world_to_screen(position: vector): vector
```

> Returns the screen position vector, or `nil` if the world position is not visible on your screen. This can only be called from the render callback.

<Note>
  Note that there is a cleaner alternative, the [`:to_screen`](/csgo/api-reference/namespaces/vector#to_screen) vector function.
</Note>

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Position in world space.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="screen_position" type="vector">
    The screen position vector, or `nil` if the world position is not visible on your screen.
  </SchemaField>
</Schema>

## get\_offscreen

```lua
render.get_offscreen(position: vector, radius: number[, accurate: boolean]): vector, number, boolean
```

> Returns the `position`, `rotation`, and `is_out_of_fov` arguments or `nil` on failure.

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Position in world space.
  </SchemaField>

  <SchemaField name="radius" type="number" required>
    Distance from the center of the screen as a percentage in the range \[0.0, ∞].
  </SchemaField>

  <SchemaField name="accurate" type="boolean">
    Optional. If true then accurate calculations will be used.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="position" type="vector">
    Screen coordinates (Returns ellipse-based position if the world position is out of FOV).
  </SchemaField>

  <SchemaField name="rotation" type="number">
    Yaw axis that can be used to rotate drawing stuff.
  </SchemaField>

  <SchemaField name="is_out_of_fov" type="boolean">
    Returns `true` if the world position is out of FOV.
  </SchemaField>
</Schema>

## get\_pixel

```lua
render.get_pixel(position: vector)
```

> Returns the color of the specified pixel on the screen.

<Warning>
  Getting the color of the pixel is a heavy process. Do not do it inside callbacks that are called a lot of times per second.
</Warning>

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="color" type="color">
    The color of the specified pixel on the screen.
  </SchemaField>
</Schema>

## load\_font

> Returns the `font` struct or `nil` on failure.

<Note>
  Render any text via the [`draw:text`](/csgo/api-reference/namespaces/render#text) function.
</Note>

<Tabs>
  <Tab title="Size as a number">
    ```lua
    render.load_font(name: string, size: number[, flags: string]): font
    ```

    <Schema title="Parameters">
      <SchemaField name="name" type="string" required>
        Font that will be initialized.
      </SchemaField>

      <SchemaField name="size" type="number" required>
        Size of the font.
      </SchemaField>

      <SchemaField name="flags" type="string">
        Optional. a for anti-aliasing, i for cursive text, and b for bold text, o for outlined text, d for the drop shadow effect.
      </SchemaField>
    </Schema>
  </Tab>

  <Tab title="Size as a vector">
    ```lua
    render.load_font(name: string, size: vector[, flags: string]): font
    ```

    <Schema title="Parameters">
      <SchemaField name="name" type="string" required>
        Font that will be initialized.
      </SchemaField>

      <SchemaField name="size" type="vector" required>
        A vector object containing width, height, and spacing.
      </SchemaField>

      <SchemaField name="flags" type="string">
        Optional. a for anti-aliasing, i for cursive text, and b for bold text, o for outlined text, d for the drop shadow effect, u to enable extra symbol support.
      </SchemaField>
    </Schema>
  </Tab>
</Tabs>

<Schema title="Returns">
  <SchemaField name="font" type="font">
    The `font` struct or `nil` on failure.
  </SchemaField>
</Schema>

## load\_image

```lua
render.load_image(contents: string, size: vector): texture
```

> Returns the `texture` struct or `nil` on failure. Supports JPG, PNG, BMP, SVG, and GIF formats.

<Note>
  Render any image via the [`:texture`](/csgo/api-reference/namespaces/render#texture) function.
</Note>

<Schema title="Parameters">
  <SchemaField name="contents" type="string" required>
    Raw image file contents.
  </SchemaField>

  <SchemaField name="size" type="vector" required>
    Size of the image.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="image" type="texture">
    The `texture` struct or `nil` on failure.
  </SchemaField>
</Schema>

## load\_image\_rgba

```lua
render.load_image_rgba(contents: string, size: vector): texture
```

> Returns the `texture` struct or `nil` on failure.

<Note>
  Render any image via the [`:texture`](/csgo/api-reference/namespaces/render#texture) function.
</Note>

<Schema title="Parameters">
  <SchemaField name="contents" type="string" required>
    RGBA buffer (HEX encoded).
  </SchemaField>

  <SchemaField name="size" type="vector" required>
    Size of the image.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="image" type="texture">
    The `texture` struct or `nil` on failure.
  </SchemaField>
</Schema>

## load\_image\_from\_file

```lua
render.load_image_from_file(path: string, size: vector): texture
```

> Returns the `texture` struct or `nil` on failure. Supports JPG, PNG, BMP, SVG, and GIF formats.

<Note>
  Render any image via the [`:texture`](/csgo/api-reference/namespaces/render#texture) function.
</Note>

<Info>
  Loading images from game resources is supported.

  Example: `render.load_image_from_file 'materials/panorama/images/icons/ui/warning.svg'`
</Info>

<Schema title="Parameters">
  <SchemaField name="path" type="string" required>
    Path to the image.
  </SchemaField>

  <SchemaField name="size" type="vector" required>
    Size of the image.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="image" type="texture">
    The `texture` struct or `nil` on failure.
  </SchemaField>
</Schema>

## measure\_text

```lua
render.measure_text(font: font[, flags: string], text: string): vector
```

> Returns the measured size of the text.

<Schema title="Parameters">
  <SchemaField name="font" type="font" required>
    Font object or 1 for Default font, 2 for Small font, or 3 for Console font.
  </SchemaField>

  <SchemaField name="flags" type="string">
    Optional. s for DPI scaled text.
  </SchemaField>

  <SchemaField name="text" type="string" required>
    Text that will be measured.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="size" type="vector">
    The measured size of the text.
  </SchemaField>
</Schema>

## highlight\_hitbox

```lua
render.highlight_hitbox(entity: entity, hitbox: number, color: color)
```

> Highlights the specified hitbox / hitboxes.

<Schema title="Parameters">
  <SchemaField name="entity" type="entity" required>
    The player whose hitbox(es) are to be highlighted.
  </SchemaField>

  <SchemaField name="hitbox" type="number" required>
    Hitbox index (an integer between 0 and 18). A table with hitbox indices can also be used to highlight multiple hitboxes. Pass 19 to highlight every hitbox.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    The color with which you want to highlight the hitbox(es).
  </SchemaField>
</Schema>

## get\_scale

```lua
render.get_scale(type: number): number
```

> Returns the DPI scale value.

<Schema title="Parameters">
  <SchemaField name="type" type="number" required>
    The type of DPI scale to return. 1 - Menu Scale, 2 - ESP Scale.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="scale" type="number">
    The DPI scale value.
  </SchemaField>
</Schema>

### Structs

<AccordionGroup>
  <Accordion title="struct texture">
    <Schema>
      <SchemaField name="img.width" type="number">
        Width of the image.
      </SchemaField>

      <SchemaField name="img.height" type="number">
        Height of the image.
      </SchemaField>

      <SchemaField name="img.resolution" type="number">
        Resolution of the image.
      </SchemaField>
    </Schema>
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="struct font">
    <Schema>
      <SchemaField name="font.width" type="number">
        Width of the font.
      </SchemaField>

      <SchemaField name="font.height" type="number">
        Height of the font.
      </SchemaField>

      <SchemaField name="font.spacing" type="number">
        Spacing of the font.
      </SchemaField>

      <SchemaField name="set_size" type="function">
        Sets the new font size. `:set_size(size: number | vector)` — a vector contains width, height, and spacing.
      </SchemaField>
    </Schema>
  </Accordion>
</AccordionGroup>

### Draw functions

## blur

```lua
render.blur(position_a: vector, position_b: vector, strength: number, alpha: number[, rounding: number])
```

<Schema title="Parameters">
  <SchemaField name="position_a" type="vector" required>
    Start position.
  </SchemaField>

  <SchemaField name="position_b" type="vector" required>
    End position.
  </SchemaField>

  <SchemaField name="strength" type="number" required>
    Blur strength.
  </SchemaField>

  <SchemaField name="alpha" type="number" required>
    Alpha percentage in the range \[0.0, 1.0].
  </SchemaField>

  <SchemaField name="rounding" type="number">
    Optional. Rounding of the blur rectangle in pixels.
  </SchemaField>
</Schema>

## line

```lua
render.line(position_a: vector, position_b: vector, color: color)
```

<Schema title="Parameters">
  <SchemaField name="position_a" type="vector" required>
    Start position.
  </SchemaField>

  <SchemaField name="position_b" type="vector" required>
    End position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the line.
  </SchemaField>
</Schema>

## poly

```lua
render.poly(color: color, positions: vector[, ...])
```

<Schema title="Parameters">
  <SchemaField name="color" type="color" required>
    Color of the polyline.
  </SchemaField>

  <SchemaField name="positions" type="vector" required>
    Screen positions.
  </SchemaField>

  <SchemaField name="..." type="vector">
    Comma-separated vectors to concatenate with positions.
  </SchemaField>
</Schema>

## poly\_blur

```lua
render.poly_blur(opacity: number, strength: number, positions: vector[, ...])
```

<Schema title="Parameters">
  <SchemaField name="opacity" type="number" required>
    Opacity percentage in the range \[0.0, 1.0].
  </SchemaField>

  <SchemaField name="strength" type="number" required>
    Blur strength.
  </SchemaField>

  <SchemaField name="positions" type="vector" required>
    Screen positions.
  </SchemaField>

  <SchemaField name="..." type="vector">
    Comma-separated vectors to concatenate with positions.
  </SchemaField>
</Schema>

## poly\_line

```lua
render.poly_line(color: color, positions: vector[, ...])
```

<Schema title="Parameters">
  <SchemaField name="color" type="color" required>
    Color of the polyline.
  </SchemaField>

  <SchemaField name="positions" type="vector" required>
    Screen positions.
  </SchemaField>

  <SchemaField name="..." type="vector">
    Comma-separated vectors to concatenate with positions.
  </SchemaField>
</Schema>

## rect

```lua
render.rect(position_a: vector, position_b: vector, color: color[, rounding: number, no_clamp: boolean])
```

<Schema title="Parameters">
  <SchemaField name="position_a" type="vector" required>
    Start position.
  </SchemaField>

  <SchemaField name="position_b" type="vector" required>
    End position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the rectangle.
  </SchemaField>

  <SchemaField name="rounding" type="number">
    Optional. Rounding of the rectangle in pixels.
  </SchemaField>

  <SchemaField name="no_clamp" type="boolean">
    Optional. If true, negative sizes will be allowed.
  </SchemaField>
</Schema>

## rect\_outline

```lua
render.rect_outline(position_a: vector, position_b: vector, color: color[, thickness: number, rounding: number, no_clamp: boolean])
```

<Schema title="Parameters">
  <SchemaField name="position_a" type="vector" required>
    Start position.
  </SchemaField>

  <SchemaField name="position_b" type="vector" required>
    End position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the rectangle.
  </SchemaField>

  <SchemaField name="thickness" type="number">
    Optional. Thickness of the rectangle in pixels.
  </SchemaField>

  <SchemaField name="rounding" type="number">
    Optional. Rounding of the rectangle in pixels.
  </SchemaField>

  <SchemaField name="no_clamp" type="boolean">
    Optional. If true, position\_a \< position\_b will be allowed.
  </SchemaField>
</Schema>

## gradient

```lua
render.gradient(position_a: vector, position_b: vector, top_left: color, top_right: color, bottom_left: color, bottom_right: color[, rounding: number])
```

<Schema title="Parameters">
  <SchemaField name="position_a" type="vector" required>
    Start position.
  </SchemaField>

  <SchemaField name="position_b" type="vector" required>
    End position.
  </SchemaField>

  <SchemaField name="top_left" type="color" required>
    Color of the top left rectangle position.
  </SchemaField>

  <SchemaField name="top_right" type="color" required>
    Color of the top right rectangle position.
  </SchemaField>

  <SchemaField name="bottom_left" type="color" required>
    Color of the bottom left rectangle position.
  </SchemaField>

  <SchemaField name="bottom_right" type="color" required>
    Color of the bottom right rectangle position.
  </SchemaField>

  <SchemaField name="rounding" type="number">
    Optional. Rounding of the gradient in pixels.
  </SchemaField>
</Schema>

## circle

```lua
render.circle(position: vector, color: color, radius: number, start_deg: number, pct: number)
```

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the circle.
  </SchemaField>

  <SchemaField name="radius" type="number" required>
    Radius of the circle in pixels.
  </SchemaField>

  <SchemaField name="start_deg" type="number" required>
    0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  </SchemaField>

  <SchemaField name="pct" type="number" required>
    Percentage in the range \[0.0-1.0] determining how full the circle is.
  </SchemaField>
</Schema>

## circle\_outline

```lua
render.circle_outline(position: vector, color: color, radius: number, start_deg: number, pct: number[, thickness: number])
```

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the circle.
  </SchemaField>

  <SchemaField name="radius" type="number" required>
    Radius of the circle in pixels.
  </SchemaField>

  <SchemaField name="start_deg" type="number" required>
    0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  </SchemaField>

  <SchemaField name="pct" type="number" required>
    Percentage in the range \[0.0-1.0] determining how full the circle is.
  </SchemaField>

  <SchemaField name="thickness" type="number">
    Optional. Thickness of the outline in pixels.
  </SchemaField>
</Schema>

## circle\_gradient

```lua
render.circle_gradient(position: vector, color_outer: color, color_inner: color, radius: number, start_deg: number, pct: number)
```

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="color_outer" type="color" required>
    Outer color of the circle.
  </SchemaField>

  <SchemaField name="color_inner" type="color" required>
    Inner color of the circle.
  </SchemaField>

  <SchemaField name="radius" type="number" required>
    Radius of the circle in pixels.
  </SchemaField>

  <SchemaField name="start_deg" type="number" required>
    0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  </SchemaField>

  <SchemaField name="pct" type="number" required>
    Percentage in the range \[0.0-1.0] determining how full the circle is.
  </SchemaField>
</Schema>

## circle\_3d

```lua
render.circle_3d(position: vector, color: color, radius: number, start_deg: number, pct: number[, outline: boolean])
```

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the circle.
  </SchemaField>

  <SchemaField name="radius" type="number" required>
    Radius of the circle in pixels.
  </SchemaField>

  <SchemaField name="start_deg" type="number" required>
    0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  </SchemaField>

  <SchemaField name="pct" type="number" required>
    Percentage in the range \[0.0-1.0] determining how full the circle is.
  </SchemaField>

  <SchemaField name="outline" type="boolean">
    Optional. Render the circle outline.
  </SchemaField>
</Schema>

## circle\_3d\_outline

```lua
render.circle_3d_outline(position: vector, color: color, radius: number, start_deg: number, pct: number[, thickness: number])
```

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the circle.
  </SchemaField>

  <SchemaField name="radius" type="number" required>
    Radius of the circle in pixels.
  </SchemaField>

  <SchemaField name="start_deg" type="number" required>
    0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  </SchemaField>

  <SchemaField name="pct" type="number" required>
    Percentage in the range \[0.0-1.0] determining how full the circle is.
  </SchemaField>

  <SchemaField name="thickness" type="number">
    Thickness of the outline in pixels.
  </SchemaField>
</Schema>

## circle\_3d\_gradient

```lua
render.circle_3d_gradient(position: vector, color_outer: color, color_inner: color, radius: number, start_deg: number, pct: number)
```

<Schema title="Parameters">
  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="color_outer" type="color" required>
    Outer color of the circle.
  </SchemaField>

  <SchemaField name="color_inner" type="color" required>
    Inner color of the circle.
  </SchemaField>

  <SchemaField name="radius" type="number" required>
    Radius of the circle in pixels.
  </SchemaField>

  <SchemaField name="start_deg" type="number" required>
    0 is the right side, 90 is the bottom, 180 is the left, 270 is the top.
  </SchemaField>

  <SchemaField name="pct" type="number" required>
    Percentage in the range \[0.0-1.0] determining how full the circle is.
  </SchemaField>
</Schema>

## text

```lua
render.text(font: font, position: vector, color: color, flags: string, text:any[, ...])
```

> Draws the specified text.

<Note>
  Render any text via the [`:load_font`](/csgo/api-reference/namespaces/render#load_font) function.
</Note>

<Schema title="Parameters">
  <SchemaField name="font" type="font" required>
    Font object or 1 for Default font, 2 for Small font, 3 for Console font, or 4 for Bold font.
  </SchemaField>

  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="color" type="color" required>
    Color of the text.
  </SchemaField>

  <SchemaField name="flags" type="string" required>
    c for centered text, r for right-aligned text, s for DPI scaled text. `nil` can be specified for normal uncentered text.
  </SchemaField>

  <SchemaField name="text" type="any" required>
    Text that will be drawn.
  </SchemaField>

  <SchemaField name="..." type="vector">
    Comma-separated vectors to concatenate with text.
  </SchemaField>
</Schema>

## texture

```lua
render.texture(texture: texture, position: vector[, size: vector, color: color, mode: string, rounding: number])
```

<Note>
  Create the texture via the [`:load_image`](/csgo/api-reference/namespaces/render#load_image) function.
</Note>

<Schema title="Parameters">
  <SchemaField name="texture" type="texture" required>
    Image object.
  </SchemaField>

  <SchemaField name="position" type="vector" required>
    Screen position.
  </SchemaField>

  <SchemaField name="size" type="vector">
    Optional. Size of the texture.
  </SchemaField>

  <SchemaField name="color" type="color">
    Optional. Color of the texture.
  </SchemaField>

  <SchemaField name="mode" type="string">
    Optional. f for fill, r for repeat.
  </SchemaField>

  <SchemaField name="rounding" type="number">
    Optional. Roundness of the texture.
  </SchemaField>
</Schema>

## push\_rotation

```lua
render.push_rotation(degrees: number)
```

> Applies the rotation for all subsequent elements.

<Schema title="Parameters">
  <SchemaField name="degrees" type="number" required>
    Rotation degrees (0 - 360).
  </SchemaField>
</Schema>

## pop\_rotation

```lua
render.pop_rotation()
```

> Discards an early set rotation.

## push\_clip\_rect

```lua
render.push_clip_rect(pos_a: vector, pos_b: vector[, intersect: boolean])
```

> Applies the clip region to the given rectangle for all subsequent elements.

<Schema title="Parameters">
  <SchemaField name="pos_a" type="vector" required>
    Screen position of point A.
  </SchemaField>

  <SchemaField name="pos_b" type="vector" required>
    Screen position of point B.
  </SchemaField>

  <SchemaField name="intersect" type="boolean">
    Optional. Allow intersections with other clip regions.
  </SchemaField>
</Schema>

## pop\_clip\_rect

```lua
render.pop_clip_rect()
```

> Discards an early set rectangle clipping region.

## shadow

```lua
render.shadow(pos_a: vector, pos_b: vector, clr: color[, thickness: number, offset: number, rounding: number])
```

> Draws a shadow rectangle.

<Schema title="Parameters">
  <SchemaField name="pos_a" type="vector" required>
    Screen position of point A.
  </SchemaField>

  <SchemaField name="pos_b" type="vector" required>
    Screen position of point B.
  </SchemaField>

  <SchemaField name="clr" type="color" required>
    The color of the shadow.
  </SchemaField>

  <SchemaField name="thickness" type="number">
    The thickness of the shadow.
  </SchemaField>

  <SchemaField name="offset" type="number">
    Shadow offset.
  </SchemaField>

  <SchemaField name="rounding" type="number">
    The rounding of the shadow rectangle.
  </SchemaField>
</Schema>
