mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
differentiate forward lit and deferred ibl vars
since we're not currently using the same arrays et al for the whole pass, need to make sure those don't fight
This commit is contained in:
parent
8c2aaaad18
commit
42bc6fa358
|
|
@ -780,8 +780,8 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
|||
|
||||
mProbeArrayEffect->setShaderConst("$probeContribColors", contribColors);
|
||||
|
||||
mProbeArrayEffect->setShaderConst("$inProbePosArray", mProbeData.probePositionArray);
|
||||
mProbeArrayEffect->setShaderConst("$inRefPosArray", mProbeData.probeRefPositionArray);
|
||||
mProbeArrayEffect->setShaderConst("$probePosArray", mProbeData.probePositionArray);
|
||||
mProbeArrayEffect->setShaderConst("$refPosArray", mProbeData.probeRefPositionArray);
|
||||
mProbeArrayEffect->setShaderConst("$worldToObjArray", mProbeData.probeWorldToObjArray);
|
||||
mProbeArrayEffect->setShaderConst("$refScaleArray", mProbeData.refScaleArray);
|
||||
mProbeArrayEffect->setShaderConst("$probeConfigData", mProbeData.probeConfigArray);
|
||||
|
|
|
|||
|
|
@ -2981,7 +2981,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
//Reflection Probe WIP
|
||||
U32 MAX_FORWARD_PROBES = 4;
|
||||
|
||||
Var * numProbes = new Var("numProbes", "int");
|
||||
Var * numProbes = new Var("inNumProbes", "int");
|
||||
numProbes->uniform = true;
|
||||
numProbes->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
|
|
@ -2989,7 +2989,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
cubeMips->uniform = true;
|
||||
cubeMips->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * skylightCubemapIdx = new Var("skylightCubemapIdx", "float");
|
||||
Var * skylightCubemapIdx = new Var("inSkylightCubemapIdx", "float");
|
||||
skylightCubemapIdx->uniform = true;
|
||||
skylightCubemapIdx->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
|
|
@ -3008,12 +3008,12 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
refScaleArray->uniform = true;
|
||||
refScaleArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * probeConfigData = new Var("probeConfigData", "vec4");
|
||||
Var * probeConfigData = new Var("inProbeConfigData", "vec4");
|
||||
probeConfigData->arraySize = MAX_FORWARD_PROBES;
|
||||
probeConfigData->uniform = true;
|
||||
probeConfigData->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * worldToObjArray = new Var("worldToObjArray", "mat4");
|
||||
Var * worldToObjArray = new Var("inWorldToObjArray", "mat4");
|
||||
worldToObjArray->arraySize = MAX_FORWARD_PROBES;
|
||||
worldToObjArray->uniform = true;
|
||||
worldToObjArray->constSortPos = cspPotentialPrimitive;
|
||||
|
|
@ -3026,12 +3026,12 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
BRDFTexture->sampler = true;
|
||||
BRDFTexture->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var * specularCubemapAR = new Var("specularCubemapAR", "samplerCubeArray");
|
||||
Var * specularCubemapAR = new Var("inSpecularCubemapAR", "samplerCubeArray");
|
||||
specularCubemapAR->uniform = true;
|
||||
specularCubemapAR->sampler = true;
|
||||
specularCubemapAR->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var * irradianceCubemapAR = new Var("irradianceCubemapAR", "samplerCubeArray");
|
||||
Var * irradianceCubemapAR = new Var("inIrradianceCubemapAR", "samplerCubeArray");
|
||||
irradianceCubemapAR->uniform = true;
|
||||
irradianceCubemapAR->sampler = true;
|
||||
irradianceCubemapAR->constNum = Var::getTexUnitNum();
|
||||
|
|
@ -3078,9 +3078,9 @@ void ReflectionProbeFeatGLSL::setTexData(Material::StageData& stageDat,
|
|||
passData.mSamplerNames[texIndex] = "BRDFTexture";
|
||||
passData.mTexType[texIndex++] = Material::Standard;
|
||||
// assuming here that it is a scenegraph cubemap
|
||||
passData.mSamplerNames[texIndex] = "specularCubemapAR";
|
||||
passData.mSamplerNames[texIndex] = "inSpecularCubemapAR";
|
||||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
passData.mSamplerNames[texIndex] = "irradianceCubemapAR";
|
||||
passData.mSamplerNames[texIndex] = "inIrradianceCubemapAR";
|
||||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,24 +135,24 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
|
|||
//Reflection Probe WIP
|
||||
U32 MAX_FORWARD_PROBES = 4;
|
||||
|
||||
Var* numProbes = (Var*)LangElement::find("numProbes");
|
||||
Var* numProbes = (Var*)LangElement::find("inNumProbes");
|
||||
Var* cubeMips = (Var*)LangElement::find("cubeMips");
|
||||
Var* skylightCubemapIdx = (Var*)LangElement::find("skylightCubemapIdx");
|
||||
Var* skylightCubemapIdx = (Var*)LangElement::find("inSkylightCubemapIdx");
|
||||
Var* inProbePosArray = (Var*)LangElement::find("inProbePosArray");
|
||||
Var* inRefPosArray = (Var*)LangElement::find("inRefPosArray");
|
||||
Var* refScaleArray = (Var*)LangElement::find("inRefScale");
|
||||
|
||||
Var* probeConfigData = (Var*)LangElement::find("probeConfigData");
|
||||
Var* worldToObjArray = (Var*)LangElement::find("worldToObjArray");
|
||||
Var* probeConfigData = (Var*)LangElement::find("inProbeConfigData");
|
||||
Var* worldToObjArray = (Var*)LangElement::find("inWorldToObjArray");
|
||||
|
||||
Var* BRDFTexture = (Var*)LangElement::find("BRDFTexture");
|
||||
Var* BRDFTextureTex = (Var*)LangElement::find("texture_BRDFTexture");
|
||||
|
||||
Var* specularCubemapAR = (Var*)LangElement::find("specularCubemapAR");
|
||||
Var* specularCubemapARTex = (Var*)LangElement::find("texture_specularCubemapAR");
|
||||
Var* specularCubemapAR = (Var*)LangElement::find("inSpecularCubemapAR");
|
||||
Var* specularCubemapARTex = (Var*)LangElement::find("texture_inSpecularCubemapAR");
|
||||
|
||||
Var* irradianceCubemapAR = (Var*)LangElement::find("irradianceCubemapAR");
|
||||
Var* irradianceCubemapARTex = (Var*)LangElement::find("texture_irradianceCubemapAR");
|
||||
Var* irradianceCubemapAR = (Var*)LangElement::find("inIrradianceCubemapAR");
|
||||
Var* irradianceCubemapARTex = (Var*)LangElement::find("texture_inIrradianceCubemapAR");
|
||||
|
||||
Var* matinfo = (Var*)LangElement::find("ORMConfig");
|
||||
Var* metalness = (Var*)LangElement::find("metalness");
|
||||
|
|
|
|||
|
|
@ -3054,7 +3054,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
//Reflection Probe WIP
|
||||
U32 MAX_FORWARD_PROBES = 4;
|
||||
|
||||
Var *numProbes = new Var("numProbes", "int");
|
||||
Var *numProbes = new Var("inNumProbes", "int");
|
||||
numProbes->uniform = true;
|
||||
numProbes->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
|
|
@ -3062,7 +3062,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
cubeMips->uniform = true;
|
||||
cubeMips->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * skylightCubemapIdx = new Var("skylightCubemapIdx", "float");
|
||||
Var * skylightCubemapIdx = new Var("inSkylightCubemapIdx", "float");
|
||||
skylightCubemapIdx->uniform = true;
|
||||
skylightCubemapIdx->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
|
|
@ -3081,12 +3081,12 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
refScaleArray->uniform = true;
|
||||
refScaleArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *probeConfigData = new Var("probeConfigData", "float4");
|
||||
Var *probeConfigData = new Var("inProbeConfigData", "float4");
|
||||
probeConfigData->arraySize = MAX_FORWARD_PROBES;
|
||||
probeConfigData->uniform = true;
|
||||
probeConfigData->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *worldToObjArray = new Var("worldToObjArray", "float4x4");
|
||||
Var *worldToObjArray = new Var("inWorldToObjArray", "float4x4");
|
||||
worldToObjArray->arraySize = MAX_FORWARD_PROBES;
|
||||
worldToObjArray->uniform = true;
|
||||
worldToObjArray->constSortPos = cspPotentialPrimitive;
|
||||
|
|
@ -3101,22 +3101,22 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
BRDFTextureTex->texture = true;
|
||||
BRDFTextureTex->constNum = BRDFTexture->constNum;
|
||||
|
||||
Var *specularCubemapAR = new Var("specularCubemapAR", "SamplerState");
|
||||
Var *specularCubemapAR = new Var("inSpecularCubemapAR", "SamplerState");
|
||||
specularCubemapAR->uniform = true;
|
||||
specularCubemapAR->sampler = true;
|
||||
specularCubemapAR->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *specularCubemapARTex = new Var("texture_specularCubemapAR", "TextureCubeArray");
|
||||
Var *specularCubemapARTex = new Var("texture_inSpecularCubemapAR", "TextureCubeArray");
|
||||
specularCubemapARTex->uniform = true;
|
||||
specularCubemapARTex->texture = true;
|
||||
specularCubemapARTex->constNum = specularCubemapAR->constNum;
|
||||
|
||||
Var *irradianceCubemapAR = new Var("irradianceCubemapAR", "SamplerState");
|
||||
Var *irradianceCubemapAR = new Var("inIrradianceCubemapAR", "SamplerState");
|
||||
irradianceCubemapAR->uniform = true;
|
||||
irradianceCubemapAR->sampler = true;
|
||||
irradianceCubemapAR->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *irradianceCubemapARTex = new Var("texture_irradianceCubemapAR", "TextureCubeArray");
|
||||
Var *irradianceCubemapARTex = new Var("texture_inIrradianceCubemapAR", "TextureCubeArray");
|
||||
irradianceCubemapARTex->uniform = true;
|
||||
irradianceCubemapARTex->texture = true;
|
||||
irradianceCubemapARTex->constNum = irradianceCubemapAR->constNum;
|
||||
|
|
@ -3171,9 +3171,9 @@ void ReflectionProbeFeatHLSL::setTexData(Material::StageData &stageDat,
|
|||
passData.mSamplerNames[texIndex] = "BRDFTexture";
|
||||
passData.mTexType[texIndex++] = Material::Standard;
|
||||
// assuming here that it is a scenegraph cubemap
|
||||
passData.mSamplerNames[texIndex] = "specularCubemapAR";
|
||||
passData.mSamplerNames[texIndex] = "inSpecularCubemapAR";
|
||||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
passData.mSamplerNames[texIndex] = "irradianceCubemapAR";
|
||||
passData.mSamplerNames[texIndex] = "inIrradianceCubemapAR";
|
||||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,20 +78,21 @@ const String ShaderGenVars::roughness("$roughness");
|
|||
const String ShaderGenVars::metalness("$metalness");
|
||||
const String ShaderGenVars::glowMul("$glowMul");
|
||||
|
||||
//Reflection Probes
|
||||
//Reflection Probes - Forward lit. not to be confused with the deferred handwritten vars
|
||||
//change to parity once we've got the same arrays used for both routes
|
||||
const String ShaderGenVars::probePosition("$inProbePosArray");
|
||||
const String ShaderGenVars::probeRefPos("$inRefPosArray");
|
||||
const String ShaderGenVars::refScale("$inRefScale");
|
||||
const String ShaderGenVars::worldToObjArray("$worldToObjArray");
|
||||
const String ShaderGenVars::probeConfigData("$probeConfigData");
|
||||
const String ShaderGenVars::specularCubemapAR("$specularCubemapAR");
|
||||
const String ShaderGenVars::irradianceCubemapAR("$irradianceCubemapAR");
|
||||
const String ShaderGenVars::probeCount("$numProbes");
|
||||
const String ShaderGenVars::worldToObjArray("inWorldToObjArray");
|
||||
const String ShaderGenVars::probeConfigData("$inProbeConfigData");
|
||||
const String ShaderGenVars::specularCubemapAR("$inSpecularCubemapAR");
|
||||
const String ShaderGenVars::irradianceCubemapAR("$inIrradianceCubemapAR");
|
||||
const String ShaderGenVars::probeCount("$inNumProbes");
|
||||
|
||||
const String ShaderGenVars::BRDFTextureMap("$BRDFTexture");
|
||||
|
||||
//Skylight
|
||||
const String ShaderGenVars::skylightCubemapIdx("$skylightCubemapIdx");
|
||||
const String ShaderGenVars::skylightCubemapIdx("$inSkylightCubemapIdx");
|
||||
|
||||
// These are ignored by the D3D layers.
|
||||
const String ShaderGenVars::fogMap("$fogMap");
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ uniform sampler2D ssaoMask;
|
|||
uniform vec4 rtParams6;
|
||||
#endif
|
||||
|
||||
uniform vec4 inProbePosArray[MAX_PROBES];
|
||||
uniform vec4 inRefPosArray[MAX_PROBES];
|
||||
uniform vec4 probePosArray[MAX_PROBES];
|
||||
uniform vec4 refPosArray[MAX_PROBES];
|
||||
uniform mat4 worldToObjArray[MAX_PROBES];
|
||||
uniform vec4 refScaleArray[MAX_PROBES];
|
||||
uniform vec4 probeConfigData[MAX_PROBES]; //r,g,b/mode,radius,atten
|
||||
|
|
@ -92,7 +92,7 @@ void main()
|
|||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g);
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ void main()
|
|||
if (contrib > 0.0f)
|
||||
{
|
||||
float cubemapIdx = probeConfigData[i].a;
|
||||
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, refPosArray[i].xyz);
|
||||
|
||||
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
|
||||
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ TORQUE_UNIFORM_SAMPLER2D(ssaoMask, 6);
|
|||
uniform float4 rtParams6;
|
||||
#endif
|
||||
|
||||
uniform float4 inProbePosArray[MAX_PROBES];
|
||||
uniform float4 inRefPosArray[MAX_PROBES];
|
||||
uniform float4 probePosArray[MAX_PROBES];
|
||||
uniform float4 refPosArray[MAX_PROBES];
|
||||
uniform float4x4 worldToObjArray[MAX_PROBES];
|
||||
uniform float4 refScaleArray[MAX_PROBES];
|
||||
uniform float4 probeConfigData[MAX_PROBES]; //r,g,b/mode,radius,atten
|
||||
|
|
@ -86,7 +86,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g);
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
if (contrib > 0.0f)
|
||||
{
|
||||
int cubemapIdx = probeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, refPosArray[i].xyz);
|
||||
|
||||
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
|
||||
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
|
||||
|
|
|
|||
Loading…
Reference in a new issue