mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-23 13:25:36 +00:00
adds wetness
cliffsnotes: $Core::WetnessTexture = "core/rendering/images/wetMap.png"; //for the influence degree map probes/skylight have a new canDamp boolean, set to off for probes, on for skylight by default. :levelinfo has a dampness multiplier (0-1) kicked up numTextures from 8 to 16 for shaderdata and postfx since that hit the 8 texture-in prior limit, and we've already adopted apis that can handle the higher count
This commit is contained in:
parent
e16351605b
commit
d23ee397e6
31 changed files with 352 additions and 100 deletions
|
|
@ -2982,6 +2982,10 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
skylightCubemapIdx->uniform = true;
|
||||
skylightCubemapIdx->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var* SkylightDamp = new Var("SkylightDamp", "int");
|
||||
SkylightDamp->uniform = true;
|
||||
SkylightDamp->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var * inProbePosArray = new Var("inProbePosArray", "vec4");
|
||||
inProbePosArray->arraySize = MAX_FORWARD_PROBES;
|
||||
inProbePosArray->uniform = true;
|
||||
|
|
@ -3025,6 +3029,14 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
irradianceCubemapAR->sampler = true;
|
||||
irradianceCubemapAR->constNum = Var::getTexUnitNum();
|
||||
|
||||
// create texture var
|
||||
Var* WetnessTexture = new Var;
|
||||
WetnessTexture->setType("sampler2D");
|
||||
WetnessTexture->setName("WetnessTexture");
|
||||
WetnessTexture->uniform = true;
|
||||
WetnessTexture->sampler = true;
|
||||
WetnessTexture->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* surface = getSurface(componentList, meta, fd);
|
||||
|
||||
if (!surface)
|
||||
|
|
@ -3051,14 +3063,29 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
}
|
||||
|
||||
|
||||
Var* accumTime = (Var*)LangElement::find("accumTime");
|
||||
if (!accumTime)
|
||||
{
|
||||
accumTime = new Var("accumTime", "float");
|
||||
accumTime->uniform = true;
|
||||
accumTime->constSortPos = cspPass;
|
||||
}
|
||||
Var* dampness = (Var*)LangElement::find("dampness");
|
||||
if (!dampness)
|
||||
{
|
||||
dampness = new Var("dampness", "float");
|
||||
dampness->uniform = true;
|
||||
dampness->constSortPos = cspPass;
|
||||
}
|
||||
|
||||
//Reflection vec
|
||||
String computeForwardProbes = String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@).rgb; \r\n");
|
||||
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), new DecOp(ibl), surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray, eyePos,
|
||||
skylightCubemapIdx, BRDFTexture,
|
||||
skylightCubemapIdx, SkylightDamp, BRDFTexture, WetnessTexture, accumTime, dampness,
|
||||
irradianceCubemapAR, specularCubemapAR));
|
||||
|
||||
Var *ambient = (Var *)LangElement::find("ambient");
|
||||
|
|
@ -3078,8 +3105,8 @@ ShaderFeature::Resources ReflectionProbeFeatGLSL::getResources(const MaterialFea
|
|||
{
|
||||
Resources res;
|
||||
|
||||
res.numTex = 3;
|
||||
res.numTexReg = 3;
|
||||
res.numTex = 4;
|
||||
res.numTexReg = 4;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -3098,5 +3125,7 @@ void ReflectionProbeFeatGLSL::setTexData(Material::StageData& stageDat,
|
|||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
passData.mSamplerNames[texIndex] = "IrradianceCubemapAR";
|
||||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
passData.mSamplerNames[texIndex] = "WetnessTexture";
|
||||
passData.mTexType[texIndex++] = Material::Standard;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3060,6 +3060,10 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
skylightCubemapIdx->uniform = true;
|
||||
skylightCubemapIdx->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var* SkylightDamp = new Var("SkylightDamp", "int");
|
||||
SkylightDamp->uniform = true;
|
||||
SkylightDamp->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *inProbePosArray = new Var("inProbePosArray", "float4");
|
||||
inProbePosArray->arraySize = MAX_FORWARD_PROBES;
|
||||
inProbePosArray->uniform = true;
|
||||
|
|
@ -3115,6 +3119,16 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
irradianceCubemapARTex->texture = true;
|
||||
irradianceCubemapARTex->constNum = irradianceCubemapAR->constNum;
|
||||
|
||||
Var* WetnessTexture = new Var("WetnessTexture", "SamplerState");
|
||||
WetnessTexture->uniform = true;
|
||||
WetnessTexture->sampler = true;
|
||||
WetnessTexture->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* WetnessTextureTex = new Var("texture_WetnessTexture", "Texture2D");
|
||||
WetnessTextureTex->uniform = true;
|
||||
WetnessTextureTex->texture = true;
|
||||
WetnessTextureTex->constNum = WetnessTexture->constNum;
|
||||
|
||||
Var* surface = getSurface(componentList, meta, fd);
|
||||
|
||||
if (!surface)
|
||||
|
|
@ -3142,12 +3156,28 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
eyePos->constSortPos = cspPass;
|
||||
}
|
||||
|
||||
Var* accumTime = (Var*)LangElement::find("accumTime");
|
||||
if (!accumTime)
|
||||
{
|
||||
accumTime = new Var("accumTime", "float");
|
||||
accumTime->uniform = true;
|
||||
accumTime->constSortPos = cspPass;
|
||||
}
|
||||
|
||||
Var* dampness = (Var*)LangElement::find("dampness");
|
||||
if (!dampness)
|
||||
{
|
||||
dampness = new Var("dampness", "float");
|
||||
dampness->uniform = true;
|
||||
dampness->constSortPos = cspPass;
|
||||
}
|
||||
|
||||
String computeForwardProbes = String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,TORQUE_SAMPLER2D_MAKEARG(@),\r\n\t\t");
|
||||
computeForwardProbes += String("@,@,TORQUE_SAMPLER2D_MAKEARG(@),TORQUE_SAMPLER2D_MAKEARG(@), @, @,\r\n\t\t");
|
||||
computeForwardProbes += 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, refScaleArray, inRefPosArray, eyePos,
|
||||
skylightCubemapIdx, BRDFTexture,
|
||||
skylightCubemapIdx, SkylightDamp, BRDFTexture, WetnessTexture, accumTime, dampness,
|
||||
irradianceCubemapAR, specularCubemapAR));
|
||||
|
||||
Var *ambient = (Var *)LangElement::find("ambient");
|
||||
|
|
@ -3167,8 +3197,8 @@ ShaderFeature::Resources ReflectionProbeFeatHLSL::getResources(const MaterialFea
|
|||
{
|
||||
Resources res;
|
||||
|
||||
res.numTex = 3;
|
||||
res.numTexReg = 3;
|
||||
res.numTex = 4;
|
||||
res.numTexReg = 4;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -3187,5 +3217,7 @@ void ReflectionProbeFeatHLSL::setTexData(Material::StageData &stageDat,
|
|||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
passData.mSamplerNames[texIndex] = "IrradianceCubemapAR";
|
||||
passData.mTexType[texIndex++] = Material::SGCube;
|
||||
passData.mSamplerNames[texIndex] = "WetnessTexture";
|
||||
passData.mTexType[texIndex++] = Material::Standard;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ const String ShaderGenVars::colorMultiply("$colorMultiply");
|
|||
const String ShaderGenVars::alphaTestValue("$alphaTestValue");
|
||||
const String ShaderGenVars::texMat("$texMat");
|
||||
const String ShaderGenVars::accumTime("$accumTime");
|
||||
const String ShaderGenVars::dampness("$dampness");
|
||||
const String ShaderGenVars::minnaertConstant("$minnaertConstant");
|
||||
const String ShaderGenVars::subSurfaceParams("$subSurfaceParams");
|
||||
|
||||
|
|
@ -90,11 +91,13 @@ const String ShaderGenVars::irradianceCubemapAR("$IrradianceCubemapAR");
|
|||
const String ShaderGenVars::probeCount("$inNumProbes");
|
||||
|
||||
const String ShaderGenVars::BRDFTextureMap("$BRDFTexture");
|
||||
const String ShaderGenVars::WetnessTextureMap("$WetnessTexture");
|
||||
|
||||
const String ShaderGenVars::maxProbeDrawDistance("$maxProbeDrawDistance");
|
||||
|
||||
//Skylight
|
||||
const String ShaderGenVars::skylightCubemapIdx("$inSkylightCubemapIdx");
|
||||
const String ShaderGenVars::skylightDamp("$SkylightDamp");
|
||||
|
||||
// These are ignored by the D3D layers.
|
||||
const String ShaderGenVars::fogMap("$fogMap");
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ struct ShaderGenVars
|
|||
const static String alphaTestValue;
|
||||
const static String texMat;
|
||||
const static String accumTime;
|
||||
const static String dampness;
|
||||
const static String minnaertConstant;
|
||||
const static String subSurfaceParams;
|
||||
|
||||
|
|
@ -101,11 +102,12 @@ struct ShaderGenVars
|
|||
const static String probeCount;
|
||||
|
||||
const static String BRDFTextureMap;
|
||||
|
||||
const static String WetnessTextureMap;
|
||||
const static String maxProbeDrawDistance;
|
||||
|
||||
//Skylight
|
||||
const static String skylightCubemapIdx;
|
||||
const static String skylightDamp;
|
||||
|
||||
// Textures
|
||||
const static String fogMap;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue