skills/vvvv-shaders/SKILL.md
Helps write SDSL shaders for Stride and vvvv gamma — TextureFX, shader mixins, compute shaders, and ShaderFX composition. SDSL is a superset of HLSL, so use this skill when writing or debugging .sdsl shader files, GPU shaders, visual effects, HLSL code for vvvv, working with the Stride rendering pipeline, composing shader mixins, or any GPU/compute work. Trigger even if the user says 'HLSL', 'shader', 'GPU effect', 'render pass', or 'compute' in a vvvv context.
npx skillsauth add tebjan/vvvv-skills vvvv-shadersInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
SDSL (Stride Shading Language) is Stride's shader language — a superset of HLSL with four key additions: shader classes with inheritance, multiple inheritance (mixins), the streams system for automatic inter-stage data flow, and override for clean method replacement. Shaders are defined in .sdsl files.
Streams replace manual VS_INPUT/VS_OUTPUT structs. Declare once, access everywhere:
stream float4 MyData : TEXCOORD5; // Declare a custom stream variable
// In vertex shader:
streams.MyData = float4(1, 0, 0, 1); // Write
// In pixel shader:
float4 d = streams.MyData; // Read (auto-interpolated)
Key built-in streams:
streams.ShadingPosition (SV_Position) — clip-space positionstreams.ColorTarget (SV_Target0) — pixel shader outputstreams.Position (float4) — object-space positionstreams.TexCoord (TEXCOORD0) — texture coordinatesstreams.normalWS — world-space normal| Shader | Provides |
|---|---|
| ShaderBase | VSMain/PSMain entry points |
| Texturing | Texture0-9, Sampler, PointSampler, LinearSampler, TexCoord |
| Transformation | World, View, Projection, WorldViewProjection matrices |
| PositionStream4 | Position, PositionWS, DepthVS |
| NormalStream | meshNormal, normalWS, tangentToWorld |
| ComputeShaderBase | CSMain entry, Compute() hook, thread groups |
| ComputeColor | Interface returning float4 via Compute() |
| ComputeVoid | Interface returning void via Compute() |
| Global | Time, TimeStep (cbuffer PerFrame) |
| Shader | Inherits | Use For |
|---|---|---|
| VS_PS_Base | ShaderBase, PositionStream4, NormalStream, Transformation | DrawFX base |
| FilterBase | TextureFX | Pixel-processing texture effects |
| MixerBase | TextureFX | Blending textures |
| TextureFX | ImageEffectShader, Camera, ShaderUtils | Texture effect base |
Important: VS_PS_Base already includes Transformation, NormalStream, and PositionStream4. Do NOT re-inherit them.
vvvv automatically creates nodes from shaders based on filename suffix:
| Suffix | Node Type | Description |
|---|---|---|
| _TextureFX.sdsl | TextureFX | Image processing effects |
| _DrawFX.sdsl | DrawFX | Drawing/rendering shaders |
| _ComputeFX.sdsl | ComputeFX | Compute shaders |
| _ShaderFX.sdsl | ShaderFX | General shader effects |
Example: MyBlur_TextureFX.sdsl automatically creates a "MyBlur" TextureFX node.
shader MyEffect_TextureFX : FilterBase
{
float Intensity = 1.0;
float4 Filter(float4 tex0col)
{
return tex0col * Intensity;
}
};
Note the semicolon after the closing brace — this is required.
For critical SDSL syntax rules (static const scope, semicolons, override, variable initialization, common mistakes, branch divergence), see syntax-rules.md.
| Keyword | Purpose |
|---|---|
| shader | Defines a shader class |
| override | Required when overriding parent methods |
| base | Access parent implementation |
| stage | Ensures member defined once across compositions |
| stream | Member accessible at every shader stage |
| static | Static methods callable without inheritance |
| compose | Declare a composition slot for shader mixins |
| clone | Force separate instance of a composed shader |
| abstract | Method without body (child must implement) |
// Single inheritance
shader Child : Parent
{
override float4 Filter(float4 tex0col)
{
return base.Filter(tex0col) * 0.5;
}
};
// Multiple inheritance (mixins)
shader MyShader : FilterBase, ColorUtils, MathUtils
{
float4 Filter(float4 tex0col)
{
float3 linear = ColorUtils.GammaToLinear(tex0col.rgb);
return float4(linear, tex0col.a);
}
};
// Static function calls (no inheritance needed)
float3 result = ColorUtils.LinearToGamma(col.rgb);
In the shader (.sdsl):
[EnumType("MyNamespace.BlendMode, MyAssembly")]
int Mode = 0;
In C# (.cs):
namespace MyNamespace;
public enum BlendMode
{
Normal = 0,
Add = 1,
Multiply = 2,
Screen = 3
}
Requirements:
float3 safeLog = log2(max(x, 1e-10)); // Avoid log2(0)
float3 safe = x / max(y, 0.0001); // Avoid div by zero
float3 safePow = pow(max(x, 0.0), gamma); // Avoid pow(negative)
// In TextureFX, tex0col is already sampled from Texture0
float4 Filter(float4 tex0col)
{
// Sample additional textures:
float4 tex1 = Texture1.Sample(Texturex1Sampler, streams.TexCoord);
return lerp(tex0col, tex1, 0.5);
}
Composable shader nodes using compose keyword:
shader MyTonemap_ShaderFX : ComputeColor, TonemapOperators
{
compose ComputeColor ColorIn;
[EnumType("MyNamespace.TonemapOp, MyAssembly")]
int Operator = 1;
float Exposure = 0.0;
override float4 Compute()
{
float4 color = ColorIn.Compute();
color.rgb *= exp2(Exposure);
color.rgb = ApplyTonemap(color.rgb, Operator);
return color;
}
};
In vvvv patching, connect a ShaderFX node to a TextureFX's compose input to chain processing.
Base shader with a virtual method, overridden by dynamically composed mixins:
// Base shader declares the virtual method
shader ColorProcessorBase
{
float4 ProcessColor(float4 inPixel) { return inPixel; }
};
// Host shader uses composition
shader ColorTransform_TextureFX : TextureFX
{
stage compose ColorProcessorBase Processor;
stage override float4 Shading()
{
float4 col = Texture0.SampleLevel(PointSampler, streams.TexCoord, 0);
return Processor.ProcessColor(col);
}
};
// Declaration with type parameter
shader ComputeColorWave<float Frequency> : ComputeColor, Texturing
{
override float4 Compute()
{
return float4(sin(streams.TexCoord.x * Frequency), 0, 0, 1);
}
};
// Instantiation via inheritance
shader MyEffect : ComputeColorWave<2.0f> { };
Supported template parameter types: float, int, float2, float3, float4, Texture2D, SamplerState.
Multiple composed shaders of the same type:
compose ComputeColor lights[];
override float4 Compute()
{
float4 total = 0;
foreach (var light in lights)
total += light.Compute();
return total;
}
Define once, use in emit/simulate/draw pipeline:
shader ParticleTypes
{
struct Particle { float3 Position; float3 Velocity; float Life; };
};
shader Emit_ComputeFX : ComputeShaderBase, ParticleTypes { /* fills buffer */ };
shader Simulate_ComputeFX : ComputeShaderBase, ParticleTypes { /* physics */ };
shader Draw_DrawFX : VS_PS_Base, ParticleTypes { /* renders */ };
For detailed SDSL syntax rules, see syntax-rules.md.
data-ai
Diagnoses and fixes common vvvv gamma errors in C# nodes, SDSL shaders, and runtime behavior. Use when encountering errors, exceptions, crashes, red nodes, shader compilation failures, missing nodes in the browser, performance issues, or unexpected behavior.
development
Set up and run automated tests for vvvv gamma packages and C# nodes -- VL.TestFramework with NUnit for library/package authors (CI-ready), test .vl patches with assertion nodes, and lightweight agent-driven test workflows. Use when writing tests for vvvv packages, setting up test infrastructure, creating test patches, running automated compilation checks, or integrating vvvv tests into CI/CD.
testing
Covers launching vvvv gamma from the command line or programmatically -- normal startup, opening specific .vl patches, command-line arguments, package repositories, and key filesystem paths (install directory, user data, sketches, exports, packages). Use when starting vvvv, configuring launch arguments, setting up package repositories, or finding vvvv's data directories.
development
Helps write code using vvvv gamma's Spread<T> immutable collection type and SpreadBuilder<T>. Use when working with Spreads, SpreadBuilder, collections, arrays, iteration, mapping, filtering, zipping, accumulating, or converting between Span and Spread. Trigger whenever the user writes collection-processing C# code in vvvv — even if they say 'list', 'array', or 'IEnumerable' instead of Spread, this skill likely applies.