Adding ray tracing toggle to mesh component UI

Adding ray tracing toggle to mesh component UI

Signed-off-by: windbagjacket <nibor@ntlworld.com>
This commit is contained in:
windbagjacket
2022-01-11 13:21:12 +00:00
parent f09055af42
commit 71732c1f45
3 changed files with 7 additions and 2 deletions
@@ -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")
@@ -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));
@@ -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<RPI::Cullable::LodOverride>(0);
float m_minimumScreenCoverage = 1.0f / 1080.0f;