-
Notifications
You must be signed in to change notification settings - Fork 3k
Source Filter Transition Shader
StreamFX ships with three different ways to use custom shaders in OBS Studio: Source Shader, Filter Shader and Transition Shader. Each has slightly different usage, but can mostly work with almost the same shader and allows you to easily use your own or someone elses shaders in OBS Studio. Shaders allow for quick iteration and enable some effects that were previously impossible.
Version Information
Status | Version |
---|---|
Added | 0.5 |
Unstable | N/A |
Stable | N/A |
Deprecated | N/A |
Removed | N/A |
(note: links are currently dead)
TODO
The []
denote optional things, while the ()
denote required things. They are only used to illustrate the structure itself, and must be removed.
uniform (type) (name)<
// 'true' to allow Users to see this parameters, 'false' to hide it. Enables invisible parameters which do special things with scripts.
[bool visible = true;]
// 'true' to completely disallow modification from outside. Useful for predefined parameters and values that are spread from other parameters.
[bool automatic = false;]
// Name used in the UI.
[string name = "Name";]
// Description used in the UI.
[string description = "Description";]
// DANGEROUS: Override the detected type with a specific one. Do not use unless you absolutely need it.
[string type = "bool";] // Turn this into a boolean.
[string type = "float";] // Turn this into a float.
[string type = "int";] // Turn this into an integer.
[string type = "string";] // Turn this into a string.
[string type = "texture";] // Turn this into a texture.
[string type = "sampler";] // Turn this into a sampler.
// DANGEROUS: Override the detected size with a specified one. Do not use unless you absolutely need it.
[int size = 1;]
>[ = (value)];
A value parameter is one of the following types: float, float#, float[], float#x#, int, int#, int[], int#x#, uint, uint#, uint[], uint#x#, bool, bool#, bool[], bool#x#. Some types may require type and size overrides in order to be detected correctly.
uniform (type) (name)<
// ... continued from Generic Parameters
// Changes the field type to a different one.
[string field_type = "input";] // Standard input widget with manual entry and nothing fancy.
[string field_type = "slider";] // Horizontal slider with manual entry option.
[string field_type = "enum";] // Dropdown with enumeration entries, see "Enumeration Parameters".
// Suffix for the values.
[string suffix = " my awesome suffix";]
// Minimum value that can be set.
[(type) minimum = {...};] // Defaults to the smallest possible number.
// Maximum value that can be set.
[(type) maximum = {...};] // Defaults to the largest possible number.
// The step of the value.
[(type) step = {...};] // Defaults to 1.
// The scale of the value, which is applied to everything. Can be used to greatly increase the precision of an property.
[(type) scale = {...};] // Defaults to 1.
>[ = (value)];
A subset of value parameters where the selection is limited to a defined list of values, which can be defined in the shader. This can be useful to have users select from certain behavior instead of requiring them to enter numbers manually.
Entries in the list are limited to int, float and string, the three basic types of parameters. Vector types will simply act as an array of the basic type, and show a dropdown for each vector part. A float4 for example would allow the user to pick a value for r, g, b and a (or x, y, z and w).
uniform (type) (name)<
// ... continued from Generic Parameters
// Set the field type to enumeration.
[string field_type = "enum";] // Dropdown with enumeration entries.
// Defines the #. enumeration entry of the list. # must be a continuously increasing number starting from 0.
[(base type) enum_# = (value);] // The value of the enumeration entry.
[string enum_#_name = "(name)";] // The name of the enumeration entry, optional. If not specified, defaults to "Unnamed Entry".
>[ = (value)];
Camera Projection Matrix, must be used in the Vertex Shader.
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
The current time since the creation of the shader, in seconds.
- x: Time in seconds since the source was created. (float)
- y: Time in the current second.
- z: Time in seconds since the source was created. (rounded down to nearest integer)
- w: Reserved
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
- x: Width
- y: Height
- z: 1. / Width
- w: 1. / Height
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
Available only to Filters and Transitions, holds a 2D Texture of size ViewSize.xy
with the content that is to be filtered or transitioned from.
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
Available only to Transitions, holds a 2D Texture of size ViewSize.xy
with the content that is to be transitioned to.
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
Value from 0 to 1 that describes the current expected progress of the transition. The transition must have completed by the time this value reaches 1 or the transition is cut off.
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
The seed value used for randomization, user controlled. Changing this automatically regenerates all random values.
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
A matrix containing random values that are generated per-instance, per-activation and per-frame. Use it like this:
float4 perInst = float4(Random[0][0], Random[1][0], Random[2][0], Random[3][0]);
float4 perActivation = float4(Random[0][1], Random[1][1], Random[2][1], Random[3][1]);
float4 perFrame1 = float4(Random[0][2], Random[1][2], Random[2][2], Random[3][2]);
float4 perFrame2 = float4(Random[0][3], Random[1][3], Random[2][3], Random[3][3]);
This is an automatically set option, ensure that the user does not see it by setting the annotation 'bool automatic = true;'.
The baseline for the shader language libOBS uses is HLSL, for which you can find documentation here. libOBS modifies this so it works across all of its supported graphics APIs, sacrificing functionality and versatility for compatibility. As a result, some effects that would be possible with ease in GLSL or HLSL directly do not work in libOBS's shader language. To reduce the total size of this page, information about it has moved to its own page.
This work is licensed under a Creative Commons Attribution 4.0 International License.
The wiki has been under repeated automated attacks by bots, with attempts to phish or infect unsuspecting users with malware, trojans and similar software. As a response to these attacks and GitHubs complete ineptitude at handling this situation, we have decided to write-protect the wiki for the time being. If you wish to submit changes to the wiki, please do so over Discord. Thank you for understanding!
- 🟢 3D Transform
- 🔴 Auto-Framing
- 🟠 Blur
- 🟢 Color Grading
- 🔴 Denoising
- ❌ Displacement Mapping
- 🟢 Dynamic Mask
⚠️ SDF Effects- 🔴 Shaders
- 🔴 Spout
- 🔴 Upscaling
- 🔴 Virtual Greenscreen
- 🔴 Shaders
- 🔴 Sink
⚠️ Source Mirror
- 🔴 Shaders