mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
forward lit ambient application. fix GL side IBL overwriting forward lit color.a
This commit is contained in:
parent
5be18a4638
commit
0e0088cab9
2 changed files with 30 additions and 5 deletions
|
|
@ -3033,6 +3033,15 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Var *curColor = (Var *)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
|
||||||
|
|
||||||
|
//Reflection vec
|
||||||
|
Var *ibl = (Var *)LangElement::find("ibl");
|
||||||
|
if (!ibl)
|
||||||
|
{
|
||||||
|
ibl = new Var("ibl", "float3");
|
||||||
|
}
|
||||||
|
|
||||||
Var* eyePos = (Var*)LangElement::find("eyePosWorld");
|
Var* eyePos = (Var*)LangElement::find("eyePosWorld");
|
||||||
if (!eyePos)
|
if (!eyePos)
|
||||||
{
|
{
|
||||||
|
|
@ -3043,17 +3052,25 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
||||||
eyePos->constSortPos = cspPass;
|
eyePos->constSortPos = cspPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
Var *curColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
|
|
||||||
|
|
||||||
//Reflection vec
|
//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("@,@,\r\n\t\t");
|
||||||
computeForwardProbes += String("@,@).rgb; \r\n");
|
computeForwardProbes += String("@,@).rgb; \r\n");
|
||||||
|
|
||||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), curColor, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray, eyePos,
|
meta->addStatement(new GenOp(computeForwardProbes.c_str(), new DecOp(ibl), surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray, eyePos,
|
||||||
skylightCubemapIdx, BRDFTexture,
|
skylightCubemapIdx, BRDFTexture,
|
||||||
irradianceCubemapAR, specularCubemapAR));
|
irradianceCubemapAR, specularCubemapAR));
|
||||||
|
|
||||||
|
Var *ambient = (Var *)LangElement::find("ambient");
|
||||||
|
if (!ambient)
|
||||||
|
{
|
||||||
|
ambient = new Var("ambient", "vec4");
|
||||||
|
eyePos->uniform = true;
|
||||||
|
eyePos->constSortPos = cspPass;
|
||||||
|
}
|
||||||
|
meta->addStatement(new GenOp(" @.rgb *= @.rgb;\r\n", ibl, ambient));
|
||||||
|
meta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", curColor, ibl));
|
||||||
|
|
||||||
output = meta;
|
output = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3150,6 +3150,14 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
||||||
skylightCubemapIdx, BRDFTexture,
|
skylightCubemapIdx, BRDFTexture,
|
||||||
irradianceCubemapAR, specularCubemapAR));
|
irradianceCubemapAR, specularCubemapAR));
|
||||||
|
|
||||||
|
Var *ambient = (Var *)LangElement::find("ambient");
|
||||||
|
if (!ambient)
|
||||||
|
{
|
||||||
|
ambient = new Var("ambient","float4");
|
||||||
|
eyePos->uniform = true;
|
||||||
|
eyePos->constSortPos = cspPass;
|
||||||
|
}
|
||||||
|
meta->addStatement(new GenOp(" @.rgb *= @.rgb;\r\n", ibl, ambient));
|
||||||
meta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", curColor, ibl));
|
meta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", curColor, ibl));
|
||||||
|
|
||||||
output = meta;
|
output = meta;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue