Skip to content

Commit

Permalink
Add cEnsor shader
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Jul 15, 2023
1 parent a50167f commit d35ec35
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions shaders/cEnsor.fx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

#include "shared/cGraphics.fxh"
#include "shared/cBuffers.fxh"

CREATE_SAMPLER(SampleTempTex0, TempTex0_RGB10A2, POINT, CLAMP)

float4 PS_Blit(VS2PS_Quad Input) : SV_TARGET0
{
return float4(tex2D(CShade_SampleColorTex, Input.Tex0).rgb, 1.0);
}

float4 PS_Censor(VS2PS_Quad Input) : SV_TARGET0
{
float4 Color = tex2D(CShade_SampleColorTex, Input.Tex0);
float4 Pixel = tex2Dlod(SampleTempTex0, float4(Input.Tex0, 0.0, 5.0));
float MaxC = max(max(Pixel.r, Pixel.g), Pixel.b);

return lerp(Color, Pixel, MaxC > 0.5);
}

technique CShade_Censor
{
pass
{
VertexShader = VS_Quad;
PixelShader = PS_Blit;
RenderTarget = TempTex0_RGB10A2;
}

pass
{
SRGBWriteEnable = WRITE_SRGB;
VertexShader = VS_Quad;
PixelShader = PS_Censor;
}
}
2 changes: 1 addition & 1 deletion shaders/shared/cBuffers.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CREATE_TEXTURE(TempTex6_RG16F, BUFFER_SIZE_6, RG16F, 1)
[Shared RGBA16F Textures]
*/

CREATE_TEXTURE(TempTex0_RGB10A2, BUFFER_SIZE_0, RGB10A2, 1)
CREATE_TEXTURE(TempTex0_RGB10A2, BUFFER_SIZE_0, RGB10A2, 8)
CREATE_TEXTURE(TempTex1_RGBA16F, BUFFER_SIZE_1, RGBA16F, 1)
CREATE_TEXTURE(TempTex2_RGBA16F, BUFFER_SIZE_2, RGBA16F, 1)
CREATE_TEXTURE(TempTex3_RGBA16F, BUFFER_SIZE_3, RGBA16F, 1)
Expand Down

0 comments on commit d35ec35

Please sign in to comment.