D3D: Depth range inversion.

Credits go to Galop1n for designing this technique and to BhaaLseN for cleaning up the commit.
This commit is contained in:
galop1n
2015-05-24 14:44:25 +02:00
committed by Jules Blok
parent 308b72d376
commit 2975e53091
6 changed files with 36 additions and 16 deletions

View File

@ -146,7 +146,7 @@ const char depth_matrix_program[] = {
" in float4 pos : SV_Position,\n"
" in float3 uv0 : TEXCOORD0){\n"
" float4 texcol = Tex0.Sample(samp0,uv0);\n"
" int depth = clamp(int(texcol.x * 16777216.0), 0, 0xFFFFFF);\n"
" int depth = clamp(int((1.0 - texcol.x) * 16777216.0), 0, 0xFFFFFF);\n"
// Convert to Z24 format
" int4 workspace;\n"
@ -180,7 +180,7 @@ const char depth_matrix_program_msaa[] = {
" for(int i = 0; i < SAMPLES; ++i)\n"
" texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
" texcol /= SAMPLES;\n"
" int depth = clamp(int(texcol.x * 16777216.0), 0, 0xFFFFFF);\n"
" int depth = clamp(int((1.0 - texcol.x) * 16777216.0), 0, 0xFFFFFF);\n"
// Convert to Z24 format
" int4 workspace;\n"