mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Overhauls the handling of probes to utilize an active probe list to improve performance and allow a greater total number of active probes in a scene.
Also fixes handling of metal materials during bakes to render properly, and fixes a possible double-up return in findObjectByType, which could cause doubling when getting probes in the scene
This commit is contained in:
parent
072b5ecb19
commit
6a3603c737
22 changed files with 490 additions and 610 deletions
|
|
@ -3004,15 +3004,10 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
inRefPosArray->uniform = true;
|
||||
inRefPosArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * refBoxMinArray = new Var("inRefBoxMin", "vec4");
|
||||
refBoxMinArray->arraySize = MAX_FORWARD_PROBES;
|
||||
refBoxMinArray->uniform = true;
|
||||
refBoxMinArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * refBoxMaxArray = new Var("inRefBoxMax", "vec4");
|
||||
refBoxMaxArray->arraySize = MAX_FORWARD_PROBES;
|
||||
refBoxMaxArray->uniform = true;
|
||||
refBoxMaxArray->constSortPos = cspPotentialPrimitive;
|
||||
Var * refScaleArray = new Var("inRefScale", "vec4");
|
||||
refScaleArray->arraySize = MAX_FORWARD_PROBES;
|
||||
refScaleArray->uniform = true;
|
||||
refScaleArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * probeConfigData = new Var("probeConfigData", "vec4");
|
||||
probeConfigData->arraySize = MAX_FORWARD_PROBES;
|
||||
|
|
@ -3053,11 +3048,11 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
Var *curColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
|
||||
|
||||
//Reflection vec
|
||||
String computeForwardProbes = String(" @.rgb = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
String computeForwardProbes = String(" @.rgb = computeForwardProbes(@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@).rgb; \r\n");
|
||||
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), curColor, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refBoxMinArray, refBoxMaxArray, inRefPosArray,
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), curColor, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray,
|
||||
skylightCubemapIdx, BRDFTexture,
|
||||
irradianceCubemapAR, specularCubemapAR));
|
||||
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
|
|||
Var* skylightCubemapIdx = (Var*)LangElement::find("skylightCubemapIdx");
|
||||
Var* inProbePosArray = (Var*)LangElement::find("inProbePosArray");
|
||||
Var* inRefPosArray = (Var*)LangElement::find("inRefPosArray");
|
||||
Var* refBoxMinArray = (Var*)LangElement::find("inRefBoxMin");
|
||||
Var* refBoxMaxArray = (Var*)LangElement::find("inRefBoxMax");
|
||||
Var* refScaleArray = (Var*)LangElement::find("inRefScale");
|
||||
|
||||
Var* probeConfigData = (Var*)LangElement::find("probeConfigData");
|
||||
Var* worldToObjArray = (Var*)LangElement::find("worldToObjArray");
|
||||
|
|
@ -181,11 +180,11 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
|
|||
dSprintf(buf, sizeof(buf), " @ = %s;\r\n", showDiff);
|
||||
meta->addStatement(new GenOp(buf, new DecOp(showDiffVar)));
|
||||
|
||||
String computeForwardProbes = String::String(" @ = debugVizForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
String computeForwardProbes = String::String(" @ = debugVizForwardProbes(@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String::String("@,TORQUE_SAMPLER2D_MAKEARG(@),\r\n\t\t");
|
||||
computeForwardProbes += String::String("TORQUE_SAMPLERCUBEARRAY_MAKEARG(@),TORQUE_SAMPLERCUBEARRAY_MAKEARG(@), @, @, @, @).rgb; \r\n");
|
||||
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), ibl, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refBoxMinArray, refBoxMaxArray, inRefPosArray,
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), ibl, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray,
|
||||
skylightCubemapIdx, BRDFTexture,
|
||||
irradianceCubemapAR, specularCubemapAR,
|
||||
showAttenVar, showContribVar, showSpecVar, showDiffVar));
|
||||
|
|
|
|||
|
|
@ -3075,15 +3075,10 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
inRefPosArray->uniform = true;
|
||||
inRefPosArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * refBoxMinArray = new Var("inRefBoxMin", "float4");
|
||||
refBoxMinArray->arraySize = MAX_FORWARD_PROBES;
|
||||
refBoxMinArray->uniform = true;
|
||||
refBoxMinArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * refBoxMaxArray = new Var("inRefBoxMax", "float4");
|
||||
refBoxMaxArray->arraySize = MAX_FORWARD_PROBES;
|
||||
refBoxMaxArray->uniform = true;
|
||||
refBoxMaxArray->constSortPos = cspPotentialPrimitive;
|
||||
Var * refScaleArray = new Var("inRefScale", "float4");
|
||||
refScaleArray->arraySize = MAX_FORWARD_PROBES;
|
||||
refScaleArray->uniform = true;
|
||||
refScaleArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *probeConfigData = new Var("probeConfigData", "float4");
|
||||
probeConfigData->arraySize = MAX_FORWARD_PROBES;
|
||||
|
|
@ -3142,11 +3137,11 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
ibl = new Var("ibl", "float3");
|
||||
}
|
||||
|
||||
String computeForwardProbes = String::String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
String computeForwardProbes = String::String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String::String("@,TORQUE_SAMPLER2D_MAKEARG(@),\r\n\t\t");
|
||||
computeForwardProbes += String::String("TORQUE_SAMPLERCUBEARRAY_MAKEARG(@),TORQUE_SAMPLERCUBEARRAY_MAKEARG(@)).rgb; \r\n");
|
||||
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), new DecOp(ibl), surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refBoxMinArray, refBoxMaxArray, inRefPosArray,
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), new DecOp(ibl), surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray,
|
||||
skylightCubemapIdx, BRDFTexture,
|
||||
irradianceCubemapAR, specularCubemapAR));
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ const String ShaderGenVars::glowMul("$glowMul");
|
|||
//Reflection Probes
|
||||
const String ShaderGenVars::probePosition("$inProbePosArray");
|
||||
const String ShaderGenVars::probeRefPos("$inRefPosArray");
|
||||
const String ShaderGenVars::refBoxMin("$inRefBoxMin");
|
||||
const String ShaderGenVars::refBoxMax("$inRefBoxMax");
|
||||
const String ShaderGenVars::refScale("$inRefScale");
|
||||
const String ShaderGenVars::worldToObjArray("$worldToObjArray");
|
||||
const String ShaderGenVars::probeConfigData("$probeConfigData");
|
||||
const String ShaderGenVars::specularCubemapAR("$specularCubemapAR");
|
||||
|
|
|
|||
|
|
@ -93,8 +93,7 @@ struct ShaderGenVars
|
|||
//Reflection Probes
|
||||
const static String probePosition;
|
||||
const static String probeRefPos;
|
||||
const static String refBoxMin;
|
||||
const static String refBoxMax;
|
||||
const static String refScale;
|
||||
const static String worldToObjArray;
|
||||
const static String probeConfigData;
|
||||
const static String specularCubemapAR;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue