Browse Source

changes made as per PR

Signed-off-by: T.J. McGrath-Daly <[email protected]>
T.J. McGrath-Daly 3 years ago
parent
commit
1d72c5edea

+ 7 - 7
Gems/Atom/Feature/Common/Assets/Passes/ChromaticAberration.pass

@@ -45,19 +45,19 @@
                     }
                 }
             ],
+            "FallbackConnections": [
+                {
+                    "Input": "Input",
+                    "Output": "Output"
+                }
+            ],
             "PassData": {
                 "$type": "ComputePassData",
                 "ShaderAsset": {
                     "FilePath": "Shaders/PostProcessing/ChromaticAberration.shader"
                 },
                 "Make Fullscreen Pass": true
-            },
-            "FallbackConnections": [
-                {
-                    "Input": "Input",
-                    "Output": "Output"
-                }
-            ]
+            }
         }
     }
 }

+ 6 - 6
Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/ChromaticAberration.azsl

@@ -20,7 +20,6 @@ ShaderResourceGroup PassSrg : SRG_PerPass
         float2 m_outputCenter; // center of image in pixel coords
         float m_strength; // strength of effect (0 to 1), i.e. displacement of channels
         float m_blend; // blend factor between original and aberration
-        float m_blendRemainder; // 1-m_blend
     };
     Constants m_constants;
 }
@@ -35,11 +34,12 @@ void MainCS(uint3 dispatchThreadID : SV_DispatchThreadID)
 
     float2 disp = dispatchThreadID.xy - PassSrg::m_constants.m_outputCenter;
     float2 offset = disp * PassSrg::m_constants.m_strength;
+    float remainder = 1 - PassSrg::m_constants.m_blend;
 
-    float go = PassSrg::m_inputColor[dispatchThreadID.xy].g * PassSrg::m_constants.m_blend;
-    float bo = PassSrg::m_inputColor[dispatchThreadID.xy].b * PassSrg::m_constants.m_blend;
-    float ga = PassSrg::m_inputColor[dispatchThreadID.xy - trunc(offset * 0.5)].g * PassSrg::m_constants.m_blendRemainder;
-    float ba = PassSrg::m_inputColor[dispatchThreadID.xy - trunc(offset)].b * PassSrg::m_constants.m_blendRemainder;
+    float go = PassSrg::m_inputColor[dispatchThreadID.xy].g * remainder;
+    float bo = PassSrg::m_inputColor[dispatchThreadID.xy].b * remainder;
+    float ga = PassSrg::m_inputColor[dispatchThreadID.xy - trunc(offset * 0.5)].g * PassSrg::m_constants.m_blend;
+    float ba = PassSrg::m_inputColor[dispatchThreadID.xy - trunc(offset)].b * PassSrg::m_constants.m_blend;
 
     PassSrg::m_outputColor[dispatchThreadID.xy] = float4(PassSrg::m_inputColor[dispatchThreadID.xy].r, go + ga, bo + ba, 1.0);
-}
+}

+ 6 - 3
Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/ChromaticAberration.shader

@@ -1,11 +1,14 @@
 {
     "Source": "ChromaticAberration.azsl",
-    "ProgramSettings": {
-        "EntryPoints": [
+
+    "ProgramSettings": 
+    {
+        "EntryPoints": 
+        [
             {
                 "name": "MainCS",
                 "type": "Compute"
             }
         ]
     }
-}
+}

+ 0 - 2
Gems/Atom/Feature/Common/Code/Include/Atom/Feature/PostProcess/ChromaticAberration/ChromaticAberrationConstants.h

@@ -8,8 +8,6 @@
 
 #pragma once
 
-#include <AzCore/Math/Vector3.h>
-
 namespace AZ
 {
     namespace Render

+ 0 - 1
Gems/Atom/Feature/Common/Code/Include/Atom/Feature/PostProcess/PostProcessSettings.inl

@@ -27,4 +27,3 @@ POST_PROCESS_MEMBER(LookModificationSettings, m_lookModificationSettings)
 POST_PROCESS_MEMBER(DeferredFogSettings, m_deferredFogSettings)
 POST_PROCESS_MEMBER(HDRColorGradingSettings, m_hdrColorGradingSettings)
 POST_PROCESS_MEMBER(ChromaticAberrationSettings, m_chromaticAberrationSettings)
-

+ 3 - 5
Gems/Atom/Feature/Common/Code/Source/PostProcessing/ChromaticAberrationPass.cpp

@@ -41,17 +41,17 @@ namespace AZ
             const RPI::ViewPtr view = GetRenderPipeline()->GetDefaultView();
             if (!fp)
             {
-                return true;
+                return false;
             }
             PostProcessSettings* postProcessSettings = fp->GetLevelSettingsFromView(view);
             if (!postProcessSettings)
             {
-                return true;
+                return false;
             }
             const ChromaticAberrationSettings* chromaticAberrationSettings = postProcessSettings->GetChromaticAberrationSettings();
             if (!chromaticAberrationSettings)
             {
-                return true;
+                return false;
             }
             return chromaticAberrationSettings->GetEnabled();
         }
@@ -65,7 +65,6 @@ namespace AZ
                 AZStd::array<float, 2> m_outputCenter;
                 float m_strength = ChromaticAberration::DefaultStrength;
                 float m_blend = ChromaticAberration::DefaultBlend;
-                float m_blendRemainder = 1 - m_blend;
             } constants{};
 
             RPI::Scene* scene = GetScene();
@@ -81,7 +80,6 @@ namespace AZ
                     {
                         constants.m_strength = chromaticAberrationSettings->GetStrength();
                         constants.m_blend = chromaticAberrationSettings->GetBlend();
-                        constants.m_blendRemainder = 1 - constants.m_blend;
                     }
                 }
             }

+ 2 - 2
Gems/AtomLyIntegration/CommonFeatures/Code/Source/Module.cpp

@@ -121,7 +121,7 @@ namespace AZ
                         SurfaceData::SurfaceDataMeshComponent::CreateDescriptor(),
                         AttachmentComponent::CreateDescriptor(),
                         OcclusionCullingPlaneComponent::CreateDescriptor(),
-						ChromaticAberrationComponent::CreateDescriptor(),
+                        ChromaticAberrationComponent::CreateDescriptor(),
 
 #ifdef ATOMLYINTEGRATION_FEATURE_COMMON_EDITOR
                         EditorAreaLightComponent::CreateDescriptor(),
@@ -156,7 +156,7 @@ namespace AZ
                         SurfaceData::EditorSurfaceDataMeshComponent::CreateDescriptor(),
                         EditorAttachmentComponent::CreateDescriptor(),
                         EditorOcclusionCullingPlaneComponent::CreateDescriptor(),
-						EditorChromaticAberrationComponent::CreateDescriptor(),
+                        EditorChromaticAberrationComponent::CreateDescriptor(),
 #endif
                     });
             }

+ 2 - 2
Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/ChromaticAberration/EditorChromaticAberrationComponent.cpp

@@ -19,7 +19,7 @@ namespace AZ
 
             if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
             {
-                serializeContext->Class<EditorChromaticAberrationComponent, BaseClass>()->Version(1);
+                serializeContext->Class<EditorChromaticAberrationComponent, BaseClass>()->Version(0);
 
                 if (AZ::EditContext* editContext = serializeContext->GetEditContext())
                 {
@@ -56,7 +56,7 @@ namespace AZ
                         ->Attribute(Edit::Attributes::ReadOnly, &ChromaticAberrationComponentConfig::ArePropertiesReadOnly)
 
                         ->DataElement(
-                            AZ::Edit::UIHandlers::Slider, &ChromaticAberrationComponentConfig::m_blend, "Blend", "Blend with original image")
+                            AZ::Edit::UIHandlers::Slider, &ChromaticAberrationComponentConfig::m_blend, "Blend", "Factor for additive blending with original image")
                         ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
                         ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
                         ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)