Org rework and postFX-setup WIP

This commit is contained in:
Areloch 2019-02-08 01:35:35 -06:00
commit b221b312d2
4 changed files with 169 additions and 49 deletions

View file

@ -450,4 +450,62 @@ new CustomMaterial( ReflectionProbeArrayMaterial )
sampler["BRDFTexture"] = "core/art/pbr/brdfTexture.dds";
pixVersion = 3.0;
};
//
//
singleton ShaderData( PFX_ReflectionProbeArray )
{
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
DXPixelShaderFile = "shaders/common/lighting/advanced/reflectionProbeArrayP.hlsl";
//OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
//OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl";
//samplerNames[0] = "$inputTex";
samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$colorBuffer";
samplerNames[2] = "$matInfoBuffer";
samplerNames[3] = "$BRDFTexture";
samplerNames[4] = "$cubeMap";
samplerNames[5] = "$irradianceCubemap";
pixVersion = 2.0;
};
singleton GFXStateBlockData( PFX_ReflectionProbeArrayStateBlock )
{
zDefined = true;
zEnable = false;
zWriteEnable = false;
samplersDefined = true;
samplerStates[0] = SamplerClampLinear;
};
singleton PostEffect( reflectionProbeArrayPostFX )
{
// Do not allow the selection effect to work in reflection
// passes by default so we don't do the extra drawing.
//allowReflectPass = false;
renderTime = "PFXAfterDiffuse";
renderBin = "ProbeBin";
renderPriority = 1;
isEnabled = true;
shader = PFX_ReflectionProbeArray;
stateBlock = PFX_ReflectionProbeArrayStateBlock;
//texture[0] = "#highlight";
//texture[1] = "$backBuffer";
texture[0] = "$deferredBuffer";
texture[1] = "$colorBuffer";
texture[2] = "$matInfoBuffer";
texture[3] = "$BRDFTexture";
texture[4] = "$cubeMap";
texture[5] = "$irradianceCubemap";
target = "$backBuffer";
};

View file

@ -1,8 +1,6 @@
#include "../../shaderModelAutoGen.hlsl"
#include "../postFx.hlsl"
#include "farFrustumQuad.hlsl"
#include "../../lighting.hlsl"
#include "../../torque.hlsl"
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 1);
@ -19,6 +17,8 @@ uniform float cubeMips;
#define MAX_PROBES 50
uniform float numProbes;
//TORQUE_UNIFORM_SAMPLERCUBEARRAY(cubeMapAR, 4);
//TORQUE_UNIFORM_SAMPLERCUBEARRAY(irradianceCubemapAR, 5);
TORQUE_UNIFORM_SAMPLERCUBE(cubeMapAR, 4);
TORQUE_UNIFORM_SAMPLERCUBE(irradianceCubemapAR, 5);
uniform float4 inProbePosArray[MAX_PROBES];
@ -50,6 +50,7 @@ float3 iblBoxDiffuse( Surface surface, int id)
{
float3 cubeN = boxProject(surface.P, surface.N, inProbePosArray[id].xyz, bbMinArray[id].xyz, bbMaxArray[id].xyz);
cubeN.z *=-1;
//return TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR,cubeN,id,0).xyz;
return TORQUE_TEXCUBELOD(irradianceCubemapAR,float4(cubeN,0)).xyz;
}
@ -66,8 +67,9 @@ float3 iblBoxSpecular(Surface surface, float3 surfToEye, TORQUE_SAMPLER2D(brdfTe
float3 cubeR = normalize(r);
cubeR = boxProject(surface.P, surface.N, inProbePosArray[id].xyz, bbMinArray[id].xyz, bbMaxArray[id].xyz);
//float3 radiance = TORQUE_TEXCUBEARRAYLOD(cubeMapAR,cubeR,id,lod).xyz * (brdf.x + brdf.y);
float3 radiance = TORQUE_TEXCUBELOD(cubeMapAR,float4(cubeR,lod)).xyz * (brdf.x + brdf.y);
return radiance;
}
@ -88,7 +90,7 @@ float defineBoxSpaceInfluence(Surface surface, int id)
return max(localDir.x, max(localDir.y, localDir.z)) * -1;
}
float4 main( FarFrustumQuadConnectP IN ) : SV_TARGET
float4 main( PFXVertToPix IN ) : SV_TARGET
{
//unpack normal and linear depth
float4 normDepth = TORQUE_DEFERRED_UNCONDITION(deferredBuffer, IN.uv0.xy);