added masked background blur image effect

This commit is contained in:
turanszkij
2020-04-10 22:46:56 +01:00
parent 70a7163639
commit e206ee496f
6 changed files with 46 additions and 2 deletions
@@ -409,6 +409,12 @@
<FxCompile Include="imagePS_backgroundblur_bicubic.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
</FxCompile>
<FxCompile Include="imagePS_backgroundblur_masked.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
</FxCompile>
<FxCompile Include="imagePS_backgroundblur_masked_bicubic.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
</FxCompile>
<FxCompile Include="imagePS_bicubic.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
@@ -966,6 +966,12 @@
<FxCompile Include="bloomseparateCS.hlsl">
<Filter>CS</Filter>
</FxCompile>
<FxCompile Include="imagePS_backgroundblur_masked.hlsl">
<Filter>PS</Filter>
</FxCompile>
<FxCompile Include="imagePS_backgroundblur_masked_bicubic.hlsl">
<Filter>PS</Filter>
</FxCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="PS">
@@ -0,0 +1,11 @@
#include "imageHF.hlsli"
float4 main(VertextoPixel input) : SV_TARGET
{
float4 color = texture_base.SampleLevel(Sampler, input.uv0, xMipLevel) * xColor;
float3 background = texture_background.SampleLevel(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w, xMipLevel_Background).rgb;
float4 mask = texture_mask.SampleLevel(Sampler, input.uv1, xMipLevel);
color *= mask;
return float4(lerp(background, color.rgb, color.a), mask.a);
}
@@ -0,0 +1,11 @@
#include "imageHF.hlsli"
float4 main(VertextoPixel input) : SV_TARGET
{
float4 color = SampleTextureCatmullRom(texture_base, input.uv0, xMipLevel) * xColor;
float3 background = texture_background.SampleLevel(Sampler, (input.uv_screen.xy * float2(0.5f, -0.5f) + 0.5f) / input.uv_screen.w, xMipLevel_Background).rgb;
float4 mask = texture_mask.SampleLevel(Sampler, input.uv1, xMipLevel);
color *= mask;
return float4(lerp(background, color.rgb, color.a), mask.a);
}
+11 -1
View File
@@ -22,6 +22,7 @@ namespace wiImage
IMAGE_SHADER_SEPARATENORMALMAP,
IMAGE_SHADER_MASKED,
IMAGE_SHADER_BACKGROUNDBLUR,
IMAGE_SHADER_BACKGROUNDBLUR_MASKED,
IMAGE_SHADER_FULLSCREEN,
IMAGE_SHADER_COUNT
};
@@ -212,7 +213,14 @@ namespace wiImage
{
if (Mask)
{
targetShader = IMAGE_SHADER_MASKED;
if (background_blur)
{
targetShader = IMAGE_SHADER_BACKGROUNDBLUR_MASKED;
}
else
{
targetShader = IMAGE_SHADER_MASKED;
}
}
else
{
@@ -251,11 +259,13 @@ namespace wiImage
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_SEPARATENORMALMAP][IMAGE_SAMPLING_SIMPLE], "imagePS_separatenormalmap.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_MASKED][IMAGE_SAMPLING_SIMPLE], "imagePS_masked.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR][IMAGE_SAMPLING_SIMPLE], "imagePS_backgroundblur.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR_MASKED][IMAGE_SAMPLING_SIMPLE], "imagePS_backgroundblur_masked.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_FULLSCREEN][IMAGE_SAMPLING_SIMPLE], "screenPS.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_STANDARD][IMAGE_SAMPLING_BICUBIC], "imagePS_bicubic.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_SEPARATENORMALMAP][IMAGE_SAMPLING_BICUBIC], "imagePS_separatenormalmap_bicubic.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_MASKED][IMAGE_SAMPLING_BICUBIC], "imagePS_masked_bicubic.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR][IMAGE_SAMPLING_BICUBIC], "imagePS_backgroundblur_bicubic.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_BACKGROUNDBLUR_MASKED][IMAGE_SAMPLING_BICUBIC], "imagePS_backgroundblur_masked_bicubic.cso");
wiRenderer::LoadShader(PS, imagePS[IMAGE_SHADER_FULLSCREEN][IMAGE_SAMPLING_BICUBIC], "screenPS_bicubic.cso");
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 39;
// minor bug fixes, alterations, refactors, updates
const int revision = 47;
const int revision = 48;
long GetVersion()