2
0
Эх сурвалжийг харах

Added the lighting preset control the SSR sample, and a mirror ground plane material

Signed-off-by: dmcdiar <[email protected]>
dmcdiar 3 жил өмнө
parent
commit
e954977baf

+ 9 - 16
Gem/Code/Source/SSRExampleComponent.cpp

@@ -46,17 +46,7 @@ namespace AtomSampleViewer
         CreateModels();
         CreateGroundPlane();
 
-        // IBL
-        m_defaultIbl.Init(m_scene);
-
-        // skybox
-        const constexpr char* SkyboxAssetPath = "textures/sampleenvironment/example_iblskyboxcm.dds.streamingimage";
-        m_skyboxImageAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::StreamingImageAsset>(SkyboxAssetPath, AZ::RPI::AssetUtils::TraceLevel::Assert);
-
-        AZ::Render::SkyBoxFeatureProcessorInterface* skyboxFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::SkyBoxFeatureProcessorInterface>();
-        skyboxFeatureProcessor->Enable(true);
-        skyboxFeatureProcessor->SetSkyboxMode(AZ::Render::SkyBoxMode::Cubemap);
-        skyboxFeatureProcessor->SetCubemap(AZ::RPI::StreamingImage::FindOrCreate(m_skyboxImageAsset));
+        InitLightingPresets(true);
 
         // enable the SSR pass in the pipeline
         EnableSSR(true);
@@ -67,7 +57,7 @@ namespace AtomSampleViewer
         // disable the SSR pass in the pipeline
         EnableSSR(false);
 
-        m_defaultIbl.Reset();
+        ShutdownLightingPresets();
 
         GetMeshFeatureProcessor()->ReleaseMesh(m_statueMeshHandle);
         GetMeshFeatureProcessor()->ReleaseMesh(m_boxMeshHandle);
@@ -140,10 +130,10 @@ namespace AtomSampleViewer
             materialName = AZStd::string::format("materials/ssrexample/groundplanealuminum.azmaterial");
             break;
         case 2:
-            materialName = AZStd::string::format("materials/ssrexample/groundplanewood.azmaterial");
+            materialName = AZStd::string::format("materials/presets/pbr/default_grid.azmaterial");
             break;
         default:
-            materialName = AZStd::string::format("materials/presets/pbr/default_grid.azmaterial");
+            materialName = AZStd::string::format("materials/ssrexample/groundplanemirror.azmaterial");
             break;
         }
 
@@ -192,13 +182,16 @@ namespace AtomSampleViewer
         bool materialChanged = false;
         materialChanged |= ScriptableImGui::RadioButton("Chrome", &m_groundPlaneMaterial, 0);
         materialChanged |= ScriptableImGui::RadioButton("Aluminum", &m_groundPlaneMaterial, 1);
-        materialChanged |= ScriptableImGui::RadioButton("Wood", &m_groundPlaneMaterial, 2);
-        materialChanged |= ScriptableImGui::RadioButton("Default Grid", &m_groundPlaneMaterial, 3);
+        materialChanged |= ScriptableImGui::RadioButton("Default Grid", &m_groundPlaneMaterial, 2);
+        materialChanged |= ScriptableImGui::RadioButton("Mirror", &m_groundPlaneMaterial, 3);
         if (materialChanged)
         {
             CreateGroundPlane();
         }
 
+        ImGui::NewLine();
+        ImGuiLightingPreset();
+
         m_imguiSidebar.End();
     }
 

+ 29 - 0
Materials/SSRExample/GroundPlaneMirror.material

@@ -0,0 +1,29 @@
+{
+    "description": "",
+    "materialType": "Materials\\Types\\StandardPBR.materialtype",
+    "parentMaterial": "",
+    "materialTypeVersion": 3,
+    "properties": {
+        "baseColor": {
+            "color": [
+                1.0,
+                1.0,
+                1.0,
+                1.0
+            ]
+        },
+        "general": {
+            "applySpecularAA": true
+        },
+        "metallic": {
+            "factor": 1.0
+        },
+        "roughness": {
+            "factor": 0.0
+        },
+        "specularF0": {
+            "enableMultiScatterCompensation": true,
+            "factor": 1.0
+        }
+    }
+}