Merge branch 'development' into Atom/dmcdiar/ATOM-4126
This commit is contained in:
+8
-8
@@ -13,9 +13,9 @@
|
||||
|
||||
if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedTesting IN_LIST LY_PROJECTS)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_Main
|
||||
NAME AutomatedTesting::Atom_TestSuite_Main
|
||||
TEST_SUITE main
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_MainSuite.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py
|
||||
TEST_SERIAL
|
||||
TIMEOUT 600
|
||||
RUNTIME_DEPENDENCIES
|
||||
@@ -26,9 +26,9 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
|
||||
Atom
|
||||
)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_MainOptimized
|
||||
NAME AutomatedTesting::Atom_TestSuite_Main_Optimized
|
||||
TEST_SUITE main
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_MainSuite_Optimized.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main_Optimized.py
|
||||
TEST_SERIAL
|
||||
TIMEOUT 600
|
||||
RUNTIME_DEPENDENCIES
|
||||
@@ -39,9 +39,9 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
|
||||
Atom
|
||||
)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_Sandbox
|
||||
NAME AutomatedTesting::Atom_TestSuite_Sandbox
|
||||
TEST_SUITE sandbox
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_SandboxSuite.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Sandbox.py
|
||||
TEST_SERIAL
|
||||
TIMEOUT 400
|
||||
RUNTIME_DEPENDENCIES
|
||||
@@ -52,12 +52,12 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED AND AutomatedT
|
||||
Atom
|
||||
)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::AtomRenderer_HydraTests_GPUTests
|
||||
NAME AutomatedTesting::Atom_TestSuite_Main_GPU
|
||||
TEST_SUITE main
|
||||
TEST_REQUIRES gpu
|
||||
TEST_SERIAL
|
||||
TIMEOUT 1200
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/test_Atom_GPUTests.py
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main_GPU.py
|
||||
RUNTIME_DEPENDENCIES
|
||||
AssetProcessor
|
||||
AutomatedTesting.Assets
|
||||
+2
-2
@@ -13,10 +13,10 @@ import pytest
|
||||
|
||||
import ly_test_tools.environment.file_system as file_system
|
||||
import editor_python_test_tools.hydra_test_utils as hydra
|
||||
from atom_renderer.atom_utils.atom_constants import LIGHT_TYPES
|
||||
from Atom.atom_utils.atom_constants import LIGHT_TYPES
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "tests")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
+1
-3
@@ -3,8 +3,6 @@ Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
|
||||
Tests that require a GPU in order to run.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
@@ -22,7 +20,7 @@ import editor_python_test_tools.hydra_test_utils as hydra
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
DEFAULT_SUBFOLDER_PATH = 'user/PythonTests/Automated/Screenshots'
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "atom_hydra_scripts")
|
||||
TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "tests")
|
||||
|
||||
|
||||
def golden_images_directory():
|
||||
+10
-10
@@ -15,32 +15,32 @@ from ly_test_tools.o3de.editor_test import EditorSharedTest, EditorTestSuite
|
||||
class TestAutomation(EditorTestSuite):
|
||||
|
||||
class AtomEditorComponents_DecalAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DecalAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DecalAdded as test_module
|
||||
|
||||
class AtomEditorComponents_DepthOfFieldAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DepthOfFieldAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DepthOfFieldAdded as test_module
|
||||
|
||||
class AtomEditorComponents_DirectionalLightAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DirectionalLightAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DirectionalLightAdded as test_module
|
||||
|
||||
class AtomEditorComponents_ExposureControlAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_ExposureControlAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_ExposureControlAdded as test_module
|
||||
|
||||
class AtomEditorComponents_GlobalSkylightIBLAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_GlobalSkylightIBLAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_GlobalSkylightIBLAdded as test_module
|
||||
|
||||
class AtomEditorComponents_PhysicalSkyAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_PhysicalSkyAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_PhysicalSkyAdded as test_module
|
||||
|
||||
class AtomEditorComponents_PostFXRadiusWeightModifierAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import (
|
||||
from Atom.tests import (
|
||||
hydra_AtomEditorComponents_PostFXRadiusWeightModifierAdded as test_module)
|
||||
|
||||
class AtomEditorComponents_LightAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_LightAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_LightAdded as test_module
|
||||
|
||||
class AtomEditorComponents_DisplayMapperAdded(EditorSharedTest):
|
||||
from atom_renderer.atom_hydra_scripts import hydra_AtomEditorComponents_DisplayMapperAdded as test_module
|
||||
from Atom.tests import hydra_AtomEditorComponents_DisplayMapperAdded as test_module
|
||||
|
||||
class ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges(EditorSharedTest):
|
||||
from .atom_hydra_scripts import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module
|
||||
from Atom.tests import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"Source" : "DependencyValidation.azsl",
|
||||
|
||||
"DepthStencilState" : {
|
||||
"DepthStencilState" : {
|
||||
"Depth" : { "Enable" : false, "CompareFunc" : "GreaterEqual" }
|
||||
},
|
||||
|
||||
@@ -22,5 +22,5 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -12,5 +12,5 @@
|
||||
|
||||
float4 GetTest2Color(float4 color)
|
||||
{
|
||||
return color * 0.5;
|
||||
return color * 0.5;
|
||||
}
|
||||
+1
-1
@@ -12,5 +12,5 @@
|
||||
|
||||
float4 GetTest3Color(float4 color)
|
||||
{
|
||||
return color * 0.13;
|
||||
return color * 0.13;
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ import azlmbr.legacy.general as general
|
||||
sys.path.append(os.path.join(azlmbr.paths.devassets, "Gem", "PythonTests"))
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from atom_renderer.atom_utils.atom_constants import LIGHT_TYPES
|
||||
from Atom.atom_utils.atom_constants import LIGHT_TYPES
|
||||
|
||||
LIGHT_TYPE_PROPERTY = 'Controller|Configuration|Light type'
|
||||
SPHERE_AND_SPOT_DISK_LIGHT_PROPERTIES = [
|
||||
+1
-1
@@ -18,7 +18,7 @@ import azlmbr.paths
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devassets, "Gem", "PythonTests"))
|
||||
|
||||
import atom_renderer.atom_utils.material_editor_utils as material_editor
|
||||
import Atom.atom_utils.material_editor_utils as material_editor
|
||||
|
||||
NEW_MATERIAL = "test_material.material"
|
||||
NEW_MATERIAL_1 = "test_material_1.material"
|
||||
+1
-1
@@ -14,7 +14,7 @@ sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "P
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
from atom_renderer.atom_utils.benchmark_utils import BenchmarkHelper
|
||||
from Atom.atom_utils.benchmark_utils import BenchmarkHelper
|
||||
|
||||
SCREEN_WIDTH = 1280
|
||||
SCREEN_HEIGHT = 720
|
||||
+1
-1
@@ -21,7 +21,7 @@ sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "P
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
from atom_renderer.atom_utils.screenshot_utils import ScreenshotHelper
|
||||
from Atom.atom_utils.screenshot_utils import ScreenshotHelper
|
||||
|
||||
SCREEN_WIDTH = 1280
|
||||
SCREEN_HEIGHT = 720
|
||||
+1
-1
@@ -17,7 +17,7 @@ import azlmbr.legacy.general as general
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "PythonTests"))
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from atom_renderer.atom_utils import atom_component_helper, atom_constants, screenshot_utils
|
||||
from Atom.atom_utils import atom_component_helper, atom_constants, screenshot_utils
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
helper = EditorTestHelper(log_prefix="Atom_EditorTestHelper")
|
||||
@@ -18,7 +18,7 @@ include(${pal_dir}/PAL_traits_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
|
||||
add_subdirectory(assetpipeline)
|
||||
|
||||
## Atom Renderer ##
|
||||
add_subdirectory(atom_renderer)
|
||||
add_subdirectory(Atom)
|
||||
|
||||
## Physics ##
|
||||
add_subdirectory(Physics)
|
||||
|
||||
@@ -10,17 +10,12 @@
|
||||
# Only 'xcb' and 'wayland' are recognized
|
||||
if (${PAL_TRAIT_LINUX_WINDOW_MANAGER} STREQUAL "xcb")
|
||||
|
||||
find_library(XCB_LIBRARY xcb)
|
||||
find_library(XCB_XKB_LIBRARY xcb-xkb)
|
||||
find_library(XKBCOMMON_LIBRARY xkbcommon)
|
||||
find_library(XKBCOMMON_X11_LIBRARY xkbcommon-x11)
|
||||
|
||||
set(LY_BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
${XCB_LIBRARY}
|
||||
${XKBCOMMON_LIBRARY}
|
||||
${XKBCOMMON_X11_LIBRARY}
|
||||
${XCB_XKB_LIBRARY}
|
||||
3rdParty::X11::xcb
|
||||
3rdParty::X11::xcb_xkb
|
||||
3rdParty::X11::xkbcommon
|
||||
3rdParty::X11::xkbcommon_X11
|
||||
)
|
||||
|
||||
set(LY_COMPILE_DEFINITIONS PUBLIC PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ namespace AzToolsFramework
|
||||
|
||||
QModelIndex AssetBrowserTableModel::mapToSource(const QModelIndex& proxyIndex) const
|
||||
{
|
||||
Q_ASSERT(!proxyIndex.isValid() || proxyIndex.model() != this);
|
||||
Q_ASSERT(!proxyIndex.isValid() || proxyIndex.model() == this);
|
||||
if (!proxyIndex.isValid() || !m_indexMap.contains(proxyIndex.row()))
|
||||
{
|
||||
return QModelIndex();
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
|
||||
static const float4 s_AzslDebugColor = float4(165.0 / 255.0, 30.0 / 255.0, 36.0 / 255.0, 1);
|
||||
|
||||
// Uniform limitation need to be taken into consideration for mobile devices
|
||||
// Uniform limitation need to be taken into consideration for mobile devices. This would help alleviate device lost errors if the constant buffer
|
||||
// size overshoots the device's memory constraints. An example is a large number of constant buffers associated with mesh instances that would result in device lost,
|
||||
// but otherwise OK on PC. We can separate out the number of instances for the different platforms with this define.
|
||||
// [ATOM-14949]
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_LIMITATIONS 1
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_LIMITATIONS 1
|
||||
|
||||
// Different constant buffer alignment on platforms
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_ALIGNMENT 16
|
||||
|
||||
@@ -12,3 +12,7 @@
|
||||
*/
|
||||
|
||||
static const float4 s_AzslDebugColor = float4(165.0 / 255.0, 30.0 / 255.0, 36.0 / 255.0, 1);
|
||||
|
||||
|
||||
// Different constant buffer alignment on platforms
|
||||
#define AZ_TRAIT_CONSTANT_BUFFER_ALIGNMENT 128
|
||||
@@ -104,6 +104,7 @@ option bool o_layer3_enabled;
|
||||
enum class DebugDrawMode { None, BlendMask, Displacement, FinalBlendWeights };
|
||||
option DebugDrawMode o_debugDrawMode;
|
||||
|
||||
// If you modify this enum, you must update the BlendSourceUsesDisplacement function in StandardMultilayerPBR_Displacement.lua
|
||||
enum class LayerBlendSource { BlendMaskTexture, BlendMaskVertexColors, Displacement, Displacement_With_BlendMaskTexture, Displacement_With_BlendMaskVertexColors, Fallback };
|
||||
option LayerBlendSource o_layerBlendSource;
|
||||
|
||||
|
||||
+3
-2
@@ -88,7 +88,7 @@ end
|
||||
-- @return a table with two values {min,max}. Negative values are below the surface and positive values are above the surface.
|
||||
function CalcOverallHeightRange(context)
|
||||
|
||||
local heightMinMax = {nil, nil}
|
||||
local heightMinMax = {}
|
||||
|
||||
local function GetMergedHeightRange(heightMinMax, offset, factor)
|
||||
top = offset
|
||||
@@ -138,7 +138,8 @@ function CalcOverallHeightRange(context)
|
||||
if(enableLayer3) then GetMergedHeightRange(heightMinMax, offsetLayer3, factorLayer3) end
|
||||
|
||||
else
|
||||
heightMinMax = {0,0}
|
||||
heightMinMax[0] = 0
|
||||
heightMinMax[1] = 0
|
||||
end
|
||||
|
||||
return heightMinMax
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"ClassData": {
|
||||
"PassTemplate": {
|
||||
"Name": "HDRColorGradingTemplate",
|
||||
"PassClass": "FullScreenTriangle",
|
||||
"PassClass": "HDRColorGradingPass",
|
||||
"Slots": [
|
||||
{
|
||||
"Name": "Input",
|
||||
@@ -85,7 +85,7 @@
|
||||
},
|
||||
{
|
||||
"Name": "m_whiteBalanceKelvin",
|
||||
"Value": 6500.0 // 1000.0f ... 40000.0f kelvin
|
||||
"Value": 6600.0 // 1000.0f ... 40000.0f kelvin
|
||||
},
|
||||
{
|
||||
"Name": "m_whiteBalanceTint",
|
||||
@@ -96,7 +96,7 @@
|
||||
"Value": 0.0 // -1 ... 1
|
||||
},
|
||||
{
|
||||
"Name": "m_splitToneMix",
|
||||
"Name": "m_splitToneWeight",
|
||||
"Value": 0.0 // 0 ... 1
|
||||
},
|
||||
{
|
||||
@@ -120,7 +120,7 @@
|
||||
"Value": 1.0 // 0 ... 1
|
||||
},
|
||||
{
|
||||
"Name": "m_smhMix",
|
||||
"Name": "m_smhWeight",
|
||||
"Value": 0.0 // 0 ... 1
|
||||
}
|
||||
],
|
||||
|
||||
@@ -92,8 +92,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "LookModificationTransformPass",
|
||||
"TemplateName": "LookModificationTransformTemplate",
|
||||
"Name": "HDRColorGradingPass",
|
||||
"TemplateName": "HDRColorGradingTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
@@ -102,6 +102,20 @@
|
||||
"Pass": "Parent",
|
||||
"Attachment": "LightingInput"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "LookModificationTransformPass",
|
||||
"TemplateName": "LookModificationTransformTemplate",
|
||||
"Enabled": true,
|
||||
"Connections": [
|
||||
{
|
||||
"LocalSlot": "Input",
|
||||
"AttachmentRef": {
|
||||
"Pass": "HDRColorGradingPass",
|
||||
"Attachment": "Output"
|
||||
}
|
||||
},
|
||||
{
|
||||
"LocalSlot": "EyeAdaptationDataInput",
|
||||
|
||||
@@ -50,13 +50,13 @@ ShaderResourceGroup PassSrg : SRG_PerPass_WithFallback
|
||||
float m_whiteBalanceKelvin;
|
||||
float m_whiteBalanceTint;
|
||||
float m_splitToneBalance;
|
||||
float m_splitToneMix;
|
||||
float m_splitToneWeight;
|
||||
float m_colorGradingPostSaturation;
|
||||
float m_smhShadowsStart;
|
||||
float m_smhShadowsEnd;
|
||||
float m_smhHighlightsStart;
|
||||
float m_smhHighlightsEnd;
|
||||
float m_smhMix;
|
||||
float m_smhWeight;
|
||||
|
||||
float3 m_channelMixingRed;
|
||||
float3 m_channelMixingGreen;
|
||||
@@ -69,9 +69,6 @@ ShaderResourceGroup PassSrg : SRG_PerPass_WithFallback
|
||||
float4 m_smhShadowsColor;
|
||||
float4 m_smhMidtonesColor;
|
||||
float4 m_smhHighlightsColor;
|
||||
|
||||
// my color grading output
|
||||
float4 m_color;
|
||||
}
|
||||
|
||||
float SaturateWithEpsilon(float value)
|
||||
@@ -133,7 +130,7 @@ float3 NoNanPow(float3 base, float3 power)
|
||||
return pow(max(abs(base), float3(FloatEpsilon, FloatEpsilon, FloatEpsilon)), power);
|
||||
}
|
||||
|
||||
float3 ColorGradeSplitTone (float3 frameColor, float balance, float mix)
|
||||
float3 ColorGradeSplitTone (float3 frameColor, float balance, float weight)
|
||||
{
|
||||
float3 frameSplitTone = NoNanPow(frameColor, 1.0 / 2.2);
|
||||
const float t = SaturateWithEpsilon(CalculateLuminance(SaturateWithEpsilon(frameSplitTone), ColorSpaceId::ACEScg) + balance);
|
||||
@@ -142,7 +139,7 @@ float3 ColorGradeSplitTone (float3 frameColor, float balance, float mix)
|
||||
frameSplitTone = BlendMode_SoftLight(frameSplitTone, shadows);
|
||||
frameSplitTone = BlendMode_SoftLight(frameSplitTone, highlights);
|
||||
frameSplitTone = NoNanPow(frameSplitTone, 2.2);
|
||||
return lerp(frameColor.rgb, frameSplitTone.rgb, mix);
|
||||
return lerp(frameColor.rgb, frameSplitTone.rgb, weight);
|
||||
}
|
||||
|
||||
float3 ColorGradeChannelMixer (float3 frameColor)
|
||||
@@ -154,7 +151,7 @@ float3 ColorGradeChannelMixer (float3 frameColor)
|
||||
}
|
||||
|
||||
float3 ColorGradeShadowsMidtonesHighlights (float3 frameColor, float shadowsStart, float shadowsEnd,
|
||||
float highlightsStart, float highlightsEnd, float mix,
|
||||
float highlightsStart, float highlightsEnd, float weight,
|
||||
float4 shadowsColor, float4 midtonesColor, float4 highlightsColor)
|
||||
{
|
||||
const float3 shadowsColorACEScg = TransformColor(shadowsColor.rgb, ColorSpaceId::LinearSRGB, ColorSpaceId::ACEScg);
|
||||
@@ -169,7 +166,7 @@ float3 ColorGradeShadowsMidtonesHighlights (float3 frameColor, float shadowsStar
|
||||
const float3 frameSmh = frameColor * shadowsColorACEScg * shadowsWeight +
|
||||
frameColor * midtonesColorACEScg * midtonesWeight +
|
||||
frameColor * highlightsColorACEScg * highlightsWeight;
|
||||
return lerp(frameColor.rgb, frameSmh.rgb, mix);
|
||||
return lerp(frameColor.rgb, frameSmh.rgb, weight);
|
||||
}
|
||||
|
||||
float3 ColorGrade (float3 frameColor)
|
||||
@@ -181,11 +178,11 @@ float3 ColorGrade (float3 frameColor)
|
||||
PassSrg::m_colorFilterMultiply);
|
||||
frameColor = max(frameColor, 0.0);
|
||||
frameColor = ColorGradeSaturation(frameColor, PassSrg::m_colorGradingPreSaturation);
|
||||
frameColor = ColorGradeSplitTone(frameColor, PassSrg::m_splitToneBalance, PassSrg::m_splitToneMix);
|
||||
frameColor = ColorGradeSplitTone(frameColor, PassSrg::m_splitToneBalance, PassSrg::m_splitToneWeight);
|
||||
frameColor = ColorGradeChannelMixer(frameColor);
|
||||
frameColor = max(frameColor, 0.0);
|
||||
frameColor = ColorGradeShadowsMidtonesHighlights(frameColor, PassSrg::m_smhShadowsStart, PassSrg::m_smhShadowsEnd,
|
||||
PassSrg::m_smhHighlightsStart, PassSrg::m_smhHighlightsEnd, PassSrg::m_smhMix,
|
||||
PassSrg::m_smhHighlightsStart, PassSrg::m_smhHighlightsEnd, PassSrg::m_smhWeight,
|
||||
PassSrg::m_smhShadowsColor, PassSrg::m_smhMidtonesColor, PassSrg::m_smhHighlightsColor);
|
||||
frameColor = ColorGradeHueShift(frameColor, PassSrg::m_colorGradingHueShift);
|
||||
frameColor = ColorGradeSaturation(frameColor, PassSrg::m_colorGradingPostSaturation);
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
// Macros below are of the form:
|
||||
// PARAM(NAME, MEMBER_NAME, DEFAULT_VALUE, ...)
|
||||
|
||||
AZ_GFX_BOOL_PARAM(Enabled, m_enabled, false)
|
||||
AZ_GFX_FLOAT_PARAM(ColorGradingExposure, m_colorGradingExposure, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(ColorGradingContrast, m_colorGradingContrast, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(ColorGradingHueShift, m_colorGradingHueShift, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(ColorGradingPreSaturation, m_colorGradingPreSaturation, 1.0)
|
||||
AZ_GFX_FLOAT_PARAM(ColorGradingFilterIntensity, m_colorGradingFilterIntensity, 1.0)
|
||||
AZ_GFX_FLOAT_PARAM(ColorGradingFilterMultiply, m_colorGradingFilterMultiply, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(ColorGradingPostSaturation, m_colorGradingPostSaturation, 1.0)
|
||||
AZ_GFX_FLOAT_PARAM(WhiteBalanceKelvin, m_whiteBalanceKelvin, 6600.0)
|
||||
AZ_GFX_FLOAT_PARAM(WhiteBalanceTint, m_whiteBalanceTint, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(SplitToneBalance, m_splitToneBalance, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(SplitToneWeight, m_splitToneWeight, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(SmhShadowsStart, m_smhShadowsStart, 0.0)
|
||||
AZ_GFX_FLOAT_PARAM(SmhShadowsEnd, m_smhShadowsEnd, 0.3)
|
||||
AZ_GFX_FLOAT_PARAM(SmhHighlightsStart, m_smhHighlightsStart, 0.55)
|
||||
AZ_GFX_FLOAT_PARAM(SmhHighlightsEnd, m_smhHighlightsEnd, 1.0)
|
||||
AZ_GFX_FLOAT_PARAM(SmhWeight, m_smhWeight, 0.0)
|
||||
AZ_GFX_VEC3_PARAM(ChannelMixingRed, m_channelMixingRed, AZ::Vector3(1.0f, 0.0f, 0.0f))
|
||||
AZ_GFX_VEC3_PARAM(ChannelMixingGreen, m_channelMixingGreen, AZ::Vector3(0.0f, 1.0f, 0.0f))
|
||||
AZ_GFX_VEC3_PARAM(ChannelMixingBlue, m_channelMixingBlue, AZ::Vector3(0.0f, 0.f, 1.0f))
|
||||
AZ_GFX_VEC3_PARAM(ColorFilterSwatch, m_colorFilterSwatch, AZ::Vector3(1.0f, 0.5f, 0.5f))
|
||||
AZ_GFX_VEC3_PARAM(SplitToneShadowsColor, m_splitToneShadowsColor, AZ::Vector3(1.0f, 0.5f, 0.5f))
|
||||
AZ_GFX_VEC3_PARAM(SplitToneHighlightsColor, m_splitToneHighlightsColor, AZ::Vector3(0.1f, 1.0f, 0.1f))
|
||||
AZ_GFX_VEC3_PARAM(SmhShadowsColor, m_smhShadowsColor, AZ::Vector3(1.0f, 0.25f, 0.25f))
|
||||
AZ_GFX_VEC3_PARAM(SmhMidtonesColor, m_smhMidtonesColor, AZ::Vector3(0.1f, 0.1f, 1.0f))
|
||||
AZ_GFX_VEC3_PARAM(SmhHighlightsColor, m_smhHighlightsColor, AZ::Vector3(1.0f, 0.0f, 1.0f))
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Vector4.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class HDRColorGradingSettingsInterface
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AZ::Render::HDRColorGradingSettingsInterface, "{CB5ADF78-27DE-438C-A991-1E5433046A42}");
|
||||
|
||||
// Auto-gen virtual getter and setter functions...
|
||||
#include <Atom/Feature/ParamMacros/StartParamFunctionsVirtual.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
|
||||
virtual void OnConfigChanged() = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -25,3 +25,4 @@ POST_PROCESS_MEMBER(ExposureControlSettings, m_exposureControlSettings)
|
||||
POST_PROCESS_MEMBER(SsaoSettings, m_ssaoSettings)
|
||||
POST_PROCESS_MEMBER(LookModificationSettings, m_lookModificationSettings)
|
||||
POST_PROCESS_MEMBER(DeferredFogSettings, m_deferredFogSettings)
|
||||
POST_PROCESS_MEMBER(HDRColorGradingSettings, m_hdrColorGradingSettings)
|
||||
|
||||
+1
@@ -14,6 +14,7 @@
|
||||
#include <Atom/Feature/PostProcess/ExposureControl/ExposureControlSettingsInterface.h>
|
||||
#include <Atom/Feature/PostProcess/Ssao/SsaoSettingsInterface.h>
|
||||
#include <Atom/Feature/PostProcess/LookModification/LookModificationSettingsInterface.h>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingSettingsInterface.h>
|
||||
#include <Atom/Feature/ScreenSpace/DeferredFogSettingsInterface.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <PostProcess/PostProcessFeatureProcessor.h>
|
||||
#include <PostProcessing/BlendColorGradingLutsPass.h>
|
||||
#include <PostProcessing/BloomParentPass.h>
|
||||
#include <PostProcessing/HDRColorGradingPass.h>
|
||||
#include <PostProcessing/DepthUpsamplePass.h>
|
||||
#include <PostProcessing/DepthOfFieldCompositePass.h>
|
||||
#include <PostProcessing/DepthOfFieldBokehBlurPass.h>
|
||||
@@ -222,6 +223,7 @@ namespace AZ
|
||||
passSystem->AddPassCreator(Name("LightCullingRemapPass"), &LightCullingRemap::Create);
|
||||
passSystem->AddPassCreator(Name("LightCullingTilePreparePass"), &LightCullingTilePreparePass::Create);
|
||||
passSystem->AddPassCreator(Name("BlendColorGradingLutsPass"), &BlendColorGradingLutsPass::Create);
|
||||
passSystem->AddPassCreator(Name("HDRColorGradingPass"), &HDRColorGradingPass::Create);
|
||||
passSystem->AddPassCreator(Name("LookModificationCompositePass"), &LookModificationCompositePass::Create);
|
||||
passSystem->AddPassCreator(Name("LookModificationTransformPass"), &LookModificationPass::Create);
|
||||
passSystem->AddPassCreator(Name("SMAAEdgeDetectionPass"), &SMAAEdgeDetectionPass::Create);
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingSettings.h>
|
||||
#include <PostProcess/PostProcessFeatureProcessor.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
HDRColorGradingSettings::HDRColorGradingSettings(PostProcessFeatureProcessor* featureProcessor)
|
||||
: PostProcessBase(featureProcessor)
|
||||
{
|
||||
}
|
||||
|
||||
void HDRColorGradingSettings::OnConfigChanged()
|
||||
{
|
||||
m_parentSettings->OnConfigChanged();
|
||||
}
|
||||
|
||||
void HDRColorGradingSettings::ApplySettingsTo(HDRColorGradingSettings* target, [[maybe_unused]] float alpha) const
|
||||
{
|
||||
AZ_Assert(target != nullptr, "HDRColorGradingSettings::ApplySettingsTo called with nullptr as argument.");
|
||||
|
||||
if (GetEnabled())
|
||||
{
|
||||
target->m_enabled = m_enabled;
|
||||
|
||||
#define AZ_GFX_BOOL_PARAM(NAME, MEMBER_NAME, DefaultValue) ;
|
||||
#define AZ_GFX_FLOAT_PARAM(NAME, MEMBER_NAME, DefaultValue) \
|
||||
{ \
|
||||
target->Set##NAME(AZ::Lerp(target->MEMBER_NAME, MEMBER_NAME, alpha)); \
|
||||
}
|
||||
|
||||
#define AZ_GFX_VEC3_PARAM(NAME, MEMBER_NAME, DefaultValue) \
|
||||
{ \
|
||||
target->MEMBER_NAME.Set(AZ::Lerp(target->MEMBER_NAME.GetX(), MEMBER_NAME.GetX(), alpha), \
|
||||
AZ::Lerp(target->MEMBER_NAME.GetY(), MEMBER_NAME.GetY(), alpha), \
|
||||
AZ::Lerp(target->MEMBER_NAME.GetZ(), MEMBER_NAME.GetZ(), alpha)); \
|
||||
}
|
||||
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
}
|
||||
}
|
||||
|
||||
void HDRColorGradingSettings::Simulate([[maybe_unused]] float deltaTime)
|
||||
{
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingSettingsInterface.h>
|
||||
|
||||
#include <PostProcess/PostProcessBase.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class PostProcessSettings;
|
||||
|
||||
class HDRColorGradingSettings final
|
||||
: public HDRColorGradingSettingsInterface
|
||||
, public PostProcessBase
|
||||
{
|
||||
friend class PostProcessSettings;
|
||||
friend class PostProcessFeatureProcessor;
|
||||
|
||||
public:
|
||||
AZ_RTTI(HDRColorGradingSettings, "{EA8C05D4-66D0-4141-8D4D-68E5D764C2ED}", HDRColorGradingSettingsInterface, PostProcessBase);
|
||||
AZ_CLASS_ALLOCATOR(HDRColorGradingSettings, SystemAllocator, 0);
|
||||
|
||||
HDRColorGradingSettings(PostProcessFeatureProcessor* featureProcessor);
|
||||
~HDRColorGradingSettings() = default;
|
||||
|
||||
void OnConfigChanged() override;
|
||||
|
||||
void ApplySettingsTo(HDRColorGradingSettings* target, float alpha) const;
|
||||
|
||||
// Generate all getters and override setters.
|
||||
// Declare non-override setters, which will be defined in the .cpp
|
||||
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
|
||||
ValueType Get##Name() const override { return MemberName; } \
|
||||
void Set##Name(ValueType val) override \
|
||||
{ \
|
||||
MemberName = val; \
|
||||
} \
|
||||
|
||||
#define AZ_GFX_COMMON_OVERRIDE(ValueType, Name, MemberName, OverrideValueType) \
|
||||
OverrideValueType Get##Name##Override() const override { return MemberName##Override; } \
|
||||
void Set##Name##Override(OverrideValueType val) override { MemberName##Override = val; } \
|
||||
|
||||
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
|
||||
private:
|
||||
// Generate members...
|
||||
#include <Atom/Feature/ParamMacros/StartParamMembers.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
|
||||
void Simulate(float deltaTime);
|
||||
|
||||
PostProcessSettings* m_parentSettings = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <PostProcess/ExposureControl/ExposureControlSettings.h>
|
||||
#include <PostProcess/Ssao/SsaoSettings.h>
|
||||
#include <PostProcess/LookModification/LookModificationSettings.h>
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingSettings.h>
|
||||
#include <ScreenSpace/DeferredFogSettings.h>
|
||||
|
||||
namespace AZ
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <PostProcessing/HDRColorGradingPass.h>
|
||||
#include <PostProcess/PostProcessFeatureProcessor.h>
|
||||
|
||||
#include <Atom/RPI.Public/RenderPipeline.h>
|
||||
#include <Atom/RPI.Public/Scene.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
RPI::Ptr<HDRColorGradingPass> HDRColorGradingPass::Create(const RPI::PassDescriptor& descriptor)
|
||||
{
|
||||
RPI::Ptr<HDRColorGradingPass> pass = aznew HDRColorGradingPass(descriptor);
|
||||
return AZStd::move(pass);
|
||||
}
|
||||
|
||||
HDRColorGradingPass::HDRColorGradingPass(const RPI::PassDescriptor& descriptor)
|
||||
: AZ::RPI::FullscreenTrianglePass(descriptor)
|
||||
{
|
||||
}
|
||||
|
||||
void HDRColorGradingPass::InitializeInternal()
|
||||
{
|
||||
FullscreenTrianglePass::InitializeInternal();
|
||||
|
||||
m_colorGradingExposureIndex.Reset();
|
||||
m_colorGradingContrastIndex.Reset();
|
||||
m_colorGradingHueShiftIndex.Reset();
|
||||
m_colorGradingPreSaturationIndex.Reset();
|
||||
m_colorFilterIntensityIndex.Reset();
|
||||
m_colorFilterMultiplyIndex.Reset();
|
||||
m_whiteBalanceKelvinIndex.Reset();
|
||||
m_whiteBalanceTintIndex.Reset();
|
||||
m_splitToneBalanceIndex.Reset();
|
||||
m_splitToneWeightIndex.Reset();
|
||||
m_colorGradingPostSaturationIndex.Reset();
|
||||
m_smhShadowsStartIndex.Reset();
|
||||
m_smhShadowsEndIndex.Reset();
|
||||
m_smhHighlightsStartIndex.Reset();
|
||||
m_smhHighlightsEndIndex.Reset();
|
||||
m_smhWeightIndex.Reset();
|
||||
|
||||
m_channelMixingRedIndex.Reset();
|
||||
m_channelMixingGreenIndex.Reset();
|
||||
m_channelMixingBlueIndex.Reset();
|
||||
|
||||
m_colorFilterSwatchIndex.Reset();
|
||||
m_splitToneShadowsColorIndex.Reset();
|
||||
m_splitToneHighlightsColorIndex.Reset();
|
||||
m_smhShadowsColorIndex.Reset();
|
||||
m_smhMidtonesColorIndex.Reset();
|
||||
m_smhHighlightsColorIndex.Reset();
|
||||
}
|
||||
|
||||
void HDRColorGradingPass::FrameBeginInternal(FramePrepareParams params)
|
||||
{
|
||||
SetSrgConstants();
|
||||
|
||||
FullscreenTrianglePass::FrameBeginInternal(params);
|
||||
}
|
||||
|
||||
bool HDRColorGradingPass::IsEnabled() const
|
||||
{
|
||||
const auto* colorGradingSettings = GetHDRColorGradingSettings();
|
||||
return colorGradingSettings ? colorGradingSettings->GetEnabled() : false;
|
||||
}
|
||||
|
||||
void HDRColorGradingPass::SetSrgConstants()
|
||||
{
|
||||
const HDRColorGradingSettings* settings = GetHDRColorGradingSettings();
|
||||
if (settings)
|
||||
{
|
||||
m_shaderResourceGroup->SetConstant(m_colorGradingExposureIndex, settings->GetColorGradingExposure());
|
||||
m_shaderResourceGroup->SetConstant(m_colorGradingContrastIndex, settings->GetColorGradingContrast());
|
||||
m_shaderResourceGroup->SetConstant(m_colorGradingHueShiftIndex, settings->GetColorGradingHueShift());
|
||||
m_shaderResourceGroup->SetConstant(m_colorGradingPreSaturationIndex, settings->GetColorGradingPreSaturation());
|
||||
m_shaderResourceGroup->SetConstant(m_colorFilterIntensityIndex, settings->GetColorGradingFilterIntensity());
|
||||
m_shaderResourceGroup->SetConstant(m_colorFilterMultiplyIndex, settings->GetColorGradingFilterMultiply());
|
||||
m_shaderResourceGroup->SetConstant(m_whiteBalanceKelvinIndex, settings->GetWhiteBalanceKelvin());
|
||||
m_shaderResourceGroup->SetConstant(m_whiteBalanceTintIndex, settings->GetWhiteBalanceTint());
|
||||
m_shaderResourceGroup->SetConstant(m_splitToneBalanceIndex, settings->GetSplitToneBalance());
|
||||
m_shaderResourceGroup->SetConstant(m_splitToneWeightIndex, settings->GetSplitToneWeight());
|
||||
m_shaderResourceGroup->SetConstant(m_colorGradingPostSaturationIndex, settings->GetColorGradingPostSaturation());
|
||||
m_shaderResourceGroup->SetConstant(m_smhShadowsStartIndex, settings->GetSmhShadowsStart());
|
||||
m_shaderResourceGroup->SetConstant(m_smhShadowsEndIndex, settings->GetSmhShadowsEnd());
|
||||
m_shaderResourceGroup->SetConstant(m_smhHighlightsStartIndex, settings->GetSmhHighlightsStart());
|
||||
m_shaderResourceGroup->SetConstant(m_smhHighlightsEndIndex, settings->GetSmhHighlightsEnd());
|
||||
m_shaderResourceGroup->SetConstant(m_smhWeightIndex, settings->GetSmhWeight());
|
||||
|
||||
m_shaderResourceGroup->SetConstant(m_channelMixingRedIndex, settings->GetChannelMixingRed());
|
||||
m_shaderResourceGroup->SetConstant(m_channelMixingGreenIndex, settings->GetChannelMixingGreen());
|
||||
m_shaderResourceGroup->SetConstant(m_channelMixingBlueIndex, settings->GetChannelMixingBlue());
|
||||
|
||||
m_shaderResourceGroup->SetConstant(m_colorFilterSwatchIndex, AZ::Vector4(settings->GetColorFilterSwatch()));
|
||||
m_shaderResourceGroup->SetConstant(m_splitToneShadowsColorIndex, AZ::Vector4(settings->GetSplitToneShadowsColor()));
|
||||
m_shaderResourceGroup->SetConstant(m_splitToneHighlightsColorIndex, AZ::Vector4(settings->GetSplitToneHighlightsColor()));
|
||||
m_shaderResourceGroup->SetConstant(m_smhShadowsColorIndex, AZ::Vector4(settings->GetSmhShadowsColor()));
|
||||
m_shaderResourceGroup->SetConstant(m_smhMidtonesColorIndex, AZ::Vector4(settings->GetSmhMidtonesColor()));
|
||||
m_shaderResourceGroup->SetConstant(m_smhHighlightsColorIndex, AZ::Vector4(settings->GetSmhHighlightsColor()));
|
||||
}
|
||||
}
|
||||
|
||||
const AZ::Render::HDRColorGradingSettings* HDRColorGradingPass::GetHDRColorGradingSettings() const
|
||||
{
|
||||
RPI::Scene* scene = GetScene();
|
||||
if (scene)
|
||||
{
|
||||
PostProcessFeatureProcessor* fp = scene->GetFeatureProcessor<PostProcessFeatureProcessor>();
|
||||
AZ::RPI::ViewPtr view = scene->GetDefaultRenderPipeline()->GetDefaultView();
|
||||
if (fp)
|
||||
{
|
||||
PostProcessSettings* postProcessSettings = fp->GetLevelSettingsFromView(view);
|
||||
if (postProcessSettings)
|
||||
{
|
||||
const HDRColorGradingSettings* colorGradingSettings = postProcessSettings->GetHDRColorGradingSettings();
|
||||
if (colorGradingSettings != nullptr && colorGradingSettings->GetEnabled())
|
||||
{
|
||||
return postProcessSettings->GetHDRColorGradingSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Atom/RPI.Reflect/Shader/ShaderVariantKey.h>
|
||||
#include <Atom/RPI.Public/Pass/FullscreenTrianglePass.h>
|
||||
#include <Atom/RPI.Public/Shader/Shader.h>
|
||||
#include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingSettings.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
/**
|
||||
* The color grading pass.
|
||||
*/
|
||||
class HDRColorGradingPass
|
||||
: public AZ::RPI::FullscreenTrianglePass
|
||||
//TODO: , public PostProcessingShaderOptionBase
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(HDRColorGradingPass, "{E68E31A1-DB24-4AFF-A029-456A8B74C03C}", AZ::RPI::FullscreenTrianglePass);
|
||||
AZ_CLASS_ALLOCATOR(HDRColorGradingPass, SystemAllocator, 0);
|
||||
|
||||
virtual ~HDRColorGradingPass() = default;
|
||||
|
||||
//! Creates a ColorGradingPass
|
||||
static RPI::Ptr<HDRColorGradingPass> Create(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
protected:
|
||||
HDRColorGradingPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
//! Pass behavior overrides
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
bool IsEnabled() const override;
|
||||
|
||||
private:
|
||||
const HDRColorGradingSettings* GetHDRColorGradingSettings() const;
|
||||
void SetSrgConstants();
|
||||
|
||||
RHI::ShaderInputNameIndex m_colorGradingExposureIndex = "m_colorGradingExposure";
|
||||
RHI::ShaderInputNameIndex m_colorGradingContrastIndex = "m_colorGradingContrast";
|
||||
RHI::ShaderInputNameIndex m_colorGradingHueShiftIndex = "m_colorGradingHueShift";
|
||||
RHI::ShaderInputNameIndex m_colorGradingPreSaturationIndex = "m_colorGradingPreSaturation";
|
||||
RHI::ShaderInputNameIndex m_colorFilterIntensityIndex = "m_colorFilterIntensity";
|
||||
RHI::ShaderInputNameIndex m_colorFilterMultiplyIndex = "m_colorFilterMultiply";
|
||||
RHI::ShaderInputNameIndex m_whiteBalanceKelvinIndex = "m_whiteBalanceKelvin";
|
||||
RHI::ShaderInputNameIndex m_whiteBalanceTintIndex = "m_whiteBalanceTint";
|
||||
RHI::ShaderInputNameIndex m_splitToneBalanceIndex = "m_splitToneBalance";
|
||||
RHI::ShaderInputNameIndex m_splitToneWeightIndex = "m_splitToneWeight";
|
||||
RHI::ShaderInputNameIndex m_colorGradingPostSaturationIndex = "m_colorGradingPostSaturation";
|
||||
RHI::ShaderInputNameIndex m_smhShadowsStartIndex = "m_smhShadowsStart";
|
||||
RHI::ShaderInputNameIndex m_smhShadowsEndIndex = "m_smhShadowsEnd";
|
||||
RHI::ShaderInputNameIndex m_smhHighlightsStartIndex = "m_smhHighlightsStart";
|
||||
RHI::ShaderInputNameIndex m_smhHighlightsEndIndex = "m_smhHighlightsEnd";
|
||||
RHI::ShaderInputNameIndex m_smhWeightIndex = "m_smhWeight";
|
||||
|
||||
RHI::ShaderInputNameIndex m_channelMixingRedIndex = "m_channelMixingRed";
|
||||
RHI::ShaderInputNameIndex m_channelMixingGreenIndex = "m_channelMixingGreen";
|
||||
RHI::ShaderInputNameIndex m_channelMixingBlueIndex = "m_channelMixingBlue";
|
||||
|
||||
RHI::ShaderInputNameIndex m_colorFilterSwatchIndex = "m_colorFilterSwatch";
|
||||
RHI::ShaderInputNameIndex m_splitToneShadowsColorIndex = "m_splitToneShadowsColor";
|
||||
RHI::ShaderInputNameIndex m_splitToneHighlightsColorIndex = "m_splitToneHighlightsColor";
|
||||
RHI::ShaderInputNameIndex m_smhShadowsColorIndex = "m_smhShadowsColor";
|
||||
RHI::ShaderInputNameIndex m_smhMidtonesColorIndex = "m_smhMidtonesColor";
|
||||
RHI::ShaderInputNameIndex m_smhHighlightsColorIndex = "m_smhHighlightsColor";
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
@@ -183,6 +183,8 @@ set(FILES
|
||||
Source/PostProcess/PostProcessFeatureProcessor.h
|
||||
Source/PostProcess/PostProcessSettings.cpp
|
||||
Source/PostProcess/PostProcessSettings.h
|
||||
Source/PostProcess/ColorGrading/HDRColorGradingSettings.h
|
||||
Source/PostProcess/ColorGrading/HDRColorGradingSettings.cpp
|
||||
Source/PostProcess/Bloom/BloomSettings.cpp
|
||||
Source/PostProcess/Bloom/BloomSettings.h
|
||||
Source/PostProcess/DepthOfField/DepthOfFieldSettings.cpp
|
||||
@@ -205,6 +207,8 @@ set(FILES
|
||||
Source/PostProcessing/BloomCompositePass.cpp
|
||||
Source/PostProcessing/BloomParentPass.h
|
||||
Source/PostProcessing/BloomParentPass.cpp
|
||||
Source/PostProcessing/HDRColorGradingPass.cpp
|
||||
Source/PostProcessing/HDRColorGradingPass.h
|
||||
Source/PostProcessing/DepthOfFieldCompositePass.h
|
||||
Source/PostProcessing/DepthOfFieldCompositePass.cpp
|
||||
Source/PostProcessing/DepthOfFieldBokehBlurPass.h
|
||||
|
||||
@@ -51,6 +51,8 @@ set(FILES
|
||||
Include/Atom/Feature/PostProcess/Bloom/BloomConstants.h
|
||||
Include/Atom/Feature/PostProcess/Bloom/BloomParams.inl
|
||||
Include/Atom/Feature/PostProcess/Bloom/BloomSettingsInterface.h
|
||||
Include/Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl
|
||||
Include/Atom/Feature/PostProcess/ColorGrading/HDRColorGradingSettingsInterface.h
|
||||
Include/Atom/Feature/PostProcess/DepthOfField/DepthOfFieldConstants.h
|
||||
Include/Atom/Feature/PostProcess/DepthOfField/DepthOfFieldParams.inl
|
||||
Include/Atom/Feature/PostProcess/DepthOfField/DepthOfFieldSettingsInterface.h
|
||||
|
||||
@@ -81,15 +81,6 @@ namespace AZ
|
||||
|
||||
AZ_RTTI(SwapChain, "{888B64A5-D956-406F-9C33-CF6A54FC41B0}", Object);
|
||||
|
||||
#if defined(PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
|
||||
// On Linux platforms that uses XCB, a resize may occur in the swap chain but the command queue may still
|
||||
// reference the original surface. This flag is a temporary fix to make sure the swap chain is ready to present
|
||||
// We need to remove this work around with
|
||||
|
||||
// [GFX TODO][GHI - 2678]
|
||||
AZStd::atomic_bool m_readyToPresent { false };
|
||||
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
|
||||
|
||||
protected:
|
||||
SwapChain();
|
||||
|
||||
|
||||
@@ -164,12 +164,6 @@ namespace AZ
|
||||
m_currentImageIndex = 0;
|
||||
}
|
||||
|
||||
#if defined(PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
|
||||
// If we are presenting through the editor, the resize is triggered through the editor's window, which
|
||||
// won't happen until after the surface is ready to present
|
||||
m_readyToPresent.store(true);
|
||||
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
|
||||
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,15 +42,6 @@ namespace AZ
|
||||
|
||||
void CommandQueue::ExecuteWork(const RHI::ExecuteWorkRequest& rhiRequest)
|
||||
{
|
||||
#if defined(PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
|
||||
for (RHI::SwapChain* swapChain : rhiRequest.m_swapChainsToPresent)
|
||||
{
|
||||
if (!swapChain->m_readyToPresent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
|
||||
const ExecuteWorkRequest& request = static_cast<const ExecuteWorkRequest&>(rhiRequest);
|
||||
QueueCommand([=](void* queue)
|
||||
{
|
||||
|
||||
@@ -128,17 +128,6 @@ namespace AZ
|
||||
nativeDimensions->m_imageFormat = ConvertFormat(m_surfaceFormat.format);
|
||||
}
|
||||
|
||||
#if defined(PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB)
|
||||
// When launching in game mode, the surface will be ready at this point, meaning that after
|
||||
// intialization, this swap chain is ready to present
|
||||
AZ::ApplicationTypeQuery appType;
|
||||
ComponentApplicationBus::Broadcast(&AZ::ComponentApplicationBus::Events::QueryApplicationType, appType);
|
||||
if (appType.IsGame())
|
||||
{
|
||||
m_readyToPresent.store(true);
|
||||
}
|
||||
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
|
||||
|
||||
SetName(GetName());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -730,12 +730,22 @@ namespace AZ
|
||||
|
||||
m_debugCtx.ResetCullStats();
|
||||
m_debugCtx.m_numCullablesInScene = GetNumCullables();
|
||||
AZ::JobCompletion beginCullingCompletion;
|
||||
|
||||
for (auto& view : views)
|
||||
{
|
||||
view->BeginCulling();
|
||||
const auto cullingLambda = [&view]()
|
||||
{
|
||||
view->BeginCulling();
|
||||
};
|
||||
|
||||
AZ::Job* cullingJob = AZ::CreateJobFunction(AZStd::move(cullingLambda), true, nullptr);
|
||||
cullingJob->SetDependent(&beginCullingCompletion);
|
||||
cullingJob->Start();
|
||||
}
|
||||
|
||||
beginCullingCompletion.StartAndWaitForCompletion();
|
||||
|
||||
AuxGeomDrawPtr auxGeom;
|
||||
if (m_debugCtx.m_debugDraw)
|
||||
{
|
||||
|
||||
-2
@@ -159,8 +159,6 @@ namespace AtomToolsFramework
|
||||
AZ::RPI::ViewPtr m_defaultCamera;
|
||||
// Our viewport-local aux geom pipeline for supplemental rendering.
|
||||
AZ::RPI::AuxGeomDrawPtr m_auxGeom;
|
||||
// Used to keep track of a pending resize event to avoid initialization before window activate.
|
||||
bool m_windowResizedEvent = false;
|
||||
// Tracks whether the cursor is currently over our viewport, used for mouse input event book-keeping.
|
||||
bool m_mouseOver = false;
|
||||
// The last recorded mouse position, in local viewport screen coordinates.
|
||||
|
||||
@@ -254,28 +254,11 @@ namespace AtomToolsFramework
|
||||
|
||||
void RenderViewportWidget::resizeEvent([[maybe_unused]] QResizeEvent* event)
|
||||
{
|
||||
// We need to wait until the window is activated, so the underlying surface
|
||||
// has been created and has the correct size.
|
||||
if (windowHandle()->isActive())
|
||||
{
|
||||
SendWindowResizeEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_windowResizedEvent = true;
|
||||
}
|
||||
SendWindowResizeEvent();
|
||||
}
|
||||
|
||||
bool RenderViewportWidget::event(QEvent* event)
|
||||
{
|
||||
// Check if we have a pending resize event.
|
||||
// At this point the surface has been created and has
|
||||
// the proper dimensions.
|
||||
if (event->type() == QEvent::WindowActivate && m_windowResizedEvent)
|
||||
{
|
||||
SendWindowResizeEvent();
|
||||
}
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
@@ -372,7 +355,6 @@ namespace AtomToolsFramework
|
||||
|
||||
AzFramework::WindowNotificationBus::Event(
|
||||
GetNativeWindowHandle(), &AzFramework::WindowNotifications::OnWindowResized, windowSize.width(), windowSize.height());
|
||||
m_windowResizedEvent = false;
|
||||
}
|
||||
|
||||
void RenderViewportWidget::NotifyUpdateRefreshRate()
|
||||
|
||||
+10
@@ -33,6 +33,16 @@ namespace AZ
|
||||
virtual const MaterialAssignmentMap& GetMaterialOverrides() const = 0;
|
||||
//! Clear all material overrides
|
||||
virtual void ClearAllMaterialOverrides() = 0;
|
||||
//! Clear non-lod material overrides
|
||||
virtual void ClearModelMaterialOverrides() = 0;
|
||||
//! Clear lod material overrides
|
||||
virtual void ClearLodMaterialOverrides() = 0;
|
||||
//! Clear residual materials that don't correspond to the associated model
|
||||
virtual void ClearIncompatibleMaterialOverrides() = 0;
|
||||
//! Clear materials that reference missing assets
|
||||
virtual void ClearInvalidMaterialOverrides() = 0;
|
||||
//! Repair materials that reference missing assets by assigning the default asset
|
||||
virtual void RepairInvalidMaterialOverrides() = 0;
|
||||
//! Set default material override
|
||||
virtual void SetDefaultMaterialOverride(const AZ::Data::AssetId& materialAssetId) = 0;
|
||||
//! Get default material override
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class HDRColorGradingRequests
|
||||
: public ComponentBus
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AZ::Render::HDRColorGradingRequests, "{E414A96B-0AA7-4574-ABC0-968B1F5CEE56}");
|
||||
|
||||
/// Overrides the default AZ::EBusTraits handler policy to allow one listener only.
|
||||
static const EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Single;
|
||||
virtual ~HDRColorGradingRequests() {}
|
||||
// Auto-gen virtual getters/setters...
|
||||
#include <Atom/Feature/ParamMacros/StartParamFunctionsVirtual.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
};
|
||||
|
||||
typedef AZ::EBus<HDRColorGradingRequests> HDRColorGradingRequestBus;
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingSettingsInterface.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class HDRColorGradingComponentConfig final
|
||||
: public ComponentConfig
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(AZ::Render::HDRColorGradingComponentConfig, "{8613EA4A-6E1C-49AD-87F3-9FECCB7EA36D}", AZ::ComponentConfig);
|
||||
|
||||
static void Reflect(ReflectContext* context);
|
||||
|
||||
// Generate members...
|
||||
#include <Atom/Feature/ParamMacros/StartParamMembers.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
|
||||
// Generate Getters/Setters...
|
||||
#include <Atom/Feature/ParamMacros/StartParamFunctions.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
|
||||
void CopySettingsTo(HDRColorGradingSettingsInterface* settings);
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+91
-115
@@ -32,9 +32,6 @@ namespace AZ
|
||||
const char* EditorMaterialComponent::GenerateMaterialsButtonText = "Generate/Manage Source Materials...";
|
||||
const char* EditorMaterialComponent::GenerateMaterialsToolTipText = "Generate editable source material files from materials provided by the model.";
|
||||
|
||||
const char* EditorMaterialComponent::ResetMaterialsButtonText = "Reset Materials";
|
||||
const char* EditorMaterialComponent::ResetMaterialsToolTipText = "Clear all settings, materials, and properties then rebuild material slots from the associated model.";
|
||||
|
||||
// Update serialized data to the new format and data types
|
||||
bool EditorMaterialComponent::ConvertVersion(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
|
||||
{
|
||||
@@ -178,43 +175,74 @@ namespace AZ
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
action = menu->addAction(ResetMaterialsButtonText, [this]() { ResetMaterialSlots(); });
|
||||
action->setToolTip(ResetMaterialsToolTipText);
|
||||
action = menu->addAction("Clear All Materials", [this]() {
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing all materials.");
|
||||
SetDirty();
|
||||
|
||||
menu->addSeparator();
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearAllMaterialOverrides);
|
||||
|
||||
m_materialSlotsByLodEnabled = false;
|
||||
|
||||
UpdateMaterialSlots();
|
||||
});
|
||||
action->setToolTip("Clear all materials and properties then rebuild material slots from the associated model.");
|
||||
|
||||
action = menu->addAction("Clear Model Materials", [this]() {
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing model materials.");
|
||||
SetDirty();
|
||||
|
||||
for (auto& materialSlotPair : GetMaterialSlots())
|
||||
{
|
||||
EditorMaterialComponentSlot* materialSlot = materialSlotPair.second;
|
||||
if (materialSlot->m_id.IsSlotIdOnly())
|
||||
{
|
||||
materialSlot->Clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearModelMaterialOverrides);
|
||||
|
||||
UpdateMaterialSlots();
|
||||
});
|
||||
action->setToolTip("Clear model materials and properties then rebuild material slots from the associated model.");
|
||||
|
||||
action = menu->addAction("Clear LOD Materials", [this]() {
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing LOD materials.");
|
||||
SetDirty();
|
||||
|
||||
for (auto& materialSlotPair : GetMaterialSlots())
|
||||
{
|
||||
EditorMaterialComponentSlot* materialSlot = materialSlotPair.second;
|
||||
if (materialSlot->m_id.IsLodAndSlotId())
|
||||
{
|
||||
materialSlot->Clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
action->setEnabled(m_materialSlotsByLodEnabled);
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearLodMaterialOverrides);
|
||||
|
||||
m_materialSlotsByLodEnabled = false;
|
||||
|
||||
UpdateMaterialSlots();
|
||||
});
|
||||
action->setToolTip("Clear LOD materials and properties then rebuild material slots from the associated model.");
|
||||
|
||||
action = menu->addAction("Clear Incompatible Materials", [this]() {
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing incompatible materials.");
|
||||
SetDirty();
|
||||
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearIncompatibleMaterialOverrides);
|
||||
|
||||
UpdateMaterialSlots();
|
||||
});
|
||||
action->setToolTip("Clear residual materials that don't correspond to the associated model.");
|
||||
|
||||
action = menu->addAction("Clear Invalid Materials", [this]() {
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing invalid materials.");
|
||||
SetDirty();
|
||||
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearInvalidMaterialOverrides);
|
||||
|
||||
UpdateMaterialSlots();
|
||||
});
|
||||
action->setToolTip("Clear materials that reference missing assets.");
|
||||
|
||||
action = menu->addAction("Repair Invalid Materials", [this]() {
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Repairing invalid materials.");
|
||||
SetDirty();
|
||||
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::RepairInvalidMaterialOverrides);
|
||||
|
||||
UpdateMaterialSlots();
|
||||
});
|
||||
action->setToolTip("Repair materials that reference missing assets by assigning the default asset.");
|
||||
}
|
||||
|
||||
void EditorMaterialComponent::SetPrimaryAsset(const AZ::Data::AssetId& assetId)
|
||||
{
|
||||
m_controller.SetDefaultMaterialOverride(assetId);
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::SetDefaultMaterialOverride, assetId);
|
||||
|
||||
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
|
||||
|
||||
@@ -249,14 +277,18 @@ namespace AZ
|
||||
m_materialSlots = {};
|
||||
m_materialSlotsByLod = {};
|
||||
|
||||
const MaterialComponentConfig& config = m_controller.GetConfiguration();
|
||||
// Get current material assignments
|
||||
MaterialAssignmentMap currentMaterials;
|
||||
MaterialComponentRequestBus::EventResult(
|
||||
currentMaterials, GetEntityId(), &MaterialComponentRequestBus::Events::GetMaterialOverrides);
|
||||
|
||||
// Get the known material assignment slots from the associated model or other source
|
||||
MaterialAssignmentMap materialsFromSource;
|
||||
MaterialReceiverRequestBus::EventResult(materialsFromSource, GetEntityId(), &MaterialReceiverRequestBus::Events::GetMaterialAssignments);
|
||||
MaterialAssignmentMap originalMaterials;
|
||||
MaterialComponentRequestBus::EventResult(
|
||||
originalMaterials, GetEntityId(), &MaterialComponentRequestBus::Events::GetOriginalMaterialAssignments);
|
||||
|
||||
// Generate the table of editable materials using the source data to define number of groups, elements, and initial values
|
||||
for (const auto& materialPair : materialsFromSource)
|
||||
for (const auto& materialPair : originalMaterials)
|
||||
{
|
||||
// Setup the material slot entry
|
||||
EditorMaterialComponentSlot slot;
|
||||
@@ -264,7 +296,7 @@ namespace AZ
|
||||
slot.m_id = materialPair.first;
|
||||
|
||||
// if material is present in controller configuration, assign its data
|
||||
const MaterialAssignment& materialFromController = GetMaterialAssignmentFromMap(config.m_materials, slot.m_id);
|
||||
const MaterialAssignment& materialFromController = GetMaterialAssignmentFromMap(currentMaterials, slot.m_id);
|
||||
slot.m_materialAsset = materialFromController.m_materialAsset;
|
||||
|
||||
if (slot.m_id.IsDefault())
|
||||
@@ -289,7 +321,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
// Sort all of the slots by label to ensure stable index values (materialsFromSource is an unordered map)
|
||||
// Sort all of the slots by label to ensure stable index values (originalMaterials is an unordered map)
|
||||
AZStd::sort(m_materialSlots.begin(), m_materialSlots.end(),
|
||||
[](const auto& a, const auto& b) { return a.GetLabel() < b.GetLabel(); });
|
||||
|
||||
@@ -305,49 +337,36 @@ namespace AZ
|
||||
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
|
||||
}
|
||||
|
||||
AZ::u32 EditorMaterialComponent::ResetMaterialSlots()
|
||||
{
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Resetting materials.");
|
||||
SetDirty();
|
||||
|
||||
m_controller.SetMaterialOverrides(MaterialAssignmentMap());
|
||||
UpdateMaterialSlots();
|
||||
|
||||
m_materialSlotsByLodEnabled = false;
|
||||
|
||||
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
|
||||
|
||||
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(
|
||||
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
|
||||
|
||||
return AZ::Edit::PropertyRefreshLevels::EntireTree;
|
||||
}
|
||||
|
||||
AZ::u32 EditorMaterialComponent::OpenMaterialExporter()
|
||||
{
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Generating materials.");
|
||||
SetDirty();
|
||||
|
||||
// First generating a unique set of all material asset IDs that will be used for source data generation
|
||||
AZStd::unordered_map<AZ::Data::AssetId, AZStd::string /*slot name*/> assetIdMap;
|
||||
MaterialAssignmentMap originalMaterials;
|
||||
MaterialComponentRequestBus::EventResult(
|
||||
originalMaterials, GetEntityId(), &MaterialComponentRequestBus::Events::GetOriginalMaterialAssignments);
|
||||
|
||||
auto materialSlots = GetMaterialSlots();
|
||||
for (auto& materialSlotPair : materialSlots)
|
||||
// Generate a unique set of all material asset IDs that will be used for source data generation
|
||||
AZStd::unordered_map<AZ::Data::AssetId, AZStd::string> assetIdToSlotNameMap;
|
||||
for (const auto& materialPair : originalMaterials)
|
||||
{
|
||||
Data::AssetId defaultMaterialAssetId = materialSlotPair.second->GetDefaultAssetId();
|
||||
if (defaultMaterialAssetId.IsValid())
|
||||
const Data::AssetId originalAssetId = materialPair.second.m_materialAsset.GetId();
|
||||
if (originalAssetId.IsValid())
|
||||
{
|
||||
assetIdMap[defaultMaterialAssetId] = materialSlotPair.second->GetLabel();
|
||||
MaterialComponentRequestBus::EventResult(
|
||||
assetIdToSlotNameMap[originalAssetId], GetEntityId(), &MaterialComponentRequestBus::Events::GetMaterialSlotLabel,
|
||||
materialPair.first);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the unique set of asset IDs into export items that can be configured in the dialog
|
||||
// The order should not matter because the table in the dialog can sort itself for a specific row
|
||||
EditorMaterialComponentExporter::ExportItemsContainer exportItems;
|
||||
for (auto assetIdInfo : assetIdMap)
|
||||
exportItems.reserve(assetIdToSlotNameMap.size());
|
||||
|
||||
for (const auto& [assetId, slotName] : assetIdToSlotNameMap)
|
||||
{
|
||||
EditorMaterialComponentExporter::ExportItem exportItem{ assetIdInfo.first, assetIdInfo.second };
|
||||
exportItems.push_back(exportItem);
|
||||
exportItems.emplace_back(assetId, slotName);
|
||||
}
|
||||
|
||||
// Display the export dialog so that the user can configure how they want different materials to be exported
|
||||
@@ -363,16 +382,17 @@ namespace AZ
|
||||
const auto& assetIdOutcome = AZ::RPI::AssetUtils::MakeAssetId(exportItem.GetExportPath(), 0);
|
||||
if (assetIdOutcome)
|
||||
{
|
||||
for (auto& materialSlotPair : materialSlots)
|
||||
for (const auto& materialPair : originalMaterials)
|
||||
{
|
||||
EditorMaterialComponentSlot* editorMaterialSlot = materialSlotPair.second;
|
||||
|
||||
if (editorMaterialSlot)
|
||||
// We need to check whether replaced material corresponds to this slot's default material.
|
||||
const Data::AssetId originalAssetId = materialPair.second.m_materialAsset.GetId();
|
||||
if (originalAssetId == exportItem.GetOriginalAssetId())
|
||||
{
|
||||
// We need to check whether replaced material corresponds to this slot's default material.
|
||||
if (editorMaterialSlot->GetDefaultAssetId() == exportItem.GetOriginalAssetId())
|
||||
if (m_materialSlotsByLodEnabled || !materialPair.first.IsLodAndSlotId())
|
||||
{
|
||||
editorMaterialSlot->SetAsset(assetIdOutcome.GetValue());
|
||||
MaterialComponentRequestBus::Event(
|
||||
GetEntityId(), &MaterialComponentRequestBus::Events::SetMaterialOverride, materialPair.first,
|
||||
assetIdOutcome.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,12 +400,9 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
|
||||
UpdateMaterialSlots();
|
||||
|
||||
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(
|
||||
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_AttributesAndValues);
|
||||
|
||||
return AZ::Edit::PropertyRefreshLevels::AttributesAndValues;
|
||||
return AZ::Edit::PropertyRefreshLevels::EntireTree;
|
||||
}
|
||||
|
||||
AZ::u32 EditorMaterialComponent::OnLodsToggled()
|
||||
@@ -395,15 +412,10 @@ namespace AZ
|
||||
|
||||
if (!m_materialSlotsByLodEnabled)
|
||||
{
|
||||
MaterialComponentConfig config = m_controller.GetConfiguration();
|
||||
AZStd::erase_if(config.m_materials, [](const auto& item) {
|
||||
const auto& [key, value] = item;
|
||||
return key.m_lodIndex != MaterialAssignmentId::NonLodIndex;
|
||||
});
|
||||
m_controller.SetMaterialOverrides(config.m_materials);
|
||||
MaterialComponentRequestBus::Event(GetEntityId(), &MaterialComponentRequestBus::Events::ClearLodMaterialOverrides);
|
||||
}
|
||||
|
||||
MaterialComponentNotificationBus::Event(GetEntityId(), &MaterialComponentNotifications::OnMaterialsEdited);
|
||||
UpdateMaterialSlots();
|
||||
|
||||
return AZ::Edit::PropertyRefreshLevels::EntireTree;
|
||||
}
|
||||
@@ -440,41 +452,5 @@ namespace AZ
|
||||
{
|
||||
return AZStd::string::format("LOD %d", lodIndex);
|
||||
}
|
||||
|
||||
template<typename ComponentType, typename ContainerType>
|
||||
void EditorMaterialComponent::BuildMaterialSlotMap(ComponentType& component, ContainerType& materialSlots)
|
||||
{
|
||||
materialSlots[DefaultMaterialAssignmentId] = &component.m_defaultMaterialSlot;
|
||||
|
||||
for (auto& slot : component.m_materialSlots)
|
||||
{
|
||||
materialSlots[slot.m_id] = &slot;
|
||||
}
|
||||
|
||||
if (component.m_materialSlotsByLodEnabled)
|
||||
{
|
||||
for (auto& slotsForLod : component.m_materialSlotsByLod)
|
||||
{
|
||||
for (auto& slot : slotsForLod)
|
||||
{
|
||||
materialSlots[slot.m_id] = &slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::unordered_map<MaterialAssignmentId, EditorMaterialComponentSlot*> EditorMaterialComponent::GetMaterialSlots()
|
||||
{
|
||||
AZStd::unordered_map<MaterialAssignmentId, EditorMaterialComponentSlot*> materialSlots;
|
||||
BuildMaterialSlotMap(*this, materialSlots);
|
||||
return AZStd::move(materialSlots);
|
||||
}
|
||||
|
||||
AZStd::unordered_map<MaterialAssignmentId, const EditorMaterialComponentSlot*> EditorMaterialComponent::GetMaterialSlots() const
|
||||
{
|
||||
AZStd::unordered_map<MaterialAssignmentId, const EditorMaterialComponentSlot*> materialSlots;
|
||||
BuildMaterialSlotMap(*this, materialSlots);
|
||||
return AZStd::move(materialSlots);
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
@@ -58,9 +58,6 @@ namespace AZ
|
||||
// controller configuration then those values will be assigned to the editor component slots.
|
||||
void UpdateMaterialSlots();
|
||||
|
||||
// Clears all values related to the material component and regenerates the editor slots
|
||||
AZ::u32 ResetMaterialSlots();
|
||||
|
||||
// Opens the source material export dialog and updates editor material slots based on
|
||||
// selected actions
|
||||
AZ::u32 OpenMaterialExporter();
|
||||
@@ -82,10 +79,6 @@ namespace AZ
|
||||
// Evaluate if materials can be edited
|
||||
bool IsEditingAllowed() const;
|
||||
|
||||
template<typename ComponentType, typename ContainerType>
|
||||
static void BuildMaterialSlotMap(ComponentType& component, ContainerType& materialSlots);
|
||||
AZStd::unordered_map<MaterialAssignmentId, EditorMaterialComponentSlot*> GetMaterialSlots();
|
||||
AZStd::unordered_map<MaterialAssignmentId, const EditorMaterialComponentSlot*> GetMaterialSlots() const;
|
||||
AZStd::string GetLabelForLod(int lodIndex) const;
|
||||
|
||||
AZStd::string m_message;
|
||||
|
||||
+4
@@ -55,6 +55,10 @@ namespace AZ
|
||||
|
||||
bool OpenExportDialog(ExportItemsContainer& exportItems)
|
||||
{
|
||||
// Sort material entries so they are ordered by name in the table
|
||||
AZStd::sort(exportItems.begin(), exportItems.end(),
|
||||
[](const auto& a, const auto& b) { return a.GetMaterialSlotName() < b.GetMaterialSlotName(); });
|
||||
|
||||
QWidget* activeWindow = nullptr;
|
||||
AzToolsFramework::EditorWindowRequestBus::BroadcastResult(activeWindow, &AzToolsFramework::EditorWindowRequests::GetAppMainWindow);
|
||||
|
||||
|
||||
+4
-3
@@ -140,7 +140,7 @@ namespace AZ
|
||||
|
||||
void EditorMaterialComponentSlot::SetAsset(const Data::AssetId& assetId)
|
||||
{
|
||||
m_materialAsset.Create(assetId);
|
||||
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(assetId, AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
MaterialComponentRequestBus::Event(
|
||||
m_entityId, &MaterialComponentRequestBus::Events::SetMaterialOverride, m_id, m_materialAsset.GetId());
|
||||
OnDataChanged();
|
||||
@@ -164,7 +164,7 @@ namespace AZ
|
||||
|
||||
void EditorMaterialComponentSlot::ClearToDefaultAsset()
|
||||
{
|
||||
m_materialAsset.Create(GetDefaultAssetId());
|
||||
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(GetDefaultAssetId(), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
MaterialComponentRequestBus::Event(
|
||||
m_entityId, &MaterialComponentRequestBus::Events::SetMaterialOverride, m_id, m_materialAsset.GetId());
|
||||
ClearOverrides();
|
||||
@@ -204,7 +204,8 @@ namespace AZ
|
||||
const auto& assetIdOutcome = AZ::RPI::AssetUtils::MakeAssetId(exportItem.GetExportPath(), 0);
|
||||
if (assetIdOutcome)
|
||||
{
|
||||
m_materialAsset.Create(assetIdOutcome.GetValue());
|
||||
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(
|
||||
assetIdOutcome.GetValue(), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
+73
-11
@@ -43,6 +43,11 @@ namespace AZ
|
||||
->Event("SetDefaultMaterialOverride", &MaterialComponentRequestBus::Events::SetDefaultMaterialOverride)
|
||||
->Event("GetDefaultMaterialOverride", &MaterialComponentRequestBus::Events::GetDefaultMaterialOverride)
|
||||
->Event("ClearDefaultMaterialOverride", &MaterialComponentRequestBus::Events::ClearDefaultMaterialOverride)
|
||||
->Event("ClearModelMaterialOverrides", &MaterialComponentRequestBus::Events::ClearModelMaterialOverrides)
|
||||
->Event("ClearLodMaterialOverrides", &MaterialComponentRequestBus::Events::ClearLodMaterialOverrides)
|
||||
->Event("ClearIncompatibleMaterialOverrides", &MaterialComponentRequestBus::Events::ClearIncompatibleMaterialOverrides)
|
||||
->Event("ClearInvalidMaterialOverrides", &MaterialComponentRequestBus::Events::ClearInvalidMaterialOverrides)
|
||||
->Event("RepairInvalidMaterialOverrides", &MaterialComponentRequestBus::Events::RepairInvalidMaterialOverrides)
|
||||
->Event("SetMaterialOverride", &MaterialComponentRequestBus::Events::SetMaterialOverride)
|
||||
->Event("GetMaterialOverride", &MaterialComponentRequestBus::Events::GetMaterialOverride)
|
||||
->Event("ClearMaterialOverride", &MaterialComponentRequestBus::Events::ClearMaterialOverride)
|
||||
@@ -275,10 +280,10 @@ namespace AZ
|
||||
|
||||
MaterialAssignmentMap MaterialComponentController::GetOriginalMaterialAssignments() const
|
||||
{
|
||||
MaterialAssignmentMap materialAssignmentMap;
|
||||
MaterialAssignmentMap originalMaterials;
|
||||
MaterialReceiverRequestBus::EventResult(
|
||||
materialAssignmentMap, m_entityId, &MaterialReceiverRequestBus::Events::GetMaterialAssignments);
|
||||
return materialAssignmentMap;
|
||||
originalMaterials, m_entityId, &MaterialReceiverRequestBus::Events::GetMaterialAssignments);
|
||||
return originalMaterials;
|
||||
}
|
||||
|
||||
MaterialAssignmentId MaterialComponentController::FindMaterialAssignmentId(
|
||||
@@ -348,6 +353,67 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialComponentController::ClearModelMaterialOverrides()
|
||||
{
|
||||
AZStd::erase_if(m_configuration.m_materials, [](const auto& materialPair) {
|
||||
return materialPair.first.IsSlotIdOnly();
|
||||
});
|
||||
QueueMaterialUpdateNotification();
|
||||
}
|
||||
|
||||
void MaterialComponentController::ClearLodMaterialOverrides()
|
||||
{
|
||||
AZStd::erase_if(m_configuration.m_materials, [](const auto& materialPair) {
|
||||
return materialPair.first.IsLodAndSlotId();
|
||||
});
|
||||
QueueMaterialUpdateNotification();
|
||||
}
|
||||
|
||||
void MaterialComponentController::ClearIncompatibleMaterialOverrides()
|
||||
{
|
||||
const MaterialAssignmentMap& originalMaterials = GetOriginalMaterialAssignments();
|
||||
AZStd::erase_if(m_configuration.m_materials, [&originalMaterials](const auto& materialPair) {
|
||||
return originalMaterials.find(materialPair.first) == originalMaterials.end();
|
||||
});
|
||||
QueueMaterialUpdateNotification();
|
||||
}
|
||||
|
||||
void MaterialComponentController::ClearInvalidMaterialOverrides()
|
||||
{
|
||||
AZStd::erase_if(m_configuration.m_materials, [](const auto& materialPair) {
|
||||
if (materialPair.second.m_materialAsset.GetId().IsValid())
|
||||
{
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
AZ::Data::AssetCatalogRequestBus::BroadcastResult(
|
||||
assetInfo, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetInfoById,
|
||||
materialPair.second.m_materialAsset.GetId());
|
||||
return !assetInfo.m_assetId.IsValid();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
QueueMaterialUpdateNotification();
|
||||
}
|
||||
|
||||
void MaterialComponentController::RepairInvalidMaterialOverrides()
|
||||
{
|
||||
for (auto& materialPair : m_configuration.m_materials)
|
||||
{
|
||||
if (materialPair.second.m_materialAsset.GetId().IsValid())
|
||||
{
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
AZ::Data::AssetCatalogRequestBus::BroadcastResult(
|
||||
assetInfo, &AZ::Data::AssetCatalogRequestBus::Events::GetAssetInfoById,
|
||||
materialPair.second.m_materialAsset.GetId());
|
||||
if (!assetInfo.m_assetId.IsValid())
|
||||
{
|
||||
materialPair.second.m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(
|
||||
GetDefaultMaterialAssetId(materialPair.first), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
LoadMaterials();
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetDefaultMaterialOverride(const AZ::Data::AssetId& materialAssetId)
|
||||
{
|
||||
SetMaterialOverride(DefaultMaterialAssignmentId, materialAssetId);
|
||||
@@ -363,9 +429,11 @@ namespace AZ
|
||||
ClearMaterialOverride(DefaultMaterialAssignmentId);
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetMaterialOverride(const MaterialAssignmentId& materialAssignmentId, const AZ::Data::AssetId& materialAssetId)
|
||||
void MaterialComponentController::SetMaterialOverride(
|
||||
const MaterialAssignmentId& materialAssignmentId, const AZ::Data::AssetId& materialAssetId)
|
||||
{
|
||||
m_configuration.m_materials[materialAssignmentId].m_materialAsset.Create(materialAssetId);
|
||||
m_configuration.m_materials[materialAssignmentId].m_materialAsset =
|
||||
AZ::Data::Asset<AZ::RPI::MaterialAsset>(materialAssetId, AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
LoadMaterials();
|
||||
}
|
||||
|
||||
@@ -616,7 +684,6 @@ namespace AZ
|
||||
|
||||
void MaterialComponentController::ClearAllPropertyOverrides()
|
||||
{
|
||||
bool cleared = false;
|
||||
for (auto& materialPair : m_configuration.m_materials)
|
||||
{
|
||||
if (!materialPair.second.m_propertyOverrides.empty())
|
||||
@@ -625,13 +692,8 @@ namespace AZ
|
||||
materialPair.second.RebuildInstance();
|
||||
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialInstanceCreated, materialPair.second);
|
||||
QueueMaterialUpdateNotification();
|
||||
cleared = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (cleared)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialComponentController::SetPropertyOverrides(
|
||||
|
||||
+5
@@ -52,6 +52,11 @@ namespace AZ
|
||||
void SetMaterialOverrides(const MaterialAssignmentMap& materials) override;
|
||||
const MaterialAssignmentMap& GetMaterialOverrides() const override;
|
||||
void ClearAllMaterialOverrides() override;
|
||||
void ClearModelMaterialOverrides() override;
|
||||
void ClearLodMaterialOverrides() override;
|
||||
void ClearIncompatibleMaterialOverrides() override;
|
||||
void ClearInvalidMaterialOverrides() override;
|
||||
void RepairInvalidMaterialOverrides() override;
|
||||
void SetDefaultMaterialOverride(const AZ::Data::AssetId& materialAssetId) override;
|
||||
const AZ::Data::AssetId GetDefaultMaterialOverride() const override;
|
||||
void ClearDefaultMaterialOverride() override;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <OcclusionCullingPlane/OcclusionCullingPlaneComponent.h>
|
||||
#include <PostProcess/PostFxLayerComponent.h>
|
||||
#include <PostProcess/Bloom/BloomComponent.h>
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingComponent.h>
|
||||
#include <PostProcess/DepthOfField/DepthOfFieldComponent.h>
|
||||
#include <PostProcess/DisplayMapper/DisplayMapperComponent.h>
|
||||
#include <PostProcess/ExposureControl/ExposureControlComponent.h>
|
||||
@@ -57,6 +58,7 @@
|
||||
#include <OcclusionCullingPlane/EditorOcclusionCullingPlaneComponent.h>
|
||||
#include <PostProcess/EditorPostFxLayerComponent.h>
|
||||
#include <PostProcess/Bloom/EditorBloomComponent.h>
|
||||
#include <PostProcess/ColorGrading/EditorHDRColorGradingComponent.h>
|
||||
#include <PostProcess/DepthOfField/EditorDepthOfFieldComponent.h>
|
||||
#include <PostProcess/DisplayMapper/EditorDisplayMapperComponent.h>
|
||||
#include <PostProcess/ExposureControl/EditorExposureControlComponent.h>
|
||||
@@ -93,6 +95,7 @@ namespace AZ
|
||||
DecalComponent::CreateDescriptor(),
|
||||
DirectionalLightComponent::CreateDescriptor(),
|
||||
BloomComponent::CreateDescriptor(),
|
||||
HDRColorGradingComponent::CreateDescriptor(),
|
||||
DisplayMapperComponent::CreateDescriptor(),
|
||||
DepthOfFieldComponent::CreateDescriptor(),
|
||||
ExposureControlComponent::CreateDescriptor(),
|
||||
@@ -124,6 +127,7 @@ namespace AZ
|
||||
EditorDecalComponent::CreateDescriptor(),
|
||||
EditorDirectionalLightComponent::CreateDescriptor(),
|
||||
EditorBloomComponent::CreateDescriptor(),
|
||||
EditorHDRColorGradingComponent::CreateDescriptor(),
|
||||
EditorDepthOfFieldComponent::CreateDescriptor(),
|
||||
EditorDisplayMapperComponent::CreateDescriptor(),
|
||||
EditorExposureControlComponent::CreateDescriptor(),
|
||||
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <PostProcess/ColorGrading/EditorHDRColorGradingComponent.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
void EditorHDRColorGradingComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
BaseClass::Reflect(context);
|
||||
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<EditorHDRColorGradingComponent, BaseClass>()->Version(1);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<EditorHDRColorGradingComponent>(
|
||||
"HDR Color Grading", "Tune and apply color grading in HDR.")
|
||||
->ClassElement(Edit::ClassElements::EditorData, "")
|
||||
->Attribute(Edit::Attributes::Category, "Atom")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
|
||||
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
|
||||
->Attribute(Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(Edit::Attributes::HelpPageURL, "https://") // [TODO ATOM-2672][PostFX] need to create page for PostProcessing.
|
||||
;
|
||||
|
||||
editContext->Class<HDRColorGradingComponentController>(
|
||||
"HDRColorGradingComponentControl", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &HDRColorGradingComponentController::m_configuration, "Configuration", "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
;
|
||||
|
||||
editContext->Class<HDRColorGradingComponentConfig>("HDRColorGradingComponentConfig", "")
|
||||
->DataElement(Edit::UIHandlers::CheckBox, &HDRColorGradingComponentConfig::m_enabled,
|
||||
"Enable HDR color grading",
|
||||
"Enable HDR color grading.")
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Color Adjustment")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingExposure, "Exposure", "Exposure Value")
|
||||
->Attribute(Edit::Attributes::Min, AZStd::numeric_limits<float>::lowest())
|
||||
->Attribute(Edit::Attributes::Max, AZStd::numeric_limits<float>::max())
|
||||
->Attribute(Edit::Attributes::SoftMin, -20.0f)
|
||||
->Attribute(Edit::Attributes::SoftMax, 20.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingContrast, "Contrast", "Contrast Value")
|
||||
->Attribute(Edit::Attributes::Min, -100.0f)
|
||||
->Attribute(Edit::Attributes::Max, 100.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingPreSaturation, "Pre Saturation", "Pre Saturation Value")
|
||||
->Attribute(Edit::Attributes::Min, -100.0f)
|
||||
->Attribute(Edit::Attributes::Max, 100.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingFilterIntensity, "Filter Intensity", "Filter Intensity Value")
|
||||
->Attribute(Edit::Attributes::Min, AZStd::numeric_limits<float>::lowest())
|
||||
->Attribute(Edit::Attributes::Max, AZStd::numeric_limits<float>::max())
|
||||
->Attribute(Edit::Attributes::SoftMin, -1.0f)
|
||||
->Attribute(Edit::Attributes::SoftMax, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingFilterMultiply, "Filter Multiply", "Filter Multiply Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_colorFilterSwatch, "Color Filter Swatch", "Color Filter Swatch Value")
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "White Balance")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_whiteBalanceKelvin, "Temperature", "Temperature in Kelvin")
|
||||
->Attribute(Edit::Attributes::Min, 1000.0f)
|
||||
->Attribute(Edit::Attributes::Max, 40000.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_whiteBalanceTint, "Tint", "Tint Value")
|
||||
->Attribute(Edit::Attributes::Min, -100.0f)
|
||||
->Attribute(Edit::Attributes::Max, 100.0f)
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Split Toning")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_splitToneWeight, "Split Tone Weight", "Modulates the split toning effect.")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_splitToneBalance, "Split Tone Balance", "Split Tone Balance Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_splitToneShadowsColor, "Split Tone Shadows Color", "Split Tone Shadows Color")
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_splitToneHighlightsColor, "Split Tone Highlights Color", "Split Tone Highlights Color")
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Channel Mixing")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_channelMixingRed, "Channel Mixing Red", "Channel Mixing Red Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_channelMixingGreen, "Channel Mixing Green", "Channel Mixing Green Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_channelMixingBlue, "Channel Mixing Blue", "Channel Mixing Blue Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Shadow Midtones Highlights")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhWeight, "SMH Weight", "Modulates the SMH effect.")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhShadowsStart, "SMH Shadows Start", "SMH Shadows Start Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhShadowsEnd, "SMH Shadows End", "SMH Shadows End Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhHighlightsStart, "SMH Highlights Start", "SMH Highlights Start Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_smhHighlightsEnd, "SMH Highlights End", "SMH Highlights End Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_smhShadowsColor, "SMH Shadows Color", "SMH Shadows Color")
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_smhMidtonesColor, "SMH Midtones Color", "SMH Midtones Color")
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &HDRColorGradingComponentConfig::m_smhHighlightsColor, "SMH Highlights Color", "SMH Highlights Color")
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Final Adjustment")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingHueShift, "Hue Shift", "Hue Shift Value")
|
||||
->Attribute(Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(Edit::Attributes::Max, 1.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &HDRColorGradingComponentConfig::m_colorGradingPostSaturation, "Post Saturation", "Post Saturation Value")
|
||||
->Attribute(Edit::Attributes::Min, -100.0f)
|
||||
->Attribute(Edit::Attributes::Max, 100.0f)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorHDRColorGradingComponent::EditorHDRColorGradingComponent(const HDRColorGradingComponentConfig& config)
|
||||
: BaseClass(config)
|
||||
{
|
||||
}
|
||||
|
||||
u32 EditorHDRColorGradingComponent::OnConfigurationChanged()
|
||||
{
|
||||
m_controller.OnConfigChanged();
|
||||
return Edit::PropertyRefreshLevels::AttributesAndValues;
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingComponent.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class EditorHDRColorGradingComponent final
|
||||
: public AzToolsFramework::Components::
|
||||
EditorComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponent, HDRColorGradingComponentConfig>
|
||||
{
|
||||
public:
|
||||
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponent, HDRColorGradingComponentConfig>;
|
||||
AZ_EDITOR_COMPONENT(AZ::Render::EditorHDRColorGradingComponent, "{C1FAB0B1-5847-4533-B08E-7314AC807B8E}", BaseClass);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
EditorHDRColorGradingComponent() = default;
|
||||
EditorHDRColorGradingComponent(const HDRColorGradingComponentConfig& config);
|
||||
|
||||
//! EditorRenderComponentAdapter overrides...
|
||||
AZ::u32 OnConfigurationChanged() override;
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingComponent.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
HDRColorGradingComponent::HDRColorGradingComponent(const HDRColorGradingComponentConfig& config)
|
||||
: BaseClass(config)
|
||||
{
|
||||
}
|
||||
|
||||
void HDRColorGradingComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
BaseClass::Reflect(context);
|
||||
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<HDRColorGradingComponent, BaseClass>();
|
||||
}
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzFramework/Components/ComponentAdapter.h>
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingComponentController.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingComponentConfig.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class HDRColorGradingComponent final
|
||||
: public AzFramework::Components::ComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponentConfig>
|
||||
{
|
||||
public:
|
||||
using BaseClass = AzFramework::Components::ComponentAdapter<HDRColorGradingComponentController, HDRColorGradingComponentConfig>;
|
||||
AZ_COMPONENT(AZ::Render::HDRColorGradingComponent, "{51968E0F-4DF0-4851-8405-388CBB15B573}", BaseClass);
|
||||
|
||||
HDRColorGradingComponent() = default;
|
||||
HDRColorGradingComponent(const HDRColorGradingComponentConfig& config);
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingComponentConfig.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
void HDRColorGradingComponentConfig::Reflect(ReflectContext* context)
|
||||
{
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<HDRColorGradingComponentConfig, ComponentConfig>()->Version(0)
|
||||
|
||||
// Auto-gen serialize context code...
|
||||
#define SERIALIZE_CLASS HDRColorGradingComponentConfig
|
||||
#include <Atom/Feature/ParamMacros/StartParamSerializeContext.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
#undef SERIALIZE_CLASS
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentConfig::CopySettingsTo (HDRColorGradingSettingsInterface* settings)
|
||||
{
|
||||
if (!settings)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#define COPY_TARGET settings
|
||||
#include <Atom/Feature/ParamMacros/StartParamCopySettingsTo.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
#undef COPY_TARGET
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
|
||||
#include <Atom/RPI.Public/Scene.h>
|
||||
|
||||
#include <PostProcess/ColorGrading/HDRColorGradingComponentController.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
void HDRColorGradingComponentController::Reflect(ReflectContext* context)
|
||||
{
|
||||
HDRColorGradingComponentConfig::Reflect(context);
|
||||
|
||||
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<HDRColorGradingComponentController>()
|
||||
->Version(0)
|
||||
->Field("Configuration", &HDRColorGradingComponentController::m_configuration);
|
||||
}
|
||||
|
||||
if (auto* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<HDRColorGradingRequestBus>("HDRColorGradingRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Module, "render")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
|
||||
// Auto-gen behavior context...
|
||||
#define PARAM_EVENT_BUS HDRColorGradingRequestBus::Events
|
||||
#include <Atom/Feature/ParamMacros/StartParamBehaviorContext.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
#undef PARAM_EVENT_BUS
|
||||
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
{
|
||||
provided.push_back(AZ_CRC_CE("HDRColorGradingService"));
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC_CE("HDRColorGradingService"));
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
required.push_back(AZ_CRC_CE("PostFXLayerService"));
|
||||
}
|
||||
|
||||
HDRColorGradingComponentController::HDRColorGradingComponentController(const HDRColorGradingComponentConfig& config)
|
||||
: m_configuration(config)
|
||||
{
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentController::Activate(EntityId entityId)
|
||||
{
|
||||
m_entityId = entityId;
|
||||
|
||||
PostProcessFeatureProcessorInterface* fp =
|
||||
RPI::Scene::GetFeatureProcessorForEntity<PostProcessFeatureProcessorInterface>(m_entityId);
|
||||
if (fp)
|
||||
{
|
||||
m_postProcessInterface = fp->GetOrCreateSettingsInterface(m_entityId);
|
||||
if (m_postProcessInterface)
|
||||
{
|
||||
m_settingsInterface = m_postProcessInterface->GetOrCreateHDRColorGradingSettingsInterface();
|
||||
OnConfigChanged();
|
||||
}
|
||||
}
|
||||
HDRColorGradingRequestBus::Handler::BusConnect(m_entityId);
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentController::Deactivate()
|
||||
{
|
||||
HDRColorGradingRequestBus::Handler::BusDisconnect(m_entityId);
|
||||
|
||||
if (m_postProcessInterface)
|
||||
{
|
||||
m_postProcessInterface->RemoveHDRColorGradingSettingsInterface();
|
||||
}
|
||||
|
||||
m_postProcessInterface = nullptr;
|
||||
m_settingsInterface = nullptr;
|
||||
m_entityId.SetInvalid();
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentController::SetConfiguration(const HDRColorGradingComponentConfig& config)
|
||||
{
|
||||
m_configuration = config;
|
||||
OnConfigChanged();
|
||||
}
|
||||
|
||||
const HDRColorGradingComponentConfig& HDRColorGradingComponentController::GetConfiguration() const
|
||||
{
|
||||
return m_configuration;
|
||||
}
|
||||
|
||||
void HDRColorGradingComponentController::OnConfigChanged()
|
||||
{
|
||||
if (m_settingsInterface)
|
||||
{
|
||||
m_configuration.CopySettingsTo(m_settingsInterface);
|
||||
m_settingsInterface->OnConfigChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-gen getter/setter function definitions...
|
||||
// The setter functions will set the values on the Atom settings class, then get the value back
|
||||
// from the settings class to set the local configuration. This is in case the settings class
|
||||
// applies some custom logic that results in the set value being different from the input
|
||||
#define AZ_GFX_COMMON_PARAM(ValueType, Name, MemberName, DefaultValue) \
|
||||
ValueType HDRColorGradingComponentController::Get##Name() const \
|
||||
{ \
|
||||
return m_configuration.MemberName; \
|
||||
} \
|
||||
void HDRColorGradingComponentController::Set##Name(ValueType val) \
|
||||
{ \
|
||||
if (m_settingsInterface) \
|
||||
{ \
|
||||
m_settingsInterface->Set##Name(val); \
|
||||
m_settingsInterface->OnConfigChanged(); \
|
||||
m_configuration.MemberName = m_settingsInterface->Get##Name(); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m_configuration.MemberName = val; \
|
||||
} \
|
||||
}
|
||||
|
||||
#include <Atom/Feature/ParamMacros/MapAllCommon.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingComponentConfig.h>
|
||||
#include <AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingBus.h>
|
||||
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingSettingsInterface.h>
|
||||
#include <Atom/Feature/PostProcess/PostProcessFeatureProcessorInterface.h>
|
||||
#include <Atom/Feature/PostProcess/PostProcessSettingsInterface.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class HDRColorGradingComponentController final
|
||||
: public HDRColorGradingRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
friend class EditorHDRColorGradingComponent;
|
||||
|
||||
AZ_TYPE_INFO(AZ::Render::HDRColorGradingComponentController, "{CA1D635C-64E9-42C7-A8E0-36C6B825B15D}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
|
||||
HDRColorGradingComponentController() = default;
|
||||
HDRColorGradingComponentController(const HDRColorGradingComponentConfig& config);
|
||||
|
||||
void Activate(EntityId entityId);
|
||||
void Deactivate();
|
||||
void SetConfiguration(const HDRColorGradingComponentConfig& config);
|
||||
const HDRColorGradingComponentConfig& GetConfiguration() const;
|
||||
|
||||
// Auto-gen function override declarations (functions definitions in .cpp)...
|
||||
#include <Atom/Feature/ParamMacros/StartParamFunctionsOverride.inl>
|
||||
#include <Atom/Feature/PostProcess/ColorGrading/HDRColorGradingParams.inl>
|
||||
#include <Atom/Feature/ParamMacros/EndParams.inl>
|
||||
|
||||
private:
|
||||
AZ_DISABLE_COPY(HDRColorGradingComponentController);
|
||||
|
||||
void OnConfigChanged();
|
||||
|
||||
PostProcessSettingsInterface* m_postProcessInterface = nullptr;
|
||||
HDRColorGradingSettingsInterface* m_settingsInterface = nullptr;
|
||||
HDRColorGradingComponentConfig m_configuration;
|
||||
EntityId m_entityId;
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
+2
@@ -63,6 +63,8 @@ set(FILES
|
||||
Source/PostProcess/EditorPostFxLayerComponent.h
|
||||
Source/PostProcess/Bloom/EditorBloomComponent.cpp
|
||||
Source/PostProcess/Bloom/EditorBloomComponent.h
|
||||
Source/PostProcess/ColorGrading/EditorHDRColorGradingComponent.cpp
|
||||
Source/PostProcess/ColorGrading/EditorHDRColorGradingComponent.h
|
||||
Source/PostProcess/DepthOfField/EditorDepthOfFieldComponent.cpp
|
||||
Source/PostProcess/DepthOfField/EditorDepthOfFieldComponent.h
|
||||
Source/PostProcess/DisplayMapper/EditorDisplayMapperComponent.cpp
|
||||
|
||||
+5
@@ -83,6 +83,11 @@ set(FILES
|
||||
Source/PostProcess/Bloom/BloomComponentConfig.cpp
|
||||
Source/PostProcess/Bloom/BloomComponentController.cpp
|
||||
Source/PostProcess/Bloom/BloomComponentController.h
|
||||
Source/PostProcess/ColorGrading/HDRColorGradingComponent.cpp
|
||||
Source/PostProcess/ColorGrading/HDRColorGradingComponent.h
|
||||
Source/PostProcess/ColorGrading/HDRColorGradingComponentConfig.cpp
|
||||
Source/PostProcess/ColorGrading/HDRColorGradingComponentController.cpp
|
||||
Source/PostProcess/ColorGrading/HDRColorGradingComponentController.h
|
||||
Source/PostProcess/DepthOfField/DepthOfFieldComponent.cpp
|
||||
Source/PostProcess/DepthOfField/DepthOfFieldComponent.h
|
||||
Source/PostProcess/DepthOfField/DepthOfFieldComponentConfig.cpp
|
||||
|
||||
+2
@@ -39,6 +39,8 @@ set(FILES
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlBus.h
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConfig.h
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/ExposureControl/ExposureControlComponentConstants.h
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingBus.h
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/ColorGrading/HDRColorGradingComponentConfig.h
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/Ssao/SsaoBus.h
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/Ssao/SsaoComponentConfiguration.h
|
||||
Include/AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationBus.h
|
||||
|
||||
@@ -18,8 +18,8 @@ ly_add_target(
|
||||
PUBLIC
|
||||
Gem::Atom_RPI.Public
|
||||
AZ::AtomCore
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
@@ -32,7 +32,6 @@ ly_add_target(
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
Gem::Camera.Static
|
||||
)
|
||||
|
||||
@@ -56,9 +55,6 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
Source
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Legacy::CryCommon
|
||||
Legacy::Editor.Headers
|
||||
Legacy::EditorCommon
|
||||
AZ::AzToolsFramework
|
||||
Gem::Camera.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
|
||||
#include "CameraComponent.h"
|
||||
|
||||
#include <MathConversion.h>
|
||||
#include <AzCore/Math/MatrixUtils.h>
|
||||
#include <IRenderer.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
|
||||
namespace Camera
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
#include <AzFramework/Components/ComponentAdapter.h>
|
||||
|
||||
#include <AzFramework/Components/CameraBus.h>
|
||||
#include <IViewSystem.h>
|
||||
#include <ISystem.h>
|
||||
#include <Cry_Camera.h>
|
||||
#include <CameraComponentController.h>
|
||||
|
||||
#include <Atom/RPI.Public/Base.h>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "CameraComponentController.h"
|
||||
#include "CameraViewRegistrationBus.h"
|
||||
|
||||
#include <MathConversion.h>
|
||||
#include <AzCore/Math/MatrixUtils.h>
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
#include <Atom/RPI.Public/ViewportContextManager.h>
|
||||
@@ -53,7 +52,7 @@ namespace Camera
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CameraComponentConfig::m_fov, "Field of view", "Vertical field of view in degrees")
|
||||
->Attribute(AZ::Edit::Attributes::Min, MIN_FOV)
|
||||
->Attribute(AZ::Edit::Attributes::Min, MinFoV)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, " degrees")
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, AZ::RadToDeg(AZ::Constants::Pi) - 0.0001f) //We assert at fovs >= Pi so set the max for this field to be just under that
|
||||
@@ -61,7 +60,7 @@ namespace Camera
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &CameraComponentConfig::GetPerspectiveParameterVisibility)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CameraComponentConfig::m_nearClipDistance, "Near clip distance",
|
||||
"Distance to the near clip plane of the view Frustum")
|
||||
->Attribute(AZ::Edit::Attributes::Min, CAMERA_MIN_NEAR)
|
||||
->Attribute(AZ::Edit::Attributes::Min, MinimumNearPlaneDistance)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, " m")
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, &CameraComponentConfig::GetFarClipDistance)
|
||||
@@ -150,6 +149,11 @@ namespace Camera
|
||||
}
|
||||
}
|
||||
|
||||
void CameraComponentController::SetShouldActivateFunction(AZStd::function<bool()> shouldActivateFunction)
|
||||
{
|
||||
m_shouldActivateFn = shouldActivateFunction;
|
||||
}
|
||||
|
||||
void CameraComponentController::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
CameraComponentConfig::Reflect(context);
|
||||
@@ -202,36 +206,6 @@ namespace Camera
|
||||
{
|
||||
m_entityId = entityId;
|
||||
|
||||
if ((!m_viewSystem)||(!m_system))
|
||||
{
|
||||
// perform first-time init
|
||||
if (gEnv)
|
||||
{
|
||||
m_system = gEnv->pSystem;
|
||||
}
|
||||
if (m_system)
|
||||
{
|
||||
// Initialize local view.
|
||||
m_viewSystem = m_system->GetIViewSystem();
|
||||
if (!m_viewSystem)
|
||||
{
|
||||
AZ_Error("CameraComponent", m_viewSystem != nullptr, "The CameraComponent shouldn't be used without a local view system");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_viewSystem)
|
||||
{
|
||||
if (m_view == nullptr)
|
||||
{
|
||||
m_view = m_viewSystem->CreateView();
|
||||
|
||||
AZ::Entity* entity = nullptr;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationRequests::FindEntity, m_entityId);
|
||||
m_view->LinkTo(entity);
|
||||
}
|
||||
}
|
||||
|
||||
auto atomViewportRequests = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
|
||||
if (atomViewportRequests)
|
||||
{
|
||||
@@ -270,9 +244,8 @@ namespace Camera
|
||||
CameraBus::Handler::BusConnect();
|
||||
CameraNotificationBus::Broadcast(&CameraNotificationBus::Events::OnCameraAdded, m_entityId);
|
||||
|
||||
// Activate our camera if we're running from the launcher or Editor game mode
|
||||
// Otherwise, let the Editor keep managing the active camera
|
||||
if (m_config.m_makeActiveViewOnActivation && (!gEnv || !gEnv->IsEditor() || gEnv->IsEditorGameMode()))
|
||||
// Only activate if we're configured to do so, and our activation call back indicates that we should
|
||||
if (m_config.m_makeActiveViewOnActivation && (!m_shouldActivateFn || m_shouldActivateFn()))
|
||||
{
|
||||
MakeActiveView();
|
||||
}
|
||||
@@ -284,20 +257,6 @@ namespace Camera
|
||||
CameraBus::Handler::BusDisconnect();
|
||||
AZ::TransformNotificationBus::Handler::BusDisconnect(m_entityId);
|
||||
CameraRequestBus::Handler::BusDisconnect(m_entityId);
|
||||
if (m_viewSystem)
|
||||
{
|
||||
if (m_view != nullptr && m_viewSystem->GetViewId(m_view) != 0)
|
||||
{
|
||||
m_view->Unlink();
|
||||
}
|
||||
if (m_viewSystem->GetActiveView() == m_view)
|
||||
{
|
||||
m_viewSystem->SetActiveView(m_prevViewId);
|
||||
}
|
||||
m_viewSystem->RemoveView(m_view);
|
||||
m_prevViewId = 0;
|
||||
m_view = nullptr;
|
||||
}
|
||||
|
||||
auto atomViewportRequests = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
|
||||
if (atomViewportRequests)
|
||||
@@ -429,13 +388,6 @@ namespace Camera
|
||||
return;
|
||||
}
|
||||
|
||||
// Set Legacy Cry view, if it exists
|
||||
if (m_viewSystem)
|
||||
{
|
||||
m_prevViewId = AZ::u32(m_viewSystem->GetActiveViewId());
|
||||
m_viewSystem->SetActiveView(m_view);
|
||||
}
|
||||
|
||||
// Set Atom camera, if it exists
|
||||
if (m_atomCamera)
|
||||
{
|
||||
@@ -461,12 +413,6 @@ namespace Camera
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_view)
|
||||
{
|
||||
CCamera& camera = m_view->GetCamera();
|
||||
camera.SetMatrix(AZTransformToLYTransform(world.GetOrthogonalized()));
|
||||
}
|
||||
|
||||
if (m_atomCamera)
|
||||
{
|
||||
m_updatingTransformFromEntity = true;
|
||||
@@ -495,25 +441,15 @@ namespace Camera
|
||||
|
||||
void CameraComponentController::UpdateCamera()
|
||||
{
|
||||
if (m_view)
|
||||
{
|
||||
auto viewParams = *m_view->GetCurrentParams();
|
||||
viewParams.fov = AZ::DegToRad(m_config.m_fov);
|
||||
viewParams.nearplane = m_config.m_nearClipDistance;
|
||||
viewParams.farplane = m_config.m_farClipDistance;
|
||||
m_view->SetCurrentParams(viewParams);
|
||||
}
|
||||
|
||||
if (auto viewportContext = GetViewportContext())
|
||||
{
|
||||
AZ::Matrix4x4 viewToClipMatrix;
|
||||
float aspectRatio = m_view ? m_view->GetCamera().GetPixelAspectRatio() : 1.f;
|
||||
if (!m_atomAuxGeom)
|
||||
{
|
||||
SetupAtomAuxGeom(viewportContext);
|
||||
}
|
||||
auto windowSize = viewportContext->GetViewportSize();
|
||||
aspectRatio = aznumeric_cast<float>(windowSize.m_width) / aznumeric_cast<float>(windowSize.m_height);
|
||||
const float aspectRatio = aznumeric_cast<float>(windowSize.m_width) / aznumeric_cast<float>(windowSize.m_height);
|
||||
|
||||
// This assumes a reversed depth buffer, in line with other LY Atom integration
|
||||
if (m_config.m_orthographic)
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
#include <Atom/RPI.Public/ViewProviderBus.h>
|
||||
#include <Atom/RPI.Public/AuxGeom/AuxGeomFeatureProcessorInterface.h>
|
||||
|
||||
#include <IViewSystem.h>
|
||||
#include <ISystem.h>
|
||||
#include <Cry_Camera.h>
|
||||
|
||||
namespace Camera
|
||||
{
|
||||
static constexpr float DefaultFoV = 75.0f;
|
||||
static constexpr float MinFoV = std::numeric_limits<float>::epsilon();
|
||||
static constexpr float MaxFoV = AZ::RadToDeg(AZ::Constants::Pi);
|
||||
static constexpr float MinimumNearPlaneDistance = 0.001f;
|
||||
static constexpr float DefaultNearPlaneDistance = 0.2f;
|
||||
static constexpr float DefaultFarClipPlaneDistance = 1024.0f;
|
||||
static constexpr float DefaultFrustumDimension = 256.f;
|
||||
@@ -69,6 +66,10 @@ namespace Camera
|
||||
CameraComponentController() = default;
|
||||
explicit CameraComponentController(const CameraComponentConfig& config);
|
||||
|
||||
//! Defines a callback for determining whether this camera should push itself to the top of the Atom camera stack.
|
||||
//! Used by the Editor to disable undesirable camera changes in edit mode.
|
||||
void SetShouldActivateFunction(AZStd::function<bool()> shouldActivateFunction);
|
||||
|
||||
// Controller interface
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
@@ -134,10 +135,6 @@ namespace Camera
|
||||
bool m_updatingTransformFromEntity = false;
|
||||
bool m_isActiveView = false;
|
||||
|
||||
// Cry view integration
|
||||
IView* m_view = nullptr;
|
||||
AZ::u32 m_prevViewId = 0;
|
||||
IViewSystem* m_viewSystem = nullptr;
|
||||
ISystem* m_system = nullptr;
|
||||
AZStd::function<bool()> m_shouldActivateFn;
|
||||
};
|
||||
} // namespace Camera
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user