From 9859d9b7bc8a84e00b8dc75ae7b7b9c428a62843 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 21 Jul 2019 23:01:15 -0500 Subject: [PATCH 1/2] 'correct' refscale back to mismatching between forward and deferred. Because Reasons. >.> --- Engine/source/renderInstance/renderProbeMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index ad25e3c64..f4415d939 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -639,8 +639,8 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData, probeWorldToObjArray[effectiveProbeCount] = curEntry.getTransform(); Point3F refPos = curEntry.getPosition() + curEntry.mProbeRefOffset; - Point3F refBoxMin = refPos - curEntry.mProbeRefScale/2 * curEntry.getTransform().getScale(); - Point3F refBoxMax = refPos + curEntry.mProbeRefScale/2 * curEntry.getTransform().getScale(); + Point3F refBoxMin = refPos - curEntry.mProbeRefScale * curEntry.getTransform().getScale(); + Point3F refBoxMax = refPos + curEntry.mProbeRefScale * curEntry.getTransform().getScale(); refBoxMinArray[effectiveProbeCount] = Point4F(refBoxMin.x, refBoxMin.y, refBoxMin.z, 0); refBoxMaxArray[effectiveProbeCount] = Point4F(refBoxMax.x, refBoxMax.y, refBoxMax.z, 0); From b6c28638b0700400c2ef58d005f3c79bc8ce65b9 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 21 Jul 2019 23:03:32 -0500 Subject: [PATCH 2/2] crashfix: we don't actually need the texture coordinates for forward lit surface creation. at that point, the rest of the shader features have already filled out the info being looked up from the gbuffer for deferred. (was triggering errors with float2 vs float3 coord entries for terrain) --- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 8 ++------ .../BaseGame/game/core/rendering/shaders/lighting.hlsl | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 9056a4afc..d81cc55a0 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -848,10 +848,6 @@ Var* ShaderFeatureHLSL::getSurface(Vector& componentList, Mult meta->addStatement(new GenOp(" @ = float4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening } - Var* inTex = getInTexCoord("texCoord", "float2", componentList); - if (!inTex) - return nullptr; - Var* wsNormal = (Var*)LangElement::find("wsNormal"); Var* normal = (Var*)LangElement::find("normal"); if (!normal) @@ -878,8 +874,8 @@ Var* ShaderFeatureHLSL::getSurface(Vector& componentList, Mult if (!surface) { surface = new Var("surface", "Surface"); - meta->addStatement(new GenOp(" @ = createForwardSurface(@,@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, normal, matinfo, - inTex, wsPosition, wsEyePos, wsView)); + meta->addStatement(new GenOp(" @ = createForwardSurface(@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, normal, matinfo, + wsPosition, wsEyePos, wsView)); } return surface; diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl index 91304c95d..f2ea1d4cc 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl @@ -122,8 +122,7 @@ inline Surface createSurface(float4 gbuffer0, TORQUE_SAMPLER2D(gbufferTex1), TOR return surface; } -inline Surface createForwardSurface(float4 baseColor, float3 normal, float4 pbrProperties, in float2 uv, - in float3 wsPosition, in float3 wsEyePos, in float3 wsEyeRay) +inline Surface createForwardSurface(float4 baseColor, float3 normal, float4 pbrProperties, in float3 wsPosition, in float3 wsEyePos, in float3 wsEyeRay) { Surface surface = (Surface)0;