From 18b85b9cd5b58218bba996cc0b0becebaf37549b Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Thu, 24 Feb 2011 15:04:24 +0000 Subject: [PATCH] Just a small accuracy fix for r6819, fixes the pixel line in the volumetric fog effect of Metroid Prime (closes issue 4162) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7236 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp index 6691a659b7..3f8bf95f05 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp @@ -199,9 +199,10 @@ static LPDIRECT3DPIXELSHADER9 CreateCopyShader(int copyMatrixType, int depthConv if(depthConversionType != DEPTH_CONVERSION_TYPE_NONE) { - // Here, we need to downscale texcol a bit since frac(1.0) will indeed return 0.0f, ceil() takes care of restoring the precision - WRITE(p, "float4 EncodedDepth = frac((texcol.r * (16777215.0f/16777216.0f)) * float4(1.0f,256.0f,256.0f*256.0f,1.0f));\n" - "texcol = ceil(EncodedDepth * float4(255.0f,255.0f,255.0f,15.0f)) / float4(255.0f,255.0f,255.0f,15.0f);\n"); + // Watch out for the fire fumes effect in Metroid it's really sensitive to this, + // the lighting in RE0 is also way beyond sensitive since the "good value" is hardcoded and Dolphin is almost always off. + WRITE(p, "float4 EncodedDepth = frac(texcol.r * (16777215.f/16777216.f) * float4(1.0f,256.0f,256.0f*256.0f,1.0f));\n" + "texcol = floor(EncodedDepth * float4(256.f,256.f,256.f,15.0f)) / float4(255.0f,255.0f,255.0f,15.0f);\n"); } else {