From 4cb26976bdc8608bdc272cf9942d7935e60178dc Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 26 Feb 2019 18:52:01 -1000 Subject: [PATCH] More thermal visor fixes; face reflection fix --- Runtime/Graphics/CBooRenderer.cpp | 20 +++++++++++--------- Runtime/Graphics/CModelBoo.cpp | 2 +- Shaders/CDecalShaders.shader | 12 ++++++++---- Shaders/CThermalColdFilter.shader | 13 ++++++------- hecl | 2 +- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index 4ac92af9b..605dffe88 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -1093,17 +1093,19 @@ void CBooRenderer::SetThermalColdScale(float scale) { x2f8_thermColdScale = zeus void CBooRenderer::DoThermalBlendCold() { zeus::CColor a = zeus::CColor::lerp(x2f4_thermColor, zeus::skWhite, x2f8_thermColdScale); m_thermColdFilter->setColorA(a); - float bFac = 0.f; float bAlpha = 1.f; - if (x2f8_thermColdScale < 0.5f) { + if (x2f8_thermColdScale < 0.5f) bAlpha = x2f8_thermColdScale * 2.f; - bFac = (1.f - bAlpha) / 8.f; - } - zeus::CColor b{bFac, bFac, bFac, bAlpha}; - m_thermColdFilter->setColorB(b); - zeus::CColor c = zeus::CColor::lerp(zeus::skBlack, zeus::skWhite, - zeus::clamp(0.f, (x2f8_thermColdScale - 0.25f) * 4.f / 3.f, 1.f)); - m_thermColdFilter->setColorC(c); + float bFac = (1.f - bAlpha) / 8.f; + m_thermColdFilter->setColorB(zeus::CColor(bFac, bAlpha)); + float cFac; + if (x2f8_thermColdScale < 0.25f) + cFac = 0.f; + else if (x2f8_thermColdScale >= 1.f) + cFac = 1.f; + else + cFac = (x2f8_thermColdScale - 0.25f) * 4.f / 3.f; + m_thermColdFilter->setColorC(zeus::CColor(cFac, cFac)); m_thermColdFilter->setScale(x2f8_thermColdScale); diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 0ba0106b0..0a3b95223 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -681,7 +681,7 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati } case UVAnimation::Mode::Model: { texMtxOut = CGraphics::g_GXModelMatrix.toMatrix4f(); - texMtxOut[3].zeroOut(); + texMtxOut[3] = zeus::CVector4f(0.f, 0.f, 0.f, 1.f); postMtxOut[0].x() = 0.5f; postMtxOut[1].y() = 0.f; postMtxOut[2].y() = 0.5f; diff --git a/Shaders/CDecalShaders.shader b/Shaders/CDecalShaders.shader index 6282282c4..c3c9efb41 100644 --- a/Shaders/CDecalShaders.shader +++ b/Shaders/CDecalShaders.shader @@ -172,8 +172,8 @@ layout(location=0) out vec4 colorOut; TBINDING0 uniform sampler2D tex; void main() { - colorOut = vtf.color; - colorOut.a = texture(tex, vtf.uv).r; + colorOut = vtf.color * texture(tex, vtf.uv); + colorOut.a = colorOut.r; } @@ -189,7 +189,9 @@ struct VertToFrag float4 main(in VertToFrag vtf) : SV_Target0 { - return float4(vtf.color.rgb, tex0.Sample(samp, vtf.uv).r); + float4 colorOut = vtf.color * tex0.Sample(samp, vtf.uv); + colorOut.a = colorOut.r; + return colorOut; } @@ -205,7 +207,9 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]], sampler samp [[ sampler(0) ]], texture2d tex0 [[ texture(0) ]]) { - return float4(vtf.color.rgb, tex0.sample(samp, vtf.uv).r); + float4 colorOut = vtf.color * tex0.sample(samp, vtf.uv); + colorOut.a = colorOut.r; + return colorOut; } diff --git a/Shaders/CThermalColdFilter.shader b/Shaders/CThermalColdFilter.shader index c957e5511..145b998c0 100644 --- a/Shaders/CThermalColdFilter.shader +++ b/Shaders/CThermalColdFilter.shader @@ -80,8 +80,8 @@ void main() vec4 noiseTexel = texelFetch(noiseTex, Lookup8BPP(vtf.noiseUv, vtf.randOff), 0); vec2 indCoord = (vtf.indMtx * vec3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy; float indScene = dot(texture(sceneTex, vtf.sceneUv + indCoord), kRGBToYPrime); - colorOut = vtf.colorReg0 * indScene + vtf.colorReg1 * noiseTexel + vtf.colorReg2; - colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.a + vtf.colorReg2.a; + colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r; + colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a; } #vertex hlsl @@ -160,8 +160,8 @@ float4 main(in VertToFrag vtf) : SV_Target0 float4 noiseTexel = noiseTex.Load(Lookup8BPP(vtf.noiseUv, vtf.randOff)); float2 indCoord = mul(vtf.indMtx, float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy; float indScene = dot(sceneTex.Sample(samp, vtf.sceneUv + indCoord), kRGBToYPrime); - float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg1 * noiseTexel + vtf.colorReg2; - colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.a + vtf.colorReg2.a; + float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r; + colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a; return colorOut; } @@ -247,7 +247,6 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]], float4 noiseTexel = noiseTex.read(Lookup8BPP(vtf.noiseUv, vtf.randOff)); float2 indCoord = (vtf.indMtx * float3(noiseTexel.r - 0.5, noiseTexel.a - 0.5, 1.0)).xy; float indScene = dot(sceneTex.sample(samp, vtf.sceneUv + indCoord), kRGBToYPrime); - float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg1 * noiseTexel + vtf.colorReg2; - colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.a + vtf.colorReg2.a; - return colorOut; + float4 colorOut = vtf.colorReg0 * indScene + vtf.colorReg2 - vtf.colorReg1 * noiseTexel.r; + colorOut.a = vtf.colorReg1.a + vtf.colorReg1.a * noiseTexel.r + vtf.colorReg2.a; } diff --git a/hecl b/hecl index 947155734..b92572e4d 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 947155734274041bc7b3ab1bb8267d0491e48554 +Subproject commit b92572e4d1331813f5bfc2b70a6a69bb473db67f