From 2a941e733e45b927190f8528cbe08e748302f894 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 13 Apr 2024 15:23:30 -0500 Subject: [PATCH 1/6] asset browser was passing along screen position, not scene position based on drop at options --- .../game/tools/assetBrowser/scripts/assetBrowser.tscript | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 9d04721c6..a0a196a4e 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -2535,20 +2535,20 @@ function EWorldEditor::onControlDropped( %this, %payload, %position ) { if(%assetType $= "Datablock") { - %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %asset @ ",\"" @ %position @ "\");"; + %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %asset @ ",\"" @ %pos @ "\");"; } else if(%assetType $= "Prefab") { - %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(\"" @ %module @ "/" @ %asset @ "\",\"" @ %position @ "\");"; + %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(\"" @ %module @ "/" @ %asset @ "\",\"" @ %pos @ "\");"; } else if(%assetType $= "Creator") { - %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %module @ ",\"" @ %position @ "\");"; + %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %module @ ",\"" @ %pos @ "\");"; } else { %assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset); - %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %position @ "\");"; + %buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %pos @ "\");"; } eval(%buildCommand); From fdbc55b733d3100dcb434825b9f17b40362f614d Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 13 Apr 2024 16:28:56 -0500 Subject: [PATCH 2/6] fix arrowPrimative badfilereference --- .../Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml index 4dd762c17..3f887b720 100644 --- a/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml +++ b/Templates/BaseGame/game/data/Prototyping/shapes/Primitives/ArrowPrimitive.asset.taml @@ -1,5 +1,5 @@ From 785872d39860c2fb7c1e55b9af2ad27496de169b Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 15 Apr 2024 13:20:09 -0500 Subject: [PATCH 3/6] getPrefabByCHild should skip NULLs --- Engine/source/T3D/prefab.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/T3D/prefab.cpp b/Engine/source/T3D/prefab.cpp index 75dc8f521..1351fd92b 100644 --- a/Engine/source/T3D/prefab.cpp +++ b/Engine/source/T3D/prefab.cpp @@ -460,6 +460,8 @@ void Prefab::_onFileChanged( const Torque::Path &path ) Prefab* Prefab::getPrefabByChild( SimObject *child ) { + if (child == NULL) return NULL; + ChildToPrefabMap::Iterator itr = smChildToPrefabMap.find( child->getId() ); if ( itr == smChildToPrefabMap.end() ) return NULL; From f6419d965918a6fa73013b8a8872f25b620fd5f5 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 15 Apr 2024 15:33:06 -0500 Subject: [PATCH 4/6] fix order of ops mangling useGroupCenter snapping --- Engine/source/gui/worldEditor/gizmo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/gui/worldEditor/gizmo.cpp b/Engine/source/gui/worldEditor/gizmo.cpp index 9b7c55aeb..0c5b06614 100644 --- a/Engine/source/gui/worldEditor/gizmo.cpp +++ b/Engine/source/gui/worldEditor/gizmo.cpp @@ -961,11 +961,11 @@ void Gizmo::on3DMouseDragged( const Gui3DMouseEvent & event ) mDeltaTotalPos = projPnt - mMouseDownProjPnt; newPosition = mSavedTransform.getPosition() + mDeltaTotalPos; - mDeltaPos = newPosition - mTransform.getPosition(); - if (mProfile->snapToGrid) newPosition = _snapPoint(newPosition); + mDeltaPos = newPosition - mTransform.getPosition(); + mTransform.setPosition( newPosition ); mCurrentTransform.setPosition( newPosition ); From fe26ffc37514d4467ed66783008efc998f6b448d Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 16 Apr 2024 13:51:41 -0500 Subject: [PATCH 5/6] shift capturing from a globalMacro to a sceneRenderstate S32 lets us ditch shader recompilation so that can be done on the fly without hitches, though does cost us a per-shader const for objects and postfx --- .../materials/processedCustomMaterial.cpp | 1 + .../materials/processedShaderMaterial.cpp | 4 ++ .../materials/processedShaderMaterial.h | 1 + Engine/source/postFx/postEffect.cpp | 7 ++- Engine/source/postFx/postEffect.h | 2 + .../source/renderInstance/renderProbeMgr.cpp | 38 +-------------- Engine/source/scene/sceneRenderState.h | 1 + Engine/source/shaderGen/shaderGenVars.cpp | 2 + Engine/source/shaderGen/shaderGenVars.h | 2 + .../core/rendering/shaders/gl/lighting.glsl | 46 ++++++++----------- .../game/core/rendering/shaders/lighting.hlsl | 46 ++++++++----------- .../advanced/gl/reflectionProbeArrayP.glsl | 10 ++-- .../advanced/reflectionProbeArrayP.hlsl | 10 ++-- 13 files changed, 69 insertions(+), 101 deletions(-) diff --git a/Engine/source/materials/processedCustomMaterial.cpp b/Engine/source/materials/processedCustomMaterial.cpp index abca21dd9..43d21ec8f 100644 --- a/Engine/source/materials/processedCustomMaterial.cpp +++ b/Engine/source/materials/processedCustomMaterial.cpp @@ -328,6 +328,7 @@ bool ProcessedCustomMaterial::setupPass( SceneRenderState *state, const SceneDat shaderConsts->setSafe(rpd->shaderHandles.mAccumTimeSC, MATMGR->getTotalTime()); shaderConsts->setSafe(rpd->shaderHandles.mDampnessSC, MATMGR->getDampnessClamped()); + shaderConsts->setSafe(rpd->shaderHandles.mIsCapturingSC, state ? (S32)state->isCapturing() : 0); return true; } diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 83f58e1d9..450d0bf25 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -115,6 +115,8 @@ void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/) // MFT_HardwareSkinning mNodeTransforms = shader->getShaderConstHandle( "$nodeTransforms" ); + mIsCapturingSC = shader->getShaderConstHandle(ShaderGenVars::isCapturing); + // Clear any existing texture handles. dMemset( mTexHandlesSC, 0, sizeof( mTexHandlesSC ) ); if(mat) @@ -1093,6 +1095,8 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons shaderConsts->setSafe( handles->mAccumTimeSC, MATMGR->getTotalTime() ); shaderConsts->setSafe(handles->mDampnessSC, MATMGR->getDampnessClamped()); + shaderConsts->setSafe(handles->mIsCapturingSC, (S32)state->isCapturing()); + // If the shader constants have not been lost then // they contain the content from a previous render pass. // diff --git a/Engine/source/materials/processedShaderMaterial.h b/Engine/source/materials/processedShaderMaterial.h index a1bde06f1..e922b61a8 100644 --- a/Engine/source/materials/processedShaderMaterial.h +++ b/Engine/source/materials/processedShaderMaterial.h @@ -104,6 +104,7 @@ public: GFXShaderConstHandle* mNodeTransforms; + GFXShaderConstHandle* mIsCapturingSC; struct customHandleData { StringTableEntry handleName; diff --git a/Engine/source/postFx/postEffect.cpp b/Engine/source/postFx/postEffect.cpp index f5513f848..c1ebaee52 100644 --- a/Engine/source/postFx/postEffect.cpp +++ b/Engine/source/postFx/postEffect.cpp @@ -498,7 +498,8 @@ PostEffect::PostEffect() mMatCameraToWorldSC( NULL), mInvCameraTransSC(NULL), mMatCameraToScreenSC(NULL), - mMatScreenToCameraSC(NULL) + mMatScreenToCameraSC(NULL), + mIsCapturingSC(NULL) { dMemset( mTexSRGB, 0, sizeof(bool) * NumTextures); dMemset( mActiveTextures, 0, sizeof( GFXTextureObject* ) * NumTextures ); @@ -798,8 +799,12 @@ void PostEffect::_setupConstants( const SceneRenderState *state ) mInvCameraTransSC = mShader->getShaderConstHandle("$invCameraTrans"); mMatCameraToScreenSC = mShader->getShaderConstHandle("$cameraToScreen"); mMatScreenToCameraSC = mShader->getShaderConstHandle("$screenToCamera"); + mIsCapturingSC = mShader->getShaderConstHandle("$isCapturing"); } + if (mIsCapturingSC->isValid()) + mShaderConsts->set(mIsCapturingSC, (S32)state->isCapturing()); + // Set up shader constants for source image size if ( mRTSizeSC->isValid() ) { diff --git a/Engine/source/postFx/postEffect.h b/Engine/source/postFx/postEffect.h index 9b7e7afef..89c4b7427 100644 --- a/Engine/source/postFx/postEffect.h +++ b/Engine/source/postFx/postEffect.h @@ -164,6 +164,8 @@ protected: GFXShaderConstHandle *mMatCameraToScreenSC; GFXShaderConstHandle *mMatScreenToCameraSC; + GFXShaderConstHandle* mIsCapturingSC; + bool mAllowReflectPass; /// If true update the shader. diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index 954d199e2..32f781f15 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -503,47 +503,13 @@ void RenderProbeMgr::reloadTextures() void RenderProbeMgr::preBake() { RenderProbeMgr::smBakeReflectionProbes = true; - GFXShader::addGlobalMacro("CAPTURING", String("1")); - - //Con::setVariable("$Probes::Capturing", "1"); - mRenderMaximumNumOfLights = AdvancedLightBinManager::smMaximumNumOfLights; - mRenderUseLightFade = AdvancedLightBinManager::smUseLightFade; - - AdvancedLightBinManager::smMaximumNumOfLights = -1; - AdvancedLightBinManager::smUseLightFade = false; - - //kickstart rendering - LightManager* lm = LIGHTMGR; - if (lm) - { - SceneManager* sm = lm->getSceneManager(); - if (sm && sm->getContainer() == &gClientContainer) - { - lm->deactivate(); - lm->activate(sm); - } - } + Con::setBoolVariable("$ReflectionProbes::Capturing", RenderProbeMgr::smBakeReflectionProbes); } void RenderProbeMgr::postBake() { RenderProbeMgr::smBakeReflectionProbes = false; - GFXShader::addGlobalMacro("CAPTURING", String("0")); - //Con::setVariable("$Probes::Capturing", "0"); - AdvancedLightBinManager::smMaximumNumOfLights = mRenderMaximumNumOfLights; - AdvancedLightBinManager::smUseLightFade = mRenderUseLightFade; - - //kickstart rendering - LightManager* lm = LIGHTMGR; - if (lm) - { - SceneManager* sm = lm->getSceneManager(); - if (sm && sm->getContainer() == &gClientContainer) - { - lm->deactivate(); - lm->activate(sm); - } - } + Con::setBoolVariable("$ReflectionProbes::Capturing", RenderProbeMgr::smBakeReflectionProbes); } void RenderProbeMgr::bakeProbe(ReflectionProbe* probe) diff --git a/Engine/source/scene/sceneRenderState.h b/Engine/source/scene/sceneRenderState.h index f6596a907..37d4763ab 100644 --- a/Engine/source/scene/sceneRenderState.h +++ b/Engine/source/scene/sceneRenderState.h @@ -223,6 +223,7 @@ class SceneRenderState /// Returns true if this is not one of the other rendering passes. bool isOtherPass() const { return mScenePassType >= SPT_Other; } + bool isCapturing() const { return Con::getBoolVariable("$ReflectionProbes::Capturing", false); }; /// @} /// @name Render Style diff --git a/Engine/source/shaderGen/shaderGenVars.cpp b/Engine/source/shaderGen/shaderGenVars.cpp index b1fa02347..e6a334893 100644 --- a/Engine/source/shaderGen/shaderGenVars.cpp +++ b/Engine/source/shaderGen/shaderGenVars.cpp @@ -74,6 +74,8 @@ const String ShaderGenVars::vectorLightDirection("$vectorLightDirection"); const String ShaderGenVars::vectorLightColor("$vectorLightColor"); const String ShaderGenVars::vectorLightBrightness("$vectorLightBrightness"); +const String ShaderGenVars::isCapturing("$isCapturing"); + const String ShaderGenVars::ormConfig("$ORMConfig"); const String ShaderGenVars::roughness("$roughness"); const String ShaderGenVars::metalness("$metalness"); diff --git a/Engine/source/shaderGen/shaderGenVars.h b/Engine/source/shaderGen/shaderGenVars.h index a4e87338c..4acc97fa8 100644 --- a/Engine/source/shaderGen/shaderGenVars.h +++ b/Engine/source/shaderGen/shaderGenVars.h @@ -86,6 +86,8 @@ struct ShaderGenVars const static String vectorLightColor; const static String vectorLightBrightness; + const static String isCapturing; + const static String ormConfig; const static String roughness; const static String metalness; diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl index 723a62511..b221ac9fc 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl @@ -24,6 +24,7 @@ #include "./brdf.glsl" uniform float maxProbeDrawDistance; +uniform int isCapturing; #ifndef TORQUE_SHADERGEN #line 27 @@ -54,10 +55,6 @@ uniform vec4 albedo; #define MAX_FORWARD_LIGHT 4 -#ifndef CAPTURING -#define CAPTURING 0 -#endif - #ifndef DEBUGVIZ_ATTENUATION #define DEBUGVIZ_ATTENUATION 0 #endif @@ -237,32 +234,28 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq); vec3 Fr = D * F * Vis; -#if CAPTURING == 1 - return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness); -#else - return Fd + Fr; -#endif - + if(isCapturing == 1) + return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness); + else + return Fd + Fr; } vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow) { -#if CAPTURING == 1 float lightfloor = CAPTURE_LIGHT_FLOOR; -#else - float lightfloor = 0.0; -#endif + if(isCapturing != 1) + lightfloor = 0.0; + vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor); return evaluateStandardBRDF(surface,surfaceToLight) * factor; } vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow) { -#if CAPTURING == 1 float lightfloor = CAPTURE_LIGHT_FLOOR; -#else - float lightfloor = 0.0; -#endif + if(isCapturing != 1) + lightfloor = 0.0; + float attenuation = getDistanceAtt(surfaceToLight.Lu, radius); vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation, lightfloor); return evaluateStandardBRDF(surface,surfaceToLight) * factor; @@ -270,11 +263,10 @@ vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 light vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, vec3 lightDir, vec2 lightSpotParams, float shadow) { -#if CAPTURING == 1 float lightfloor = CAPTURE_LIGHT_FLOOR; -#else - float lightfloor = 0.0; -#endif + if(isCapturing != 1) + lightfloor = 0.0; + float attenuation = 1.0f; attenuation *= getDistanceAtt(surfaceToLight.Lu, radius); attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy); @@ -567,11 +559,11 @@ vec4 computeForwardProbes(Surface surface, float horizonOcclusion = 1.3; float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N)); horizon *= horizon; -#if CAPTURING == 1 - return vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0); -#else - return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled -#endif + + if(isCapturing == 1) + return vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0); + else + return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled } vec4 debugVizForwardProbes(Surface surface, diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl index 3ec490af1..c9e1fc512 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl @@ -27,6 +27,7 @@ //globals uniform float3 eyePosWorld; uniform float maxProbeDrawDistance; +uniform int isCapturing; #ifndef TORQUE_SHADERGEN // These are the uniforms used by most lighting shaders. @@ -56,10 +57,6 @@ uniform float4 albedo; #define MAX_FORWARD_LIGHT 4 -#ifndef CAPTURING -#define CAPTURING 0 -#endif - #ifndef DEBUGVIZ_ATTENUATION #define DEBUGVIZ_ATTENUATION 0 #endif @@ -238,32 +235,28 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight) float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq); float3 Fr = D * F * Vis; -#if CAPTURING == 1 - return lerp(Fd + Fr,surface.baseColor.rgb,surface.metalness); -#else - return Fd + Fr; -#endif - + if(isCapturing == 1) + return lerp(Fd + Fr,surface.baseColor.rgb,surface.metalness); + else + return Fd + Fr; } float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow) { -#if CAPTURING == 1 float lightfloor = CAPTURE_LIGHT_FLOOR; -#else - float lightfloor = 0.0; -#endif + if(isCapturing != 1) + lightfloor = 0.0; + float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity, lightfloor) ; return evaluateStandardBRDF(surface,surfaceToLight) * factor; } float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float shadow) { -#if CAPTURING == 1 float lightfloor = CAPTURE_LIGHT_FLOOR; -#else - float lightfloor = 0.0; -#endif + if(isCapturing != 1) + lightfloor = 0.0; + float attenuation = getDistanceAtt(surfaceToLight.Lu, radius); float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor) ; return evaluateStandardBRDF(surface,surfaceToLight) * factor; @@ -271,11 +264,10 @@ float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 l float3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float3 lightDir, float2 lightSpotParams, float shadow) { -#if CAPTURING == 1 float lightfloor = CAPTURE_LIGHT_FLOOR; -#else - float lightfloor = 0.0; -#endif + if(isCapturing != 1) + lightfloor = 0.0; + float attenuation = 1.0f; attenuation *= getDistanceAtt(surfaceToLight.Lu, radius); attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy); @@ -573,11 +565,11 @@ float4 computeForwardProbes(Surface surface, float horizonOcclusion = 1.3; float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N)); horizon *= horizon; -#if CAPTURING == 1 - return float4(lerp((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0); -#else - return float4((irradiance + specular* horizon) , 0);//alpha writes disabled -#endif + + if(isCapturing == 1) + return float4(lerp((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0); + else + return float4((irradiance + specular* horizon) , 0);//alpha writes disabled } float4 debugVizForwardProbes(Surface surface, diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl index 65ef21a22..1f6963c2c 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeArrayP.glsl @@ -222,9 +222,9 @@ void main() float horizonOcclusion = 1.3; float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N)); horizon *= horizon; -#if CAPTURING == 1 - OUT_col = vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb, surface.metalness),0); -#else - OUT_col = vec4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled -#endif + + if(isCapturing == 1) + OUT_col = vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb, surface.metalness),0); + else + OUT_col = vec4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled } diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl index 4ec3df65d..845793a82 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl @@ -208,9 +208,9 @@ float4 main(PFXVertToPix IN) : SV_TARGET float horizonOcclusion = 1.3; float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N)); horizon *= horizon; -#if CAPTURING == 1 - return float4(lerp((irradiance + specular* horizon), surface.baseColor.rgb,surface.metalness),0); -#else - return float4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled -#endif + + if(isCapturing == 1) + return float4(lerp((irradiance + specular* horizon), surface.baseColor.rgb,surface.metalness),0); + else + return float4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled } From 51c1ab6b8372fa3c76a6e1adadfe16f33b519c9f Mon Sep 17 00:00:00 2001 From: Areloch Date: Fri, 19 Apr 2024 00:00:37 -0500 Subject: [PATCH 6/6] Adds a sanity check to SimObject's setFieldValue console method so if you pass in a blank field name it doesn't crash, instead asserting in debug, and logging the error in release --- Engine/source/console/simObject.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 8417a9883..926827c86 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -3072,6 +3072,13 @@ DefineEngineMethod( SimObject, setFieldValue, bool, ( const char* fieldName, con { char fieldNameBuffer[ 1024 ]; char arrayIndexBuffer[ 64 ]; + + if( !fieldName || !fieldName[0] ) + { + AssertFatal(false, "SimObject::setFieldValue - Invalid field name."); + Con::errorf( "SimObject::setFieldValue - Invalid field name." ); + return false; + } // Parse out index if the field is given in the form of 'name[index]'.