Skip to content

Instantly share code, notes, and snippets.

@Lokno
Last active January 5, 2026 02:36
Show Gist options
  • Select an option

  • Save Lokno/ea466181684a6097b18ea22a06d3cdac to your computer and use it in GitHub Desktop.

Select an option

Save Lokno/ea466181684a6097b18ea22a06d3cdac to your computer and use it in GitHub Desktop.
OBS-shaderfilter shader that displays snow (conversion of this shadertoy shader: https://www.shadertoy.com/view/Mdt3Df)
uniform int outerIter<
string label = "Outer Iterations";
string widget_type = "slider";
int minimum = 0;
int maximum = 20;
int step = 1;
> = 6;
uniform int innerIter<
string label = "Inter Iteration";
string widget_type = "slider";
int minimum = 0;
int maximum = 20;
int step = 1;
> = 12;
uniform float cellSizeMin<
string label = "Cell Size Min";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 10.0;
float step = 1.0;
> = 2.0;
uniform float cellSizeFactor<
string label = "Cell Size Factor";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 30.0;
float step = 1.0;
> = 3.0;
uniform float downSpeedMin<
string label = "Downward Speed Min";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 1.0;
float step = 0.01;
> = 0.3;
uniform float downSpeedFactor<
string label = "Downward Speed Factor";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 30.0;
float step = 1.0;
> = 20.0;
uniform float omiValThreshold<
string label = "omiVal Threshold";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 1.0;
float step = 0.001;
> = 0.08;
uniform float acculatorBaseValue<
string label = "Cell Size Divisor";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 10.0;
float step = 0.1;
> = 1.9;
uniform float cellSizeDivisor<
string label = "Cell Size Divisor";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 5.0;
float step = 0.1;
> = 1.4;
float4 mainImage(VertData v_in) : TARGET
{
float2 fragCoord = float2(v_in.uv.x,1.0-v_in.uv.y);
float snow = 0.0;
//float random = frac(sin(dot(fragCoord.xy * uv_size,float2(12.9898,78.233)))* 43758.5453);
for(int k=0;k<outerIter;k++){
for(int i=0;i<innerIter;i++){
float cellSize = cellSizeMin + (float(i)*cellSizeFactor);
float downSpeed = downSpeedMin+(sin(elapsed_time_active*0.4+float(k+i*downSpeedFactor))+1.0)*0.00008;
float2 uv = (fragCoord.xy * uv_size / uv_size.x)+float2(0.01*sin((elapsed_time_active+float(k*6185))*0.6+float(i))*(5.0/float(i)),downSpeed*(elapsed_time_active+float(k*135))*(1.0/float(i)));
float2 uvStep = (ceil((uv)*cellSize-float2(0.5,0.5))/cellSize);
float x = frac(sin(dot(uvStep.xy,float2(12.9898+float(k)*12.0,78.233+float(k)*315.156)))* 43758.5453+float(k)*12.0)-0.5;
float y = frac(sin(dot(uvStep.xy,float2(62.2364+float(k)*23.0,94.674+float(k)*95.0)))* 62159.8432+float(k)*12.0)-0.5;
float randomMagnitude1 = sin(elapsed_time_active*2.5)*0.7/cellSize;
float randomMagnitude2 = cos(elapsed_time_active*2.5)*0.7/cellSize;
float d = 5.0*distance((uvStep.xy + float2(x*sin(y),y)*randomMagnitude1 + float2(y,x)*randomMagnitude2),uv.xy);
float omiVal = frac(sin(dot(uvStep.xy,float2(32.4691,94.615)))* 31572.1684);
if(omiVal<omiValThreshold?true:false){
snow += (x+1.0)*0.4*clamp(acculatorBaseValue-d*(15.0+(x*6.3))*(cellSize/cellSizeDivisor),0.0,1.0);
}
}
}
return snow + image.Sample(textureSampler, v_in.uv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment