2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
|
|
|
|
2021-10-23 18:05:36 +00:00
|
|
|
#include "shared.effect"
|
|
|
|
|
2021-11-07 13:43:09 +00:00
|
|
|
uniform texture2d InputA<
|
2021-10-23 18:05:36 +00:00
|
|
|
bool automatic = true;
|
|
|
|
>;
|
2021-11-07 13:43:09 +00:00
|
|
|
uniform texture2d InputB<
|
2021-10-23 18:05:36 +00:00
|
|
|
bool automatic = true;
|
|
|
|
>;
|
|
|
|
uniform float Threshold<
|
|
|
|
string name = "Threshold";
|
|
|
|
string suffix = " %";
|
|
|
|
float minimum = 0.;
|
|
|
|
float maximum = 100.;
|
|
|
|
float step = .01;
|
|
|
|
float scale = .01;
|
|
|
|
> = 10.;
|
|
|
|
uniform float ThresholdRange<
|
|
|
|
string name = "Threshold Range";
|
|
|
|
string suffix = " %";
|
|
|
|
float minimum = 0.;
|
|
|
|
float maximum = 100.;
|
|
|
|
float step = .01;
|
|
|
|
float scale = .01;
|
|
|
|
> = 10.;
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Technique: Draw
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Parameters:
|
|
|
|
// - InputA: RGBA Texture
|
|
|
|
// - InputB: XXXA Texture
|
|
|
|
|
|
|
|
float4 PSDrawAlpha(VertexData vtx) : TARGET {
|
|
|
|
return InputA.Sample(BlankSampler, vtx.uv);
|
|
|
|
};
|
|
|
|
|
|
|
|
technique DrawAlpha
|
|
|
|
{
|
|
|
|
pass
|
|
|
|
{
|
|
|
|
vertex_shader = DefaultVertexShader(vtx);
|
|
|
|
pixel_shader = PSDrawAlpha(vtx);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Technique: Draw
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Parameters:
|
|
|
|
// - InputA: RGBX Texture
|
|
|
|
// - InputB: XXXA Texture
|
|
|
|
// - Threshold: Alha threshold to be "visible".
|
|
|
|
|
|
|
|
float4 PSDrawAlphaThreshold(VertexData vtx) : TARGET {
|
|
|
|
float4 rgba = InputA.Sample(BlankSampler, vtx.uv);
|
|
|
|
float4 xxxa = InputB.Sample(BlankSampler, vtx.uv);
|
|
|
|
|
|
|
|
rgba.a = smoothstep(Threshold - ThresholdRange * .5, Threshold + ThresholdRange * .5, xxxa.a);
|
|
|
|
|
|
|
|
return rgba;
|
|
|
|
};
|
|
|
|
|
|
|
|
technique DrawAlphaThreshold
|
|
|
|
{
|
|
|
|
pass
|
|
|
|
{
|
|
|
|
vertex_shader = DefaultVertexShader(vtx);
|
|
|
|
pixel_shader = PSDrawAlphaThreshold(vtx);
|
|
|
|
};
|
|
|
|
};
|