Shifts the verts used to match the fullscreen quad setup of vector light, utilizing FarFrustuQuadVerts

This commit is contained in:
Areloch 2019-01-30 13:52:59 -06:00
parent c6d4ea37b9
commit 3efbdbf9e1
4 changed files with 27 additions and 87 deletions

View file

@ -293,7 +293,7 @@ new ShaderData( ReflectionProbeShader )
samplerNames[4] = "$irradianceCubemap";
samplerNames[5] = "$BRDFTexture";*/
DXVertexShaderFile = "shaders/common/lighting/advanced/reflectionProbeArrayV.hlsl";
DXVertexShaderFile = "shaders/common/lighting/advanced/farFrustumQuadV.hlsl";
DXPixelShaderFile = "shaders/common/lighting/advanced/reflectionProbeArrayP.hlsl";
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/reflectionProbeArrayV.glsl";
@ -302,9 +302,9 @@ new ShaderData( ReflectionProbeShader )
samplerNames[0] = "$deferredBuffer";
samplerNames[1] = "$colorBuffer";
samplerNames[2] = "$matInfoBuffer";
samplerNames[3] = "$cubeMap";
samplerNames[4] = "$irradianceCubemap";
samplerNames[5] = "$BRDFTexture";
samplerNames[3] = "$BRDFTexture";
samplerNames[4] = "$cubeMap";
samplerNames[5] = "$irradianceCubemap";
pixVersion = 3.0;
};

View file

@ -4,13 +4,6 @@
#include "../../lighting.hlsl"
#include "../../torque.hlsl"
struct ConvexConnectP
{
float4 pos : TORQUE_POSITION;
float4 uv0 : TEXCOORD1;
float4 vsEyeDir : TEXCOORD2;
};
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 1);
TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 2);
@ -95,22 +88,15 @@ float defineBoxSpaceInfluence(Surface surface, int id)
return max(localDir.x, max(localDir.y, localDir.z)) * -1;
}
float4 main( ConvexConnectP IN ) : SV_TARGET
float4 main( FarFrustumQuadConnectP IN ) : SV_TARGET
{
// Compute scene UV
//float3 ssPos = IN.ssPos.xyz / IN.ssPos.w;
//float2 IN.uv0 = getUVFromSSPos( ssPos, rtParams0 );
//eye ray WS/LS
float3 vsEyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
float3 wsEyeRay = mul(cameraToWorld, float4(vsEyeRay, 0)).xyz;
//unpack normal and linear depth
float4 normDepth = TORQUE_DEFERRED_UNCONDITION(deferredBuffer, IN.uv0.xy);
//create surface
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
IN.uv0.xy, eyePosWorld, wsEyeRay, cameraToWorld);
IN.uv0.xy, eyePosWorld, IN.wsEyeRay, cameraToWorld);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
@ -182,5 +168,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
}
//final diffuse color
float3 diffuse = kD * irradiance * surface.baseColor.rgb;
return float4(diffuse + specular * surface.ao, blendSum);
float4 finalColor = float4(diffuse + specular * surface.ao, blendSum);
return finalColor;
}