mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
reference cleanups:
1) kill off extraneous cubemap and irradiancecubemap source-to-shader variable ties 2) use the cubemap arrays (renderdoc for instance doesn't list them as being input at all if they're never used) 3) use the vert file
This commit is contained in:
parent
6e09ff70d7
commit
4a5a071075
3 changed files with 28 additions and 19 deletions
|
|
@ -729,10 +729,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
|||
MaterialParameterHandle *probeUseSphereModeSC = reflProbeMat->matInstance->getMaterialParameterHandle("$useSphereMode");
|
||||
MaterialParameterHandle *probeRadiusSC = reflProbeMat->matInstance->getMaterialParameterHandle("$radius");
|
||||
MaterialParameterHandle *probeAttenuationSC = reflProbeMat->matInstance->getMaterialParameterHandle("$attenuation");
|
||||
|
||||
MaterialParameterHandle *probeCubemapArraySC = reflProbeMat->matInstance->getMaterialParameterHandle("$cubeMap");
|
||||
MaterialParameterHandle *probeIrradianceArraySC = reflProbeMat->matInstance->getMaterialParameterHandle("$irradianceCubemap");
|
||||
|
||||
|
||||
U32 effectiveProbeCount = 0;
|
||||
|
||||
for (U32 i = 0; i < probeCount; i++)
|
||||
|
|
@ -790,16 +787,28 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
|||
NamedTexTarget *deferredTarget = NamedTexTarget::find(RenderDeferredMgr::BufferName);
|
||||
if (deferredTarget)
|
||||
GFX->setTexture(0, deferredTarget->getTexture());
|
||||
else
|
||||
GFX->setTexture(0, NULL);
|
||||
|
||||
NamedTexTarget *colorTarget = NamedTexTarget::find(RenderDeferredMgr::ColorBufferName);
|
||||
if (colorTarget)
|
||||
GFX->setTexture(1, colorTarget->getTexture());
|
||||
else
|
||||
GFX->setTexture(1, NULL);
|
||||
|
||||
NamedTexTarget *matinfoTarget = NamedTexTarget::find(RenderDeferredMgr::MatInfoBufferName);
|
||||
if (matinfoTarget)
|
||||
GFX->setTexture(2, matinfoTarget->getTexture());
|
||||
else
|
||||
GFX->setTexture(2, NULL);
|
||||
|
||||
if (mBrdfTexture)
|
||||
{
|
||||
GFX->setTexture(3, mBrdfTexture);
|
||||
}
|
||||
else
|
||||
GFX->setTexture(3, NULL);
|
||||
|
||||
GFX->setTexture(3, mBrdfTexture);
|
||||
|
||||
GFX->setCubeArrayTexture(4, mCubemapArray);
|
||||
GFX->setCubeArrayTexture(5, mIrradArray);
|
||||
|
|
|
|||
|
|
@ -293,10 +293,10 @@ new ShaderData( ReflectionProbeShader )
|
|||
samplerNames[4] = "$irradianceCubemap";
|
||||
samplerNames[5] = "$BRDFTexture";*/
|
||||
|
||||
DXVertexShaderFile = "shaders/common/lighting/advanced/convexGeometryV.hlsl";
|
||||
DXVertexShaderFile = "shaders/common/lighting/advanced/reflectionProbeArrayV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/reflectionProbeArrayP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/reflectionProbeArrayV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/reflectionProbeArrayP.glsl";
|
||||
|
||||
samplerNames[0] = "$deferredBuffer";
|
||||
|
|
@ -337,9 +337,9 @@ new GFXStateBlockData( AL_ProbeState )
|
|||
samplerStates[2] = SamplerClampLinear;
|
||||
mSamplerNames[2] = "matInfoBuffer";
|
||||
|
||||
mSamplerNames[3] = "cubeMap";
|
||||
mSamplerNames[4] = "irradianceCubemap";
|
||||
mSamplerNames[5] = "BRDFTexture";
|
||||
mSamplerNames[3] = "BRDFTexture";
|
||||
mSamplerNames[4] = "cubeMap";
|
||||
mSamplerNames[5] = "irradianceCubemap";
|
||||
|
||||
cullDefined = true;
|
||||
cullMode = GFXCullCW;
|
||||
|
|
@ -432,9 +432,9 @@ new ShaderData( ReflectionProbeArrayShader )
|
|||
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;
|
||||
};
|
||||
|
|
@ -445,7 +445,9 @@ new CustomMaterial( ReflectionProbeArrayMaterial )
|
|||
stateBlock = AL_ProbeState;
|
||||
|
||||
sampler["deferredBuffer"] = "#deferred";
|
||||
sampler["colorBuffer"] = "#color";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
sampler["BRDFTexture"] = "core/art/pbr/brdfTexture.dds";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -34,8 +34,8 @@ uniform float cubeMips;
|
|||
#define MAX_PROBES 50
|
||||
|
||||
uniform float numProbes;
|
||||
TORQUE_UNIFORM_SAMPLERCUBEARRAY(cubeMap, 4);
|
||||
TORQUE_UNIFORM_SAMPLERCUBEARRAY(irradianceCubemap, 5);
|
||||
TORQUE_UNIFORM_SAMPLERCUBEARRAY(cubeMapAR, 4);
|
||||
TORQUE_UNIFORM_SAMPLERCUBEARRAY(irradianceCubemapAR, 5);
|
||||
uniform float3 inProbePosArray[MAX_PROBES];
|
||||
uniform float4x4 worldToObjArray[MAX_PROBES];
|
||||
uniform float3 bbMinArray[MAX_PROBES];
|
||||
|
|
@ -65,8 +65,7 @@ float3 iblBoxDiffuse( Surface surface, int id)
|
|||
{
|
||||
float3 cubeN = boxProject(surface.P, surface.N, inProbePosArray[id], bbMinArray[id], bbMaxArray[id]);
|
||||
cubeN.z *=-1;
|
||||
//return TORQUE_TEXCUBEARRAYLOD(irradianceCubemap,cubeN,id,0).xyz;
|
||||
return float3(1,1,1);
|
||||
return TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR,cubeN,id,0).xyz;
|
||||
}
|
||||
|
||||
float3 iblBoxSpecular(Surface surface, float3 surfToEye, TORQUE_SAMPLER2D(brdfTexture), int id)
|
||||
|
|
@ -82,8 +81,7 @@ float3 iblBoxSpecular(Surface surface, float3 surfToEye, TORQUE_SAMPLER2D(brdfTe
|
|||
float3 cubeR = normalize(r);
|
||||
cubeR = boxProject(surface.P, surface.N, inProbePosArray[id], bbMinArray[id], bbMaxArray[id]);
|
||||
|
||||
//float3 radiance = TORQUE_TEXCUBEARRAYLOD(cubeMap,cubeR,id,lod).xyz * (brdf.x + brdf.y);
|
||||
float3 radiance = float3(1,1,1);
|
||||
float3 radiance = TORQUE_TEXCUBEARRAYLOD(cubeMapAR,cubeR,id,lod).xyz * (brdf.x + brdf.y);
|
||||
|
||||
return radiance;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue