mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Added fetch for BRDF texture for forward rendering use, re-enabled brdf logic in the lighting shader and got the probe arrays properly sampling into forward as well.
TODO: core::rendering pref on the BRDF texture instead of hardcode path, add best-pick logic for forward probes and double-check ogl forward is playing nice.
This commit is contained in:
parent
98a3ff604a
commit
4e557aec83
6 changed files with 40 additions and 21 deletions
|
|
@ -127,6 +127,7 @@ ProbeShaderConstants::ProbeShaderConstants()
|
|||
mProbeSpecularCubemapSC(NULL),
|
||||
mProbeIrradianceCubemapSC(NULL),
|
||||
mProbeCountSC(NULL),
|
||||
mBRDFTextureMap(NULL),
|
||||
mSkylightSpecularMap(NULL),
|
||||
mSkylightIrradMap(NULL),
|
||||
mHasSkylight(NULL)
|
||||
|
|
@ -164,6 +165,8 @@ void ProbeShaderConstants::init(GFXShader* shader)
|
|||
mProbeIrradianceCubemapSC = shader->getShaderConstHandle(ShaderGenVars::irradianceCubemapAR);
|
||||
mProbeCountSC = shader->getShaderConstHandle(ShaderGenVars::probeCount);
|
||||
|
||||
mBRDFTextureMap = shader->getShaderConstHandle(ShaderGenVars::BRDFTextureMap);
|
||||
|
||||
mSkylightSpecularMap = shader->getShaderConstHandle(ShaderGenVars::skylightPrefilterMap);
|
||||
mSkylightIrradMap = shader->getShaderConstHandle(ShaderGenVars::skylightIrradMap);
|
||||
mHasSkylight = shader->getShaderConstHandle(ShaderGenVars::hasSkylight);
|
||||
|
|
@ -654,7 +657,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
|||
bool hasSkylight = false;
|
||||
for (U32 i = 0; i < probeCount; i++)
|
||||
{
|
||||
if (effectiveProbeCount >= 4)
|
||||
if (effectiveProbeCount >= MAX_FORWARD_PROBES)
|
||||
break;
|
||||
|
||||
const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i];
|
||||
|
|
@ -675,18 +678,18 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
|||
}*/
|
||||
if (!curEntry.mIsSkylight)
|
||||
{
|
||||
/*probePositions[effectiveProbeCount] = curEntry.getPosition();
|
||||
probeRefPositions[effectiveProbeCount] = curEntry.mProbeRefOffset;
|
||||
probeWorldToObj[effectiveProbeCount] = curEntry.getTransform();
|
||||
probeBBMin[effectiveProbeCount] = curEntry.mBounds.minExtents;
|
||||
probeBBMax[effectiveProbeCount] = curEntry.mBounds.maxExtents;
|
||||
probeConfig[effectiveProbeCount] = Point4F(curEntry.mProbeShapeType,
|
||||
probePositionArray[effectiveProbeCount] = curEntry.getPosition();
|
||||
probeRefPositionArray[effectiveProbeCount] = curEntry.mProbeRefOffset;
|
||||
probeWorldToObjArray[effectiveProbeCount] = curEntry.getTransform();
|
||||
probeBoxMinArray[effectiveProbeCount] = curEntry.mBounds.minExtents;
|
||||
probeBoxMaxArray[effectiveProbeCount] = curEntry.mBounds.maxExtents;
|
||||
probeConfigArray[effectiveProbeCount] = Point4F(curEntry.mProbeShapeType,
|
||||
curEntry.mRadius,
|
||||
curEntry.mAtten,
|
||||
curEntry.mCubemapIndex);*/
|
||||
}
|
||||
curEntry.mCubemapIndex);
|
||||
|
||||
effectiveProbeCount++;
|
||||
effectiveProbeCount++;
|
||||
}
|
||||
}
|
||||
|
||||
shaderConsts->setSafe(probeShaderConsts->mProbeCountSC, (float)effectiveProbeCount);
|
||||
|
|
@ -699,11 +702,19 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
|
|||
shaderConsts->setSafe(probeShaderConsts->mProbeBoxMinSC, probeBoxMinArray);
|
||||
shaderConsts->setSafe(probeShaderConsts->mProbeBoxMaxSC, probeBoxMaxArray);
|
||||
shaderConsts->setSafe(probeShaderConsts->mProbeConfigDataSC, probeConfigArray);
|
||||
//GFX->setCubeArrayTexture(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister(), mPrefilterArray);
|
||||
//GFX->setCubeArrayTexture(probeShaderConsts->mProbeIrradianceCubemapSC->getSamplerRegister(), mIrradianceArray);
|
||||
GFX->setCubeArrayTexture(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister(), mPrefilterArray);
|
||||
GFX->setCubeArrayTexture(probeShaderConsts->mProbeIrradianceCubemapSC->getSamplerRegister(), mIrradianceArray);
|
||||
}
|
||||
|
||||
//if (!hasSkylight)
|
||||
// shaderConsts->setSafe(probeShaderConsts->mHasSkylight, 0.0f);
|
||||
if (probeShaderConsts->mBRDFTextureMap->isValid())
|
||||
{
|
||||
if (!mBRDFTexture.isValid())
|
||||
{
|
||||
//try to fetch it
|
||||
mBRDFTexture.set("core/art/pbr/brdfTexture.dds", &GFXStaticTextureSRGBProfile, "BRDF Texture");
|
||||
}
|
||||
|
||||
GFX->setTexture(probeShaderConsts->mBRDFTextureMap->getSamplerRegister(), mBRDFTexture.getPointer());
|
||||
}
|
||||
|
||||
//check for skylight action
|
||||
|
|
|
|||
|
|
@ -143,6 +143,8 @@ struct ProbeShaderConstants
|
|||
GFXShaderConstHandle *mProbeIrradianceCubemapSC;
|
||||
GFXShaderConstHandle *mProbeCountSC;
|
||||
|
||||
GFXShaderConstHandle *mBRDFTextureMap;
|
||||
|
||||
GFXShaderConstHandle *mSkylightSpecularMap;
|
||||
GFXShaderConstHandle *mSkylightIrradMap;
|
||||
GFXShaderConstHandle *mHasSkylight;
|
||||
|
|
@ -227,6 +229,8 @@ class RenderProbeMgr : public RenderBinManager
|
|||
//Default skylight, used for shape editors, etc
|
||||
ProbeRenderInst* mDefaultSkyLight;
|
||||
|
||||
GFXTexHandle mBRDFTexture;
|
||||
|
||||
public:
|
||||
RenderProbeMgr();
|
||||
RenderProbeMgr(RenderInstType riType, F32 renderOrder, F32 processAddOrder);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue