s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationRenderingShadersReferenceDefault Vertex And Pixel Shader Inputs
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

Default Vertex and Pixel Shader Inputs

If you're just opting for default Vertex and Pixel inputs which are usable on the default shading model, these are the reference member variables for each:

struct VertexInput
{
    float3 vPositionOs : POSITION < Semantic( PosXyz ); >;
    float2 vTexCoord : TEXCOORD0 < Semantic( LowPrecisionUv ); >;	
    float4 vNormalOs : NORMAL < Semantic( OptionallyCompressedTangentFrame ); >;
    float4 vTangentUOs_flTangentVSign : TANGENT	< Semantic( TangentU_SignV ); >;
    
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    // Skinning
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    #if ( D_SKINNING > 0 )
    	uint4 vBlendIndices : BLENDINDICES 	< Semantic( BlendIndices ); >;
    	float4 vBlendWeight : BLENDWEIGHT 	< Semantic( BlendWeight ); >;
    #endif	
    	
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    // SSS Curvature
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    #if ( S_USE_PER_VERTEX_CURVATURE )
    	float flSSSCurvature : TEXCOORD2 < Semantic( Curvature ); >;
    #endif
    
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    // Morph
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    #if ( D_MORPH )
    	float nVertexIndex : TEXCOORD14 < Semantic( MorphIndex ); >;
    #endif
    
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    // Instancing data
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    uint nInstanceTransformID : TEXCOORD13 < Semantic( InstanceTransformUv ); >;
    
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    // Baked lighting
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    #if ( D_BAKED_LIGHTING_FROM_LIGHTMAP )	
    	float2 vLightmapUV : TEXCOORD3 < Semantic( LightmapUV ); > ;
    #endif
}
struct PixelInput
{
    #if ( PROGRAM == VFX_PROGRAM_PS )
    	float3 vPositionWithOffsetWs : TEXCOORD0;
    #else
    	float3 vPositionWs : TEXCOORD0;
    #endif
    
    float3 vNormalWs 		: TEXCOORD1;
    float2 vTextureCoords 	: TEXCOORD2;
    float4 vVertexColor 	: TEXCOORD4;
    
    centroid float3 vCentroidNormalWs : TEXCOORD5; // For specular, used if interpolation sends normal outside the unit sphere

  	float3 vTangentUWs : TEXCOORD6; 
  	float3 vTangentVWs : TEXCOORD7; 
    
    #if ( S_USE_PER_VERTEX_CURVATURE )
    	float flSSSCurvature : TEXCOORD11;
    #endif
    
    #if ( D_BAKED_LIGHTING_FROM_LIGHTMAP )
    	centroid float2 vLightmapUV : TEXCOORD3;
    #endif
    
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    // System interpolants
    //-------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    #if ( PROGRAM != VFX_PROGRAM_PS ) 
    	float4 vPositionPs : SV_Position;
    #else // PS only
    	float4 vPositionSs : SV_Position;
    	#if ( S_RENDER_BACKFACES )
    		bool face : SV_IsFrontFace;
    	#endif
    #endif
}

Different combos expose different feature sets for these

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2024-12-12. 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.