From d3eb2f77842ed6f29e324273958780c5fc8ef6b4 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Nov 2018 12:00:06 -0600 Subject: [PATCH] put sphereical influence back via the new spherical attenuation methods, shifted the stateblock for probes specifically to max of either source or desitination alpha (though not entirely convinced that is in fact the case) --- Engine/source/lighting/probeManager.cpp | 2 +- .../lighting/advanced/reflectionProbeP.hlsl | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Engine/source/lighting/probeManager.cpp b/Engine/source/lighting/probeManager.cpp index f92cebcca..ec52e544c 100644 --- a/Engine/source/lighting/probeManager.cpp +++ b/Engine/source/lighting/probeManager.cpp @@ -780,7 +780,7 @@ bool ReflectProbeMatInstance::setupPass(SceneRenderState *state, const SceneData desc.setZReadWrite(false); desc.zWriteEnable = false; desc.setCullMode(GFXCullNone); - desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvDestAlpha, GFXBlendOpAdd); + desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendDestAlpha, GFXBlendOpMax); mProjectionState = GFX->createStateBlock(desc); } // Now override stateblock with our own diff --git a/Templates/Full/game/shaders/common/lighting/advanced/reflectionProbeP.hlsl b/Templates/Full/game/shaders/common/lighting/advanced/reflectionProbeP.hlsl index a6296ff5c..71a51ae5e 100644 --- a/Templates/Full/game/shaders/common/lighting/advanced/reflectionProbeP.hlsl +++ b/Templates/Full/game/shaders/common/lighting/advanced/reflectionProbeP.hlsl @@ -111,10 +111,21 @@ float4 main( ConvexConnectP IN ) : SV_TARGET //create surface Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer), uvScene, eyePosWorld, wsEyeRay, cameraToWorld); - - float tempAttenVal = 3.5; - float blendVal = defineBoxSpaceInfluence(surface.P, probeWSPos, radius, tempAttenVal); - clip(blendVal); + float blendVal = 1.0; + if(useSphereMode) + { + float3 L = probeWSPos - surface.P; + blendVal = getDistanceAtt(L, radius); + if (length(L)>radius) + blendVal = -1; + + } + else + { + float tempAttenVal = 3.5; + blendVal = defineBoxSpaceInfluence(surface.P, probeWSPos, radius, tempAttenVal); + } + clip(blendVal); //render into the bound space defined above