/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #pragma once #include #include #include #include #include #include #include #include #include namespace AZ { namespace Render { static const char* const DeferredFogPassTemplateName = "DeferredFogPassTemplate"; // Deferred screen space fog pass class. The fog is calculated post // the main render using the linear depth and turbulence texture with two blended // octaves that emulate the fog thickness and fog animation along the view ray direction. // The fog can be a full screen fog or a thin 3D layer fog representing mountains morning mist. // The pass also exposes the fog settings to be used by an editor component node that will // control the visual properties of the fog. // Enhancements of this fog can contain more advanced noise handling (real volumetric), areal // mask, blending between areal fog nodes and other enhancements required for production. class DeferredFogPass final : public RPI::FullscreenTrianglePass { AZ_RPI_PASS(DeferredFogPass); public: AZ_RTTI(DeferredFogPass, "{0406C8AB-E95D-43A7-AF53-BDEE22D36746}", RPI::FullscreenTrianglePass); AZ_CLASS_ALLOCATOR(DeferredFogPass, SystemAllocator, 0); ~DeferredFogPass() = default; void Init() override; static RPI::Ptr Create(const RPI::PassDescriptor& descriptor); DeferredFogSettings* GetPassFogSettings(); virtual bool IsEnabled() const override; void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override; void CompileResources(const RHI::FrameGraphCompileContext& context) override; protected: DeferredFogPass(const RPI::PassDescriptor& descriptor); //! Set the binding indices of all members of the SRG void SetSrgBindIndices(); //! Bind SRG constants - done via macro reflection void SetSrgConstants(); //! Check if the pass should be enabled or disabled void UpdateEnable(DeferredFogSettings* fogSettings); void UpdateShaderOptions(); private: // When a component is not present we want to fall back to the default settings and // actively pass them to the shader. DeferredFogSettings m_fallbackSettings; // Shader options for variant generation (texture and layer activation in this case) AZ::RPI::ShaderVariantKey m_ShaderOptions; }; } // namespace Render } // namespace AZ