3cd9e77889
* Initial linux support using SDL * fixed link error and gitignore * fix in working directory initialization (windows side) * Added README_Linux and fixed a few compilation issues in ubuntu * Rename main to main_Windows in Tests * Better default renderering backend selector * Added backlog terminal output on linux * added asserts on all missing vulkan function call results * added portable file dialogs also small tests update and cleanup * Added Editor compile target * linux ci * linux ci * cmake update * cmake update? * cmake * Editor_Windows fix * build test * make * build tools? * update * ubuntu 20.04 * fix? * cmake * build * build? * package linux build * updates, bump version * backslash to forward slash, eof newlines, add portable-file-dialogs license * xcopy needs backslash duh; update readme; * copy fix * updated readme * readme update * updated readme * updated readme * fix incorrect file encoding linux * paint tool fix * linux: add missing shaders * packaging update Co-authored-by: Turánszki János <turanszkij@users.noreply.github.com> Co-authored-by: Turanszki Janos <turanszkij@gmail.com>
47 lines
1.6 KiB
HLSL
47 lines
1.6 KiB
HLSL
#include "globals.hlsli"
|
|
#include "ShaderInterop_Postprocess.h"
|
|
#include "depthOfFieldHF.hlsli"
|
|
|
|
TEXTURE2D(input, float4, TEXSLOT_ONDEMAND0);
|
|
TEXTURE2D(texture_postfilter, float3, TEXSLOT_ONDEMAND1);
|
|
TEXTURE2D(texture_alpha, float, TEXSLOT_ONDEMAND2);
|
|
TEXTURE2D(neighborhood_mindepth_maxcoc, float2, TEXSLOT_ONDEMAND3);
|
|
|
|
RWTEXTURE2D(output, float4, 0);
|
|
|
|
[numthreads(POSTPROCESS_BLOCKSIZE, POSTPROCESS_BLOCKSIZE, 1)]
|
|
void main(uint3 DTid : SV_DispatchThreadID)
|
|
{
|
|
const float2 uv = (DTid.xy + 0.5f) * xPPResolution_rcp;
|
|
|
|
const float center_depth = texture_lineardepth[DTid.xy];
|
|
const float2 mindepth_maxcoc = neighborhood_mindepth_maxcoc[DTid.xy / DEPTHOFFIELD_TILESIZE];
|
|
const float mindepth = mindepth_maxcoc.x;
|
|
const float maxcoc = mindepth_maxcoc.y;
|
|
float4 fullres = input[DTid.xy];
|
|
const float3 halfres = texture_postfilter.SampleLevel(sampler_linear_clamp, uv, 0);
|
|
const float alpha = texture_alpha.SampleLevel(sampler_linear_clamp, uv, 0);
|
|
|
|
const float coc = get_coc(center_depth);
|
|
|
|
float depthDelta = saturate(1.0 - g_xCamera_ZFarP * (center_depth - mindepth));
|
|
|
|
const float backgroundFactor = coc;
|
|
const float foregroundFactor = lerp(maxcoc, coc, depthDelta);
|
|
|
|
const float combinedFactor = saturate(lerp(backgroundFactor, foregroundFactor, alpha));
|
|
|
|
float4 color = float4(lerp(fullres.rgb, halfres, combinedFactor), fullres.a);
|
|
//color = backgroundFactor;
|
|
//color = foregroundFactor;
|
|
//color = maxcoc;
|
|
//color = combinedFactor;
|
|
//color = alpha;
|
|
//color = depthDelta;
|
|
//color.rgb = halfres;
|
|
|
|
//if (coc < 0.01) color = float4(1, 0, 0, 1);
|
|
|
|
output[DTid.xy] = color;
|
|
}
|