PassTree.bv.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ----------------------------------------------------------------------------------------------------
  2. --
  3. -- Copyright (c) Contributors to the Open 3D Engine Project.
  4. -- For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. --
  6. -- SPDX-License-Identifier: Apache-2.0 OR MIT
  7. --
  8. --
  9. --
  10. ----------------------------------------------------------------------------------------------------
  11. RunScript("scripts/TestEnvironment.luac")
  12. g_testCaseFolder = 'PassTree'
  13. Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
  14. -- Select an attachment; take a screenshot with preview output (used for screenshot comparison); capture and save the attachment.
  15. -- Note: each imgui value need 1 frame to apply the value.
  16. function TestAttachment(attachmentName, screenshotFileName)
  17. SetImguiValue(attachmentName, true)
  18. IdleFrames(2)
  19. CaptureScreenshotWithPreview(g_testCaseFolder .. '/' .. screenshotFileName)
  20. IdleFrames(1)
  21. SetImguiValue('Save Attachment', true)
  22. IdleFrames(3)
  23. end
  24. -- Test PassTree tool with shading sample
  25. OpenSample('RPI/Mesh')
  26. ResizeViewport(800, 600)
  27. SelectImageComparisonToleranceLevel("Level G")
  28. -- choose model, material and lighting
  29. SetImguiValue('Models/##Available', 'objects/shaderball_simple.azmodel')
  30. SetImguiValue('Enable Material Override', true)
  31. SetImguiValue('Materials/##Available', 'materials/defaultpbr.azmaterial')
  32. SetImguiValue('Lighting Preset##SampleBase/Thumbnail', true)
  33. -- set camera transform
  34. ArcBallCameraController_SetHeading(DegToRad(144.671860))
  35. ArcBallCameraController_SetPitch(DegToRad(-17.029560))
  36. ArcBallCameraController_SetDistance(6.590300)
  37. -- Show the tool and enable preview image attachment
  38. ShowTool('PassTree', true)
  39. SetImguiValue('Show Pass Attachments', true)
  40. SetImguiValue('Preview Attachment', true)
  41. SetShowImGui(false)
  42. -- capture image attachment previews and capture them for different formats
  43. TestAttachment('Forward/[InputOutput] [DepthStencilInputOutput] [Image] DepthStencil [D32_FLOAT_S8X24_UINT] [800x600]', 'depth.png')
  44. TestAttachment('Forward/[Output] [AlbedoOutput] [Image] AlbedoImage [R8G8B8A8_UNORM] [800x600]', 'albedo.png')
  45. TestAttachment('Forward/[Output] [DiffuseOutput] [Image] DiffuseImage [R16G16B16A16_FLOAT] [800x600]', 'diffuse.png')
  46. TestAttachment('DepthDownsample/[Input] [FullResDepth] [Image] LinearDepth [R32_FLOAT] [800x600]', 'linearDepth.png')
  47. TestAttachment('Forward/[Input] [BRDFTextureInput] [Image] BRDFTexture [R16G16_FLOAT] [256x256]', 'brdf.png')
  48. --Root/RPISamplePipeline/
  49. SetShowImGui(true)
  50. -- Hide the tool
  51. SetImguiValue('Preview Attachment', false)
  52. SetImguiValue('Show Pass Attachments', false)
  53. IdleFrames(1) -- Wait one frame to apply imgui change
  54. ShowTool('PassTree', false)
  55. OpenSample(nil)