From 71732c1f4539914b4ff8533deeb4b31c7ddca0a7 Mon Sep 17 00:00:00 2001 From: windbagjacket Date: Tue, 11 Jan 2022 13:21:12 +0000 Subject: [PATCH] Adding ray tracing toggle to mesh component UI Adding ray tracing toggle to mesh component UI Signed-off-by: windbagjacket --- .../CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp | 3 +++ .../Code/Source/Mesh/MeshComponentController.cpp | 4 +++- .../CommonFeatures/Code/Source/Mesh/MeshComponentController.h | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp index c89546264a..423145f838 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/EditorMeshComponent.cpp @@ -79,6 +79,9 @@ namespace AZ ->DataElement(AZ::Edit::UIHandlers::CheckBox, &MeshComponentConfig::m_useForwardPassIblSpecular, "Use Forward Pass IBL Specular", "Renders IBL specular reflections in the forward pass, using only the most influential probe (based on the position of the entity) and the global IBL cubemap. Can reduce rendering costs, but only recommended for static objects that are affected by at most one reflection probe.") ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) + ->DataElement(AZ::Edit::UIHandlers::CheckBox, &MeshComponentConfig::m_isRayTracingEnabled, "Use ray tracing", + "Includes this mesh in ray tracing calculations.") + ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::EntireTree) ->DataElement(AZ::Edit::UIHandlers::ComboBox, &MeshComponentConfig::m_lodType, "Lod Type", "Lod Method.") ->EnumAttribute(RPI::Cullable::LodType::Default, "Default") ->EnumAttribute(RPI::Cullable::LodType::ScreenCoverage, "Screen Coverage") diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp index 517ba90f89..b08670113b 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp @@ -76,6 +76,7 @@ namespace AZ ->Field("SortKey", &MeshComponentConfig::m_sortKey) ->Field("ExcludeFromReflectionCubeMaps", &MeshComponentConfig::m_excludeFromReflectionCubeMaps) ->Field("UseForwardPassIBLSpecular", &MeshComponentConfig::m_useForwardPassIblSpecular) + ->Field("IsRayTracingEnabled", &MeshComponentConfig::m_isRayTracingEnabled) ->Field("LodType", &MeshComponentConfig::m_lodType) ->Field("LodOverride", &MeshComponentConfig::m_lodOverride) ->Field("MinimumScreenCoverage", &MeshComponentConfig::m_minimumScreenCoverage) @@ -382,6 +383,7 @@ namespace AZ meshDescriptor.m_modelAsset = m_configuration.m_modelAsset; meshDescriptor.m_useForwardPassIblSpecular = m_configuration.m_useForwardPassIblSpecular; meshDescriptor.m_requiresCloneCallback = RequiresCloning; + meshDescriptor.m_isRayTracingEnabled = m_configuration.m_isRayTracingEnabled; m_meshHandle = m_meshFeatureProcessor->AcquireMesh(meshDescriptor, materials); m_meshFeatureProcessor->ConnectModelChangeEventHandler(m_meshHandle, m_changeEventHandler); @@ -392,7 +394,7 @@ namespace AZ m_meshFeatureProcessor->SetMeshLodConfiguration(m_meshHandle, GetMeshLodConfiguration()); m_meshFeatureProcessor->SetExcludeFromReflectionCubeMaps(m_meshHandle, m_configuration.m_excludeFromReflectionCubeMaps); m_meshFeatureProcessor->SetVisible(m_meshHandle, m_isVisible); - + m_meshFeatureProcessor->SetRayTracingEnabled(m_meshHandle, meshDescriptor.m_isRayTracingEnabled); // [GFX TODO] This should happen automatically. m_changeEventHandler should be passed to AcquireMesh // If the model instance or asset already exists, announce a model change to let others know it's loaded. HandleModelChange(m_meshFeatureProcessor->GetModel(m_meshHandle)); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.h index 6b0731fbf7..4d09b0b7b6 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.h @@ -50,7 +50,7 @@ namespace AZ RHI::DrawItemSortKey m_sortKey = 0; bool m_excludeFromReflectionCubeMaps = false; bool m_useForwardPassIblSpecular = false; - + bool m_isRayTracingEnabled = true; RPI::Cullable::LodType m_lodType = RPI::Cullable::LodType::Default; RPI::Cullable::LodOverride m_lodOverride = aznumeric_cast(0); float m_minimumScreenCoverage = 1.0f / 1080.0f;