Correct stateblock settings to display probes more correctly without crushing other forward elements.

This commit is contained in:
Areloch 2019-02-18 00:43:21 -06:00
parent b754c022ba
commit 87e9d3edbd
6 changed files with 43 additions and 36 deletions

View file

@ -1733,11 +1733,6 @@ void PostEffect::_checkRequirements()
// properly, we can find all the input textures,
// and its formats are supported.
if (mShaderName == String("PFX_ReflectionProbeArray") || getName() == StringTable->insert("reflectionProbeArrayPostFX"))
{
bool derp = true;
}
mIsValid = false;
mUpdateShader = false;
mShader = NULL;

View file

@ -44,6 +44,8 @@
//For our cameraQuery setup
#include "T3D/gameTSCtrl.h"
#define TORQUE_GFX_VISUAL_DEBUG //renderdoc debugging
IMPLEMENT_CONOBJECT(RenderProbeMgr);
ConsoleDocClass( RenderProbeMgr,

View file

@ -325,14 +325,20 @@ singleton ShaderData( PFX_ReflectionProbeArray )
singleton GFXStateBlockData( PFX_ReflectionProbeArrayStateBlock )
{
samplersDefined = true;
samplerStates[0] = SamplerClampLinear;
alphaDefined = true;
alphaTestEnable = true;
alphaTestRef = 1;
alphaTestFunc = GFXCmpGreaterEqual;
// Do a one to one blend.
blendDefined = true;
blendEnable = true;
blendSrc = GFXBlendSrcAlpha;
blendDest = GFXBlendInvSrcAlpha;
blendOp = GFXBlendOpAdd;
blendSrc = GFXBlendOne;
blendDest = GFXBlendOne;
zDefined = true;
zEnable = false;
zWriteEnable = false;
};
singleton PostEffect( reflectionProbeArrayPostFX )
@ -353,10 +359,7 @@ singleton PostEffect( reflectionProbeArrayPostFX )
texture[1] = "#color";
texture[2] = "#matinfo";
texture[3] = "core/art/pbr/brdfTexture.dds";
targetClearColor = "0 0 0 0";
targetClear = PFXTargetClear_OnDraw;
targetFormat = "GFXFormatR16G16B16A16F";
target = "#iblBuffer";
target = "AL_FormatToken";
};
singleton PostEffect( IBLFlipPostFX )

View file

@ -47,7 +47,7 @@ function initRenderManager()
};
DiffuseRenderPassManager.addManager( new RenderPassStateBin() { renderOrder = 0.001; stateToken = AL_FormatToken; } );
DiffuseRenderPassManager.addManager( new RenderProbeMgr(ProbeBin) { bintype = "Probes"; renderOrder = 0.019; processAddOrder = 0.02; } );
DiffuseRenderPassManager.addManager( new RenderProbeMgr(ProbeBin) { bintype = "Probes"; renderOrder = 0.019; processAddOrder = 0.019; } );
//DiffuseRenderPassManager.addManager( new RenderVistaMgr() { bintype = "Vista"; renderOrder = 0.15; processAddOrder = 0.15; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(BeginBin) { bintype = "Begin"; renderOrder = 0.2; processAddOrder = 0.2; } );

View file

@ -132,7 +132,7 @@ new SimGroup(MissionGroup) {
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
Bake = "0";
position = "-0.0194688 0 4";
position = "-0.0194688 0.139717 4.10014";
rotation = "1 0 0 0";
scale = "5 5 5";
canSave = "1";
@ -147,7 +147,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -166,7 +166,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -185,7 +185,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -204,7 +204,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -223,7 +223,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -242,7 +242,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -261,7 +261,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -280,7 +280,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -299,7 +299,7 @@ new SimGroup(MissionGroup) {
SkyColor = "0.5 0.5 1 1";
};
new BoxEnvironmentProbe() {
enabled = "1";
enabled = "0";
radius = "5";
posOffset = "0 0 0";
ReflectionMode = "Baked Cubemap";
@ -327,7 +327,7 @@ new SimGroup(MissionGroup) {
surface = "0 0 0 1 0 0 0.5";
surface = "0 1 0 0 0 0 -0.5";
surface = "0.707107 0 0 0.707106 0 0.5 0";
surface = "0.707107 0 0 0.707107 0 0.5 0";
surface = "0 0.707107 -0.707107 0 0 -0.5 -2.84217e-14";
surface = "0.5 0.5 -0.5 0.5 -0.5 0 -9.93411e-08";
surface = "0.5 -0.5 0.5 0.5 0.5 0 -9.93411e-08";
@ -342,7 +342,7 @@ new SimGroup(MissionGroup) {
surface = "0 0 0 1 0 0 0.5";
surface = "0 1 0 0 0 0 -0.5";
surface = "0.707107 0 0 0.707106 0 0.5 0";
surface = "0.707107 0 0 0.707107 0 0.5 0";
surface = "0 0.707107 -0.707107 0 0 -0.5 -2.84217e-14";
surface = "0.5 0.5 -0.5 0.5 -0.5 0 -9.93411e-08";
surface = "0.5 -0.5 0.5 0.5 0.5 0 -9.93411e-08";
@ -357,7 +357,7 @@ new SimGroup(MissionGroup) {
surface = "0 0 0 1 0 0 0.5";
surface = "0 1 0 0 0 0 -0.5";
surface = "0.707107 0 0 0.707107 0 0.5 0";
surface = "0.707107 0 0 0.707106 0 0.5 0";
surface = "0 0.707107 -0.707107 0 0 -0.5 -2.84217e-14";
surface = "0.5 0.5 -0.5 0.5 -0.5 0 -9.93411e-08";
surface = "0.5 -0.5 0.5 0.5 0.5 0 -9.93411e-08";
@ -372,7 +372,7 @@ new SimGroup(MissionGroup) {
surface = "0 0 0 1 0 0 0.5";
surface = "0 1 0 0 0 0 -0.5";
surface = "0.707107 0 0 0.707107 0 0.5 0";
surface = "0.707107 0 0 0.707106 0 0.5 0";
surface = "0 0.707107 -0.707107 0 0 -0.5 -2.84217e-14";
surface = "0.5 0.5 -0.5 0.5 -0.5 0 -9.93411e-08";
surface = "0.5 -0.5 0.5 0.5 0.5 0 -9.93411e-08";
@ -387,7 +387,7 @@ new SimGroup(MissionGroup) {
surface = "0 0 0 1 0 0 0.5";
surface = "0 1 0 0 0 0 -0.5";
surface = "0.707107 0 0 0.707107 0 0.5 0";
surface = "0.707107 0 0 0.707106 0 0.5 0";
surface = "0 0.707107 -0.707107 0 0 -0.5 -2.84217e-14";
surface = "0.5 0.5 -0.5 0.5 -0.5 0 -9.93411e-08";
surface = "0.5 -0.5 0.5 0.5 0.5 0 -9.93411e-08";
@ -402,7 +402,7 @@ new SimGroup(MissionGroup) {
surface = "0 0 0 1 0 0 0.5";
surface = "0 1 0 0 0 0 -0.5";
surface = "0.707107 0 0 0.707106 0 0.5 0";
surface = "0.707107 0 0 0.707107 0 0.5 0";
surface = "0 0.707107 -0.707107 0 0 -0.5 -2.84217e-14";
surface = "0.5 0.5 -0.5 0.5 -0.5 0 -9.93411e-08";
surface = "0.5 -0.5 0.5 0.5 0.5 0 -9.93411e-08";
@ -417,7 +417,7 @@ new SimGroup(MissionGroup) {
surface = "0 0 0 1 0 0 0.5";
surface = "0 1 0 0 0 0 -0.5";
surface = "0.707107 0 0 0.707107 0 0.5 0";
surface = "0.707107 0 0 0.707106 0 0.5 0";
surface = "0 0.707107 -0.707107 0 0 -0.5 -2.84217e-14";
surface = "0.5 0.5 -0.5 0.5 -0.5 0 -9.93411e-08";
surface = "0.5 -0.5 0.5 0.5 0.5 0 -9.93411e-08";

View file

@ -65,9 +65,14 @@ float3 iblBoxSpecular(Surface surface, TORQUE_SAMPLER2D(brdfTexture), int id)
float2 brdf = TORQUE_TEX2DLOD(brdfTexture, float4(surface.roughness, surface.NdotV,0.0,0.0)).xy;
// Radiance (Specular)
#if DEBUGVIZ_SPECCUBEMAP == 0
float lod = surface.roughness*cubeMips;
#elif DEBUGVIZ_SPECCUBEMAP == 1
float lod = 0;
#endif
float3 cubeR = boxProject(surface.P, surface.V, surface.R, inProbePosArray[id].xyz, bbMinArray[id].xyz, bbMaxArray[id].xyz);
float3 radiance = TORQUE_TEXCUBEARRAYLOD(cubeMapAR,cubeR,id,lod).xyz * (brdf.x + brdf.y);
return radiance;
@ -102,7 +107,7 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
if (getFlag(surface.matFlag, 0))
{
discard;
}
}
int i = 0;
@ -143,10 +148,12 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
}*/
// Normalize blendVal
#if DEBUGVIZ_ATTENUATION == 0 //this can likely be removed when we fix the above normalization behavior
if (blendSum == 0.0f) // Possible with custom weight
{
blendSum = 1.0f;
}
#endif
float invBlendSumWeighted = 1.0f / blendSum;
for (i = 0; i < numProbes; ++i)
@ -168,7 +175,7 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
if (blendVal[i] == 0)
continue;
finalContribColor += blendSum * probeContribColors[i].rgb;
finalContribColor += blendVal[i] * probeContribColors[i].rgb;
}
return float4(finalContribColor, 1);