s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationRenderingShadersClassesTexture Sheets
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Rendering
Rendering

Texture Sheets

Using texture sheets in shaders is made easy using the Sheet class.

Sheets are textures that contain multiple images. These images are arranged into sequences. A texture sheet can have multiple sequences.

So for example, one texture sheet could include 10 different sequence of leaves, all with one frame. This would be useful in particles, to add variety without using multiple textures (and having to do 10 different draw calls). Or you could have a texture with a single sequence with 64 images of smoke, which when animated makes the smoke look like it's moving.

Sheet::Single

Will return updated UV information for the sheet. This is generally called in the vertex shader, and the updated UVs are passed down to the pixel shader to sample.

// Get the texture sheet data from somewhere
float4 g_SheetData < Attribute( "BaseTextureSheet" ); >;

// ...

o.uv = Sheet::Single( g_SheetData, sequenceId, g_flTime, i.uv );

Sheet::Blended

Returns two uv's, with a float to blend between them. This is for animated sheets.

// Get the texture sheet data from somewhere
float4 g_SheetData < Attribute( "BaseTextureSheet" ); >;

// vertex shader (usually)

Sheet::Blended( g_SheetData, sequenceId, g_flTime, i.uv, o.sheetUv.xy, o.sheetUv.zw, o.sheetBlend );

// pixel shader

float4 col = Tex2D( g_ColorTexture, i.sheetUv.xy );

if ( i.sheetBlend > 0 )
{
	float4 col2 = Tex2D( g_ColorTexture, i.sheetUv.zw );
	col = lerp( col, col2, i.sheetBlend );
}

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2024-12-08. Read it rendered on the official docs.

More in Rendering

AmbientLight
Animated Effects
Attributes and Variables
BeamEffect
Beams
Bindless API
C# Shader Nodes
Classes
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.