mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
Cleanup/consolidation of shader logic. moved the common methods over to lighting.hlsl
Did all the setup work to feed data for forward probestuffs, just have to rewrite the shaderFeature to replicate the regular probe array logic.
This commit is contained in:
parent
f722e06980
commit
283348f7bc
8 changed files with 241 additions and 255 deletions
|
|
@ -3010,52 +3010,57 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
Var *albedo = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
|
||||
|
||||
//Reflection Probe WIP
|
||||
Var *inProbePos = new Var("inProbePos", "float3");
|
||||
Var *inProbePos = new Var("inProbePosArray", "float4");
|
||||
inProbePos->arraySize = 4;
|
||||
inProbePos->uniform = true;
|
||||
inProbePos->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *inProbeRadius = new Var("inProbeRadius", "float");
|
||||
Var *inProbeRadius = new Var("inRefPosArray", "float4");
|
||||
inProbeRadius->arraySize = 4;
|
||||
inProbeRadius->uniform = true;
|
||||
inProbeRadius->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *inProbeBoxMin = new Var("inProbeBoxMin", "float3");
|
||||
Var *inProbeBoxMin = new Var("inProbeBoxMin", "float4");
|
||||
inProbeBoxMin->arraySize = 4;
|
||||
inProbeBoxMin->uniform = true;
|
||||
inProbeBoxMin->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *inProbeBoxMax = new Var("inProbeBoxMax", "float3");
|
||||
Var *inProbeBoxMax = new Var("inProbeBoxMax", "float4");
|
||||
inProbeBoxMax->arraySize = 4;
|
||||
inProbeBoxMax->uniform = true;
|
||||
inProbeBoxMax->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *inProbeIsSphere = new Var("inProbeIsSphere", "float");
|
||||
Var *inProbeIsSphere = new Var("probeConfigData", "float4");
|
||||
inProbeIsSphere->arraySize = 4;
|
||||
inProbeIsSphere->uniform = true;
|
||||
inProbeIsSphere->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *inProbeLocalPos = new Var("inProbeLocalPos", "float3");
|
||||
inProbeLocalPos->arraySize = 4;
|
||||
inProbeLocalPos->uniform = true;
|
||||
inProbeLocalPos->constSortPos = cspPotentialPrimitive;
|
||||
Var *worldToObjArray = new Var("worldToObjArray", "float4x4");
|
||||
worldToObjArray->arraySize = 4;
|
||||
worldToObjArray->uniform = true;
|
||||
worldToObjArray->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
Var *inProbeCubemap = new Var("inProbeCubemap", "SamplerState");
|
||||
//inProbeCubemap->arraySize = 4;
|
||||
inProbeCubemap->uniform = true;
|
||||
inProbeCubemap->sampler = true;
|
||||
inProbeCubemap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
Var *specularCubemapAR = new Var("specularCubemapAR", "SamplerState");
|
||||
specularCubemapAR->uniform = true;
|
||||
specularCubemapAR->sampler = true;
|
||||
specularCubemapAR->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *inProbeCubemapTex = new Var("inProbeCubemapTex", "TextureCube");
|
||||
//inProbeCubemapTex->arraySize = 4;
|
||||
inProbeCubemapTex->uniform = true;
|
||||
inProbeCubemapTex->texture = true;
|
||||
inProbeCubemapTex->constNum = inProbeCubemap->constNum;
|
||||
Var *specularCubemapARTex = new Var("specularCubemapARTex", "TextureCubeArray");
|
||||
specularCubemapARTex->uniform = true;
|
||||
specularCubemapARTex->texture = true;
|
||||
specularCubemapARTex->constNum = specularCubemapAR->constNum;
|
||||
|
||||
//Var *nDotL = new Var("nDotL", "float3");
|
||||
//meta->addStatement(new GenOp(" @ = abs(dot(@,@);\r\n", new DecOp(nDotL), wsView, wsNormal));
|
||||
Var *irradianceCubemapAR = new Var("irradianceCubemapAR", "SamplerState");
|
||||
irradianceCubemapAR->uniform = true;
|
||||
irradianceCubemapAR->sampler = true;
|
||||
irradianceCubemapAR->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *probeVec = new Var("probeVec", "float3");
|
||||
Var *irradianceCubemapARTex = new Var("irradianceCubemapARTex", "TextureCubeArray");
|
||||
irradianceCubemapARTex->uniform = true;
|
||||
irradianceCubemapARTex->texture = true;
|
||||
irradianceCubemapARTex->constNum = specularCubemapAR->constNum;
|
||||
|
||||
/*Var *probeVec = new Var("probeVec", "float3");
|
||||
meta->addStatement(new GenOp(" @ = @[0] - @;\r\n", new DecOp(probeVec), inProbePos, wsPosition));
|
||||
|
||||
Var *nDotL = new Var("nDotL", "float");
|
||||
|
|
@ -3087,7 +3092,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
|
||||
|
||||
meta->addStatement(new GenOp("/* if (dot( @, @ ) < 0.0f)\r\n", probeVec, wsNormal));
|
||||
meta->addStatement(new GenOp(" clip(@); */\r\n", fa));
|
||||
meta->addStatement(new GenOp(" clip(@); *//*\r\n", fa));
|
||||
|
||||
|
||||
meta->addStatement(new GenOp(" \r\n"));
|
||||
|
|
@ -3130,7 +3135,9 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.rgb = simpleFresnel(@.rgb, @, 0, @, @, @));\r\n", albedo, albedo, probeColor, angle, FRESNEL_BIAS, FRESNEL_POWER));
|
||||
}
|
||||
}*/
|
||||
|
||||
meta->addStatement(new GenOp(" @.rgb = float3(1,1,1);\r\n", albedo));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,15 +70,21 @@ const String ShaderGenVars::smoothness("$smoothness");
|
|||
const String ShaderGenVars::metalness("$metalness");
|
||||
|
||||
//Reflection Probes
|
||||
const String ShaderGenVars::probePosition("$inProbePos");
|
||||
const String ShaderGenVars::probeRadius("$inProbeRadius");
|
||||
const String ShaderGenVars::probePosition("$inProbePosArray");
|
||||
const String ShaderGenVars::probeRefPos("$inRefPosArray");
|
||||
const String ShaderGenVars::probeBoxMin("$inProbeBoxMin");
|
||||
const String ShaderGenVars::probeBoxMax("$inProbeBoxMax");
|
||||
const String ShaderGenVars::probeLocalPos("$inProbeLocalPos");
|
||||
const String ShaderGenVars::probeIsSphere("$inProbeIsSphere");
|
||||
const String ShaderGenVars::probeCubemap("$inProbeCubemap");
|
||||
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");
|
||||
|
||||
//Skylight
|
||||
const String ShaderGenVars::skylightPrefilterMap("$skylightPrefilterMap");
|
||||
const String ShaderGenVars::skylightIrradMap("$skylightIrradMap");
|
||||
const String ShaderGenVars::hasSkylight("$hasSkylight");
|
||||
|
||||
// These are ignored by the D3D layers.
|
||||
const String ShaderGenVars::fogMap("$fogMap");
|
||||
const String ShaderGenVars::dlightMap("$dlightMap");
|
||||
|
|
|
|||
|
|
@ -84,13 +84,19 @@ struct ShaderGenVars
|
|||
|
||||
//Reflection Probes
|
||||
const static String probePosition;
|
||||
const static String probeRadius;
|
||||
const static String probeRefPos;
|
||||
const static String probeBoxMin;
|
||||
const static String probeBoxMax;
|
||||
const static String probeLocalPos;
|
||||
const static String probeIsSphere;
|
||||
const static String probeCubemap;
|
||||
const static String worldToObjArray;
|
||||
const static String probeConfigData;
|
||||
const static String specularCubemapAR;
|
||||
const static String irradianceCubemapAR;
|
||||
const static String probeCount;
|
||||
|
||||
//Skylight
|
||||
const static String skylightPrefilterMap;
|
||||
const static String skylightIrradMap;
|
||||
const static String hasSkylight;
|
||||
|
||||
// Textures
|
||||
const static String fogMap;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue