From e89ec94c380947ee6dbc5c5eb031888dcce59b18 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 18 Nov 2021 16:59:35 -0800 Subject: [PATCH] update CMakeLists.txt in preparation for removing the TestSuite_Main_GPU_Optimized file, add compare_screenshot_to_golden_image function, add hydra_AtomGPU_LightComponentScreenshotsMatch.py hydra script Signed-off-by: jromnoa <80134229+jromnoa@users.noreply.github.com> --- .../Gem/PythonTests/Atom/CMakeLists.txt | 14 - .../PythonTests/Atom/TestSuite_Main_GPU.py | 87 ----- .../Atom/TestSuite_Main_GPU_Optimized.py | 47 ++- .../Atom/atom_utils/atom_component_helper.py | 326 +++++++++--------- ..._AtomGPU_LightComponentScreenshotsMatch.py | 0 5 files changed, 213 insertions(+), 261 deletions(-) create mode 100644 AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_LightComponentScreenshotsMatch.py diff --git a/AutomatedTesting/Gem/PythonTests/Atom/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/Atom/CMakeLists.txt index 87a66c880e..26eb96e7ec 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/Atom/CMakeLists.txt @@ -47,18 +47,4 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED) COMPONENT Atom ) - ly_add_pytest( - NAME AutomatedTesting::Atom_TestSuite_Main_GPU_Optimized - TEST_SUITE main - TEST_REQUIRES gpu - TEST_SERIAL - TIMEOUT 1200 - PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main_GPU_Optimized.py - RUNTIME_DEPENDENCIES - AssetProcessor - AutomatedTesting.Assets - Editor - COMPONENT - Atom - ) endif() diff --git a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU.py b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU.py index f0e92c7e3e..690f8aeea5 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU.py @@ -5,10 +5,8 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -import datetime import logging import os -import zipfile import pytest @@ -23,96 +21,11 @@ DEFAULT_SUBFOLDER_PATH = 'user/PythonTests/Automated/Screenshots' TEST_DIRECTORY = os.path.join(os.path.dirname(__file__), "tests") -def golden_images_directory(): - """ - Uses this file location to return the valid location for golden image files. - :return: The path to the golden_images directory, but raises an IOError if the golden_images directory is missing. - """ - current_file_directory = os.path.join(os.path.dirname(__file__)) - golden_images_dir = os.path.join(current_file_directory, 'golden_images') - - if not os.path.exists(golden_images_dir): - raise IOError( - f'golden_images" directory was not found at path "{golden_images_dir}"' - f'Please add a "golden_images" directory inside: "{current_file_directory}"' - ) - - return golden_images_dir - - -def create_screenshots_archive(screenshot_path): - """ - Creates a new zip file archive at archive_path containing all files listed within archive_path. - :param screenshot_path: location containing the files to archive, the zip archive file will also be saved here. - :return: None, but creates a new zip file archive inside path containing all of the files inside archive_path. - """ - files_to_archive = [] - - # Search for .png and .ppm files to add to the zip archive file. - for (folder_name, sub_folders, file_names) in os.walk(screenshot_path): - for file_name in file_names: - if file_name.endswith(".png") or file_name.endswith(".ppm"): - file_path = os.path.join(folder_name, file_name) - files_to_archive.append(file_path) - - # Setup variables for naming the zip archive file. - timestamp = datetime.datetime.now().timestamp() - formatted_timestamp = datetime.datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%d_%H-%M-%S") - screenshots_file = os.path.join(screenshot_path, f'zip_archive_{formatted_timestamp}.zip') - - # Write all of the valid .png and .ppm files to the archive file. - with zipfile.ZipFile(screenshots_file, 'w', compression=zipfile.ZIP_DEFLATED, allowZip64=True) as zip_archive: - for file_path in files_to_archive: - file_name = os.path.basename(file_path) - zip_archive.write(file_path, file_name) - - @pytest.mark.parametrize("project", ["AutomatedTesting"]) @pytest.mark.parametrize("launcher_platform", ["windows_editor"]) @pytest.mark.parametrize("level", ["Base"]) class TestAllComponentsIndepthTests(object): - @pytest.mark.parametrize("screenshot_name", ["AtomBasicLevelSetup.ppm"]) - @pytest.mark.test_case_id("C34603773") - def test_BasicLevelSetup_SetsUpLevel( - self, request, editor, workspace, project, launcher_platform, level, screenshot_name): - """ - Please review the hydra script run by this test for more specific test info. - Tests that a basic rendering level setup can be created (lighting, meshes, materials, etc.). - """ - # Clear existing test screenshots before starting test. - screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH) - test_screenshots = [os.path.join(screenshot_directory, screenshot_name)] - file_system.delete(test_screenshots, True, True) - - golden_images = [os.path.join(golden_images_directory(), screenshot_name)] - - level_creation_expected_lines = [ - "Viewport is set to the expected size: True", - "Exited game mode" - ] - unexpected_lines = ["Traceback (most recent call last):"] - - hydra.launch_and_validate_results( - request, - TEST_DIRECTORY, - editor, - "hydra_GPUTest_BasicLevelSetup.py", - timeout=180, - expected_lines=level_creation_expected_lines, - unexpected_lines=unexpected_lines, - halt_on_unexpected=True, - cfg_args=[level], - null_renderer=False, - ) - - similarity_threshold = 0.99 - for test_screenshot, golden_image in zip(test_screenshots, golden_images): - screenshot_comparison_result = compare_screenshot_similarity( - test_screenshot, golden_image, similarity_threshold, True, screenshot_directory) - if screenshot_comparison_result != "Screenshots match": - raise Exception(f"Screenshot test failed: {screenshot_comparison_result}") - @pytest.mark.test_case_id("C34525095") def test_LightComponent_ScreenshotMatchesGoldenImage( self, request, editor, workspace, project, launcher_platform, level): diff --git a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py index 568768e12e..2cb5828958 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main_GPU_Optimized.py @@ -11,12 +11,12 @@ import pytest import ly_test_tools.environment.file_system as file_system from ly_test_tools.o3de.editor_test import EditorSharedTest, EditorTestSuite from ly_test_tools.image.screenshot_compare_qssim import qssim as compare_screenshots -from .atom_utils.atom_component_helper import create_screenshots_archive, golden_images_directory +from .atom_utils.atom_component_helper import ( + create_screenshots_archive, compare_screenshot_to_golden_image, golden_images_directory) DEFAULT_SUBFOLDER_PATH = 'user/PythonTests/Automated/Screenshots' -@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") @pytest.mark.parametrize("project", ["AutomatedTesting"]) @pytest.mark.parametrize("launcher_platform", ['windows_editor']) class TestAutomation(EditorTestSuite): @@ -36,9 +36,44 @@ class TestAutomation(EditorTestSuite): test_screenshots = [os.path.join(screenshot_directory, self.screenshot_name)] file_system.delete(test_screenshots, True, True) + golden_images = [os.path.join(golden_images_directory(), screenshot_name)] + from Atom.tests import hydra_AtomGPU_BasicLevelSetup as test_module - golden_images = [os.path.join(golden_images_directory(), screenshot_name)] - for test_screenshot, golden_screenshot in zip(test_screenshots, golden_images): - compare_screenshots(test_screenshot, golden_screenshot) - create_screenshots_archive(screenshot_directory) + assert compare_screenshot_to_golden_image(screenshot_directory, test_screenshots, golden_images, 0.99) is True + + @pytest.mark.test_case_id("C34525095") + class AtomGPU_LightComponent_ScreenshotMatchesGoldenImage(EditorSharedTest): + use_null_renderer = False # Default is True + screenshot_names = [ + "AreaLight_1.ppm", + "AreaLight_2.ppm", + "AreaLight_3.ppm", + "AreaLight_4.ppm", + "AreaLight_5.ppm", + "SpotLight_1.ppm", + "SpotLight_2.ppm", + "SpotLight_3.ppm", + "SpotLight_4.ppm", + "SpotLight_5.ppm", + "SpotLight_6.ppm", + ] + test_screenshots = [] # Gets set by setup() + screenshot_directory = "" # Gets set by setup() + + # Clear existing test screenshots before starting test. + def setup(self, workspace): + screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH) + for screenshot in self.screenshot_names: + screenshot_path = os.path.join(screenshot_directory, screenshot) + self.test_screenshots.append(screenshot_path) + file_system.delete(self.test_screenshots, True, True) + + golden_images = [] + for golden_image in screenshot_names: + golden_image_path = os.path.join(golden_images_directory(), golden_image) + golden_images.append(golden_image_path) + + from Atom.tests import hydra_AtomGPU_LightComponentScreenshotsMatch as test_module + + assert compare_screenshot_to_golden_image(screenshot_directory, test_screenshots, golden_images, 0.99) is True diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py index 9f37873557..28ae72c2b3 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/atom_component_helper.py @@ -93,161 +93,179 @@ def compare_screenshot_similarity( return result -def create_basic_atom_level(level_name): +def compare_screenshot_to_golden_image( + screenshot_directory, test_screenshots, golden_images, similarity_threshold=0.99): """ - Creates a new level inside the Editor matching level_name & adds the following: - 1. "default_level" entity to hold all other entities. - 2. Adds Grid, Global Skylight (IBL), ground Mesh, Directional Light, Sphere w/ material+mesh, & Camera components. - 3. Each of these components has its settings tweaked slightly to match the ideal scene to test Atom rendering. - :param level_name: name of the level to create and apply this basic setup to. - :return: None + Compares a list of test_screenshots to a list of golden_images and return True if they match within the + similarity threshold set. Otherwise, it will raise ImageComparisonTestFailure with a failure message. + :param screenshot_directory: path to the directory containing screenshots for creating .zip archives. + :param test_screenshots: list of test screenshot path strings. + :param golden_images: list of golden image path strings. + :param similarity_threshold: float threshold tolerance to set when comparing screenshots to golden images. """ - import azlmbr.asset as asset - import azlmbr.bus as bus - import azlmbr.camera as camera - import azlmbr.editor as editor - import azlmbr.entity as entity - import azlmbr.legacy.general as general - import azlmbr.math as math - import azlmbr.object + for test_screenshot, golden_image in zip(test_screenshots, golden_images): + screenshot_comparison_result = compare_screenshot_similarity( + test_screenshot, golden_image, similarity_threshold, True, screenshot_directory) + if screenshot_comparison_result != "Screenshots match": + raise ImageComparisonTestFailure(f"Screenshot test failed: {screenshot_comparison_result}") - import editor_python_test_tools.hydra_editor_utils as hydra - from editor_python_test_tools.editor_test_helper import EditorTestHelper + return True - helper = EditorTestHelper(log_prefix="Atom_EditorTestHelper") - - # Wait for Editor idle loop before executing Python hydra scripts. - general.idle_enable(True) - - # Basic setup for opened level. - helper.open_level(level_name="Base") - general.idle_wait(1.0) - general.update_viewport() - general.idle_wait(0.5) # half a second is more than enough for updating the viewport. - - # Close out problematic windows, FPS meters, and anti-aliasing. - if general.is_helpers_shown(): # Turn off the helper gizmos if visible - general.toggle_helpers() - general.idle_wait(1.0) - if general.is_pane_visible("Error Report"): # Close Error Report windows that block focus. - general.close_pane("Error Report") - if general.is_pane_visible("Error Log"): # Close Error Log windows that block focus. - general.close_pane("Error Log") - general.idle_wait(1.0) - general.run_console("r_displayInfo=0") - general.idle_wait(1.0) - - # Delete all existing entities & create default_level entity - search_filter = azlmbr.entity.SearchFilter() - all_entities = entity.SearchBus(azlmbr.bus.Broadcast, "SearchEntities", search_filter) - editor.ToolsApplicationRequestBus(bus.Broadcast, "DeleteEntities", all_entities) - default_level = hydra.Entity("default_level") - default_position = math.Vector3(0.0, 0.0, 0.0) - default_level.create_entity(default_position, ["Grid"]) - default_level.get_set_test(0, "Controller|Configuration|Secondary Grid Spacing", 1.0) - - # Set the viewport up correctly after adding the parent default_level entity. - screen_width = 1280 - screen_height = 720 - degree_radian_factor = 0.0174533 # Used by "Rotation" property for the Transform component. - general.set_viewport_size(screen_width, screen_height) - general.update_viewport() - helper.wait_for_condition( - function=lambda: helper.isclose(a=general.get_viewport_size().x, b=screen_width, rel_tol=0.1) - and helper.isclose(a=general.get_viewport_size().y, b=screen_height, rel_tol=0.1), - timeout_in_seconds=4.0 - ) - result = helper.isclose(a=general.get_viewport_size().x, b=screen_width, rel_tol=0.1) and helper.isclose( - a=general.get_viewport_size().y, b=screen_height, rel_tol=0.1) - general.log(general.get_viewport_size().x) - general.log(general.get_viewport_size().y) - general.log(general.get_viewport_size().z) - general.log(f"Viewport is set to the expected size: {result}") - general.log("Basic level created") - general.run_console("r_DisplayInfo = 0") - - # Create global_skylight entity and set the properties - global_skylight = hydra.Entity("global_skylight") - global_skylight.create_entity( - entity_position=default_position, - components=["HDRi Skybox", "Global Skylight (IBL)"], - parent_id=default_level.id) - global_skylight_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") - global_skylight_asset_value = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", global_skylight_asset_path, math.Uuid(), False) - global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_asset_value) - global_skylight.get_set_test(1, "Controller|Configuration|Diffuse Image", global_skylight_asset_value) - global_skylight.get_set_test(1, "Controller|Configuration|Specular Image", global_skylight_asset_value) - - # Create ground_plane entity and set the properties - ground_plane = hydra.Entity("ground_plane") - ground_plane.create_entity( - entity_position=default_position, - components=["Material"], - parent_id=default_level.id) - azlmbr.components.TransformBus(azlmbr.bus.Event, "SetLocalUniformScale", ground_plane.id, 32.0) - - # Work around to add the correct Atom Mesh component and asset. - mesh_type_id = azlmbr.globals.property.EditorMeshComponentTypeId - ground_plane.components.append( - editor.EditorComponentAPIBus( - bus.Broadcast, "AddComponentsOfType", ground_plane.id, [mesh_type_id] - ).GetValue()[0] - ) - ground_plane_mesh_asset_path = os.path.join("TestData", "Objects", "plane.azmodel") - ground_plane_mesh_asset_value = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", ground_plane_mesh_asset_path, math.Uuid(), False) - ground_plane.get_set_test(1, "Controller|Configuration|Mesh Asset", ground_plane_mesh_asset_value) - - # Add Atom Material component and asset. - ground_plane_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_chrome.azmaterial") - ground_plane_material_asset_value = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", ground_plane_material_asset_path, math.Uuid(), False) - ground_plane.get_set_test(0, "Default Material|Material Asset", ground_plane_material_asset_value) - - # Create directional_light entity and set the properties - directional_light = hydra.Entity("directional_light") - directional_light.create_entity( - entity_position=math.Vector3(0.0, 0.0, 10.0), - components=["Directional Light"], - parent_id=default_level.id) - directional_light_rotation = math.Vector3(degree_radian_factor * -90.0, 0.0, 0.0) - azlmbr.components.TransformBus( - azlmbr.bus.Event, "SetLocalRotation", directional_light.id, directional_light_rotation) - - # Create sphere entity and set the properties - sphere_entity = hydra.Entity("sphere") - sphere_entity.create_entity( - entity_position=math.Vector3(0.0, 0.0, 1.0), - components=["Material"], - parent_id=default_level.id) - - # Work around to add the correct Atom Mesh component and asset. - sphere_entity.components.append( - editor.EditorComponentAPIBus( - bus.Broadcast, "AddComponentsOfType", sphere_entity.id, [mesh_type_id] - ).GetValue()[0] - ) - sphere_mesh_asset_path = os.path.join("Models", "sphere.azmodel") - sphere_mesh_asset_value = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", sphere_mesh_asset_path, math.Uuid(), False) - sphere_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", sphere_mesh_asset_value) - - # Add Atom Material component and asset. - sphere_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_brass_polished.azmaterial") - sphere_material_asset_value = asset.AssetCatalogRequestBus( - bus.Broadcast, "GetAssetIdByPath", sphere_material_asset_path, math.Uuid(), False) - sphere_entity.get_set_test(0, "Default Material|Material Asset", sphere_material_asset_value) - - # Create camera component and set the properties - camera_entity = hydra.Entity("camera") - camera_entity.create_entity( - entity_position=math.Vector3(5.5, -12.0, 9.0), - components=["Camera"], - parent_id=default_level.id) - rotation = math.Vector3( - degree_radian_factor * -27.0, degree_radian_factor * -12.0, degree_radian_factor * 25.0 - ) - azlmbr.components.TransformBus(azlmbr.bus.Event, "SetLocalRotation", camera_entity.id, rotation) - camera_entity.get_set_test(0, "Controller|Configuration|Field of view", 60.0) - camera.EditorCameraViewRequestBus(azlmbr.bus.Event, "ToggleCameraAsActiveView", camera_entity.id) +# def create_basic_atom_level(level_name): +# """ +# Creates a new level inside the Editor matching level_name & adds the following: +# 1. "default_level" entity to hold all other entities. +# 2. Adds Grid, Global Skylight (IBL), ground Mesh, Directional Light, Sphere w/ material+mesh, & Camera components. +# 3. Each of these components has its settings tweaked slightly to match the ideal scene to test Atom rendering. +# :param level_name: name of the level to create and apply this basic setup to. +# :return: None +# """ +# import azlmbr.asset as asset +# import azlmbr.bus as bus +# import azlmbr.camera as camera +# import azlmbr.editor as editor +# import azlmbr.entity as entity +# import azlmbr.legacy.general as general +# import azlmbr.math as math +# import azlmbr.object +# +# import editor_python_test_tools.hydra_editor_utils as hydra +# from editor_python_test_tools.editor_test_helper import EditorTestHelper +# +# helper = EditorTestHelper(log_prefix="Atom_EditorTestHelper") +# +# # Wait for Editor idle loop before executing Python hydra scripts. +# general.idle_enable(True) +# +# # Basic setup for opened level. +# helper.open_level(level_name="Base") +# general.idle_wait(1.0) +# general.update_viewport() +# general.idle_wait(0.5) # half a second is more than enough for updating the viewport. +# +# # Close out problematic windows, FPS meters, and anti-aliasing. +# if general.is_helpers_shown(): # Turn off the helper gizmos if visible +# general.toggle_helpers() +# general.idle_wait(1.0) +# if general.is_pane_visible("Error Report"): # Close Error Report windows that block focus. +# general.close_pane("Error Report") +# if general.is_pane_visible("Error Log"): # Close Error Log windows that block focus. +# general.close_pane("Error Log") +# general.idle_wait(1.0) +# general.run_console("r_displayInfo=0") +# general.idle_wait(1.0) +# +# # Delete all existing entities & create default_level entity +# search_filter = azlmbr.entity.SearchFilter() +# all_entities = entity.SearchBus(azlmbr.bus.Broadcast, "SearchEntities", search_filter) +# editor.ToolsApplicationRequestBus(bus.Broadcast, "DeleteEntities", all_entities) +# default_level = hydra.Entity("default_level") +# default_position = math.Vector3(0.0, 0.0, 0.0) +# default_level.create_entity(default_position, ["Grid"]) +# default_level.get_set_test(0, "Controller|Configuration|Secondary Grid Spacing", 1.0) +# +# # Set the viewport up correctly after adding the parent default_level entity. +# screen_width = 1280 +# screen_height = 720 +# degree_radian_factor = 0.0174533 # Used by "Rotation" property for the Transform component. +# general.set_viewport_size(screen_width, screen_height) +# general.update_viewport() +# helper.wait_for_condition( +# function=lambda: helper.isclose(a=general.get_viewport_size().x, b=screen_width, rel_tol=0.1) +# and helper.isclose(a=general.get_viewport_size().y, b=screen_height, rel_tol=0.1), +# timeout_in_seconds=4.0 +# ) +# result = helper.isclose(a=general.get_viewport_size().x, b=screen_width, rel_tol=0.1) and helper.isclose( +# a=general.get_viewport_size().y, b=screen_height, rel_tol=0.1) +# general.log(general.get_viewport_size().x) +# general.log(general.get_viewport_size().y) +# general.log(general.get_viewport_size().z) +# general.log(f"Viewport is set to the expected size: {result}") +# general.log("Basic level created") +# general.run_console("r_DisplayInfo = 0") +# +# # Create global_skylight entity and set the properties +# global_skylight = hydra.Entity("global_skylight") +# global_skylight.create_entity( +# entity_position=default_position, +# components=["HDRi Skybox", "Global Skylight (IBL)"], +# parent_id=default_level.id) +# global_skylight_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") +# global_skylight_asset_value = asset.AssetCatalogRequestBus( +# bus.Broadcast, "GetAssetIdByPath", global_skylight_asset_path, math.Uuid(), False) +# global_skylight.get_set_test(0, "Controller|Configuration|Cubemap Texture", global_skylight_asset_value) +# global_skylight.get_set_test(1, "Controller|Configuration|Diffuse Image", global_skylight_asset_value) +# global_skylight.get_set_test(1, "Controller|Configuration|Specular Image", global_skylight_asset_value) +# +# # Create ground_plane entity and set the properties +# ground_plane = hydra.Entity("ground_plane") +# ground_plane.create_entity( +# entity_position=default_position, +# components=["Material"], +# parent_id=default_level.id) +# azlmbr.components.TransformBus(azlmbr.bus.Event, "SetLocalUniformScale", ground_plane.id, 32.0) +# +# # Work around to add the correct Atom Mesh component and asset. +# mesh_type_id = azlmbr.globals.property.EditorMeshComponentTypeId +# ground_plane.components.append( +# editor.EditorComponentAPIBus( +# bus.Broadcast, "AddComponentsOfType", ground_plane.id, [mesh_type_id] +# ).GetValue()[0] +# ) +# ground_plane_mesh_asset_path = os.path.join("TestData", "Objects", "plane.azmodel") +# ground_plane_mesh_asset_value = asset.AssetCatalogRequestBus( +# bus.Broadcast, "GetAssetIdByPath", ground_plane_mesh_asset_path, math.Uuid(), False) +# ground_plane.get_set_test(1, "Controller|Configuration|Mesh Asset", ground_plane_mesh_asset_value) +# +# # Add Atom Material component and asset. +# ground_plane_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_chrome.azmaterial") +# ground_plane_material_asset_value = asset.AssetCatalogRequestBus( +# bus.Broadcast, "GetAssetIdByPath", ground_plane_material_asset_path, math.Uuid(), False) +# ground_plane.get_set_test(0, "Default Material|Material Asset", ground_plane_material_asset_value) +# +# # Create directional_light entity and set the properties +# directional_light = hydra.Entity("directional_light") +# directional_light.create_entity( +# entity_position=math.Vector3(0.0, 0.0, 10.0), +# components=["Directional Light"], +# parent_id=default_level.id) +# directional_light_rotation = math.Vector3(degree_radian_factor * -90.0, 0.0, 0.0) +# azlmbr.components.TransformBus( +# azlmbr.bus.Event, "SetLocalRotation", directional_light.id, directional_light_rotation) +# +# # Create sphere entity and set the properties +# sphere_entity = hydra.Entity("sphere") +# sphere_entity.create_entity( +# entity_position=math.Vector3(0.0, 0.0, 1.0), +# components=["Material"], +# parent_id=default_level.id) +# +# # Work around to add the correct Atom Mesh component and asset. +# sphere_entity.components.append( +# editor.EditorComponentAPIBus( +# bus.Broadcast, "AddComponentsOfType", sphere_entity.id, [mesh_type_id] +# ).GetValue()[0] +# ) +# sphere_mesh_asset_path = os.path.join("Models", "sphere.azmodel") +# sphere_mesh_asset_value = asset.AssetCatalogRequestBus( +# bus.Broadcast, "GetAssetIdByPath", sphere_mesh_asset_path, math.Uuid(), False) +# sphere_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", sphere_mesh_asset_value) +# +# # Add Atom Material component and asset. +# sphere_material_asset_path = os.path.join("Materials", "Presets", "PBR", "metal_brass_polished.azmaterial") +# sphere_material_asset_value = asset.AssetCatalogRequestBus( +# bus.Broadcast, "GetAssetIdByPath", sphere_material_asset_path, math.Uuid(), False) +# sphere_entity.get_set_test(0, "Default Material|Material Asset", sphere_material_asset_value) +# +# # Create camera component and set the properties +# camera_entity = hydra.Entity("camera") +# camera_entity.create_entity( +# entity_position=math.Vector3(5.5, -12.0, 9.0), +# components=["Camera"], +# parent_id=default_level.id) +# rotation = math.Vector3( +# degree_radian_factor * -27.0, degree_radian_factor * -12.0, degree_radian_factor * 25.0 +# ) +# azlmbr.components.TransformBus(azlmbr.bus.Event, "SetLocalRotation", camera_entity.id, rotation) +# camera_entity.get_set_test(0, "Controller|Configuration|Field of view", 60.0) +# camera.EditorCameraViewRequestBus(azlmbr.bus.Event, "ToggleCameraAsActiveView", camera_entity.id) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_LightComponentScreenshotsMatch.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomGPU_LightComponentScreenshotsMatch.py new file mode 100644 index 0000000000..e69de29bb2