MultiRenderPipeline.bv.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 = 'MultiRenderPipeline'
  13. Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
  14. function TakeScreenShotForWindow1(fileName)
  15. IdleFrames(1)
  16. CaptureScreenshot(g_testCaseFolder .. '/' .. fileName)
  17. end
  18. function TakeScreenShotForWindow2(fileName)
  19. IdleFrames(1)
  20. SetShowImGui(false)
  21. CapturePassAttachment({"SecondPipeline", "CopyToSwapChain"}, "Output", g_testCaseFolder .. '/' .. fileName)
  22. SetShowImGui(true)
  23. end
  24. function WaitForDepthOfFieldFocus()
  25. -- dof requires some time to focus
  26. IdleSeconds(2)
  27. end
  28. OpenSample('RPI/MultiRenderPipeline')
  29. ResizeViewport(800, 600)
  30. NoClipCameraController_SetFov(DegToRad(21.358959))
  31. NoClipCameraController_SetPosition(Vector3(-7.576071, 13.286152, 2.185254))
  32. NoClipCameraController_SetHeading(DegToRad(-149.923874))
  33. NoClipCameraController_SetPitch(DegToRad(-4.615502))
  34. SelectImageComparisonToleranceLevel("Level E")
  35. -- start window
  36. WaitForDepthOfFieldFocus()
  37. TakeScreenShotForWindow1('Start_window1.png')
  38. TakeScreenShotForWindow2('Start_window2.png')
  39. -- use second camera for second window.
  40. -- Wait for DOF stablized every time camera changes
  41. SetImguiValue('Use second camera', true)
  42. WaitForDepthOfFieldFocus()
  43. TakeScreenShotForWindow1('TwoCameras_window1.png')
  44. TakeScreenShotForWindow2('TwoCameras_window2.png')
  45. -- Disable DOF only
  46. SetImguiValue('Enable Depth of Field', false)
  47. WaitForDepthOfFieldFocus()
  48. TakeScreenShotForWindow1('NoDOF_window1.png')
  49. TakeScreenShotForWindow2('NoDOF_window2.png')
  50. -- Disable DOF only
  51. SetImguiValue('Enable Depth of Field', true)
  52. WaitForDepthOfFieldFocus()
  53. TakeScreenShotForWindow1('WithDOF_window1.png')
  54. TakeScreenShotForWindow2('WithDOF_window2.png')
  55. -- disable all the features
  56. SetImguiValue('Enable Depth of Field', false)
  57. SetImguiValue('Add/Remove Directional Light', false)
  58. SetImguiValue('Add/Remove Spot Light', false)
  59. SetImguiValue('Enable Skybox', false)
  60. SetImguiValue('Add/Remove IBL', false)
  61. TakeScreenShotForWindow1('NoFeatures_window1.png')
  62. TakeScreenShotForWindow2('NoFeatures_window2.png')
  63. -- Relax for NVIDIA Titan X (DX12)
  64. SelectImageComparisonToleranceLevel("Level F")
  65. -- IBL only
  66. SetImguiValue('Add/Remove IBL', true)
  67. -- IBL takes some frames to apply
  68. IdleFrames(5)
  69. TakeScreenShotForWindow1('IBL_window1.png')
  70. TakeScreenShotForWindow2('IBL_window2.png')
  71. -- Set the level back to E because NVIDIA Titan X passes with E
  72. SelectImageComparisonToleranceLevel("Level E")
  73. -- Add skybox
  74. SetImguiValue('Enable Skybox', true)
  75. TakeScreenShotForWindow1('IBL_Skybox_window1.png')
  76. TakeScreenShotForWindow2('IBL_Skybox_window2.png')
  77. -- Add spot light
  78. SetImguiValue('Add/Remove Spot Light', true)
  79. TakeScreenShotForWindow1('IBL_Skybox_Spot_window1.png')
  80. TakeScreenShotForWindow2('IBL_Skybox_Spot_window2.png')
  81. -- Add directional light
  82. SetImguiValue('Add/Remove Directional Light', true)
  83. TakeScreenShotForWindow1('IBL_Skybox_Spot_Dir_window1.png')
  84. TakeScreenShotForWindow2('IBL_Skybox_Spot_Dir_window2.png')
  85. -- Enable DOF
  86. SetImguiValue('Enable Depth of Field', true)
  87. WaitForDepthOfFieldFocus()
  88. TakeScreenShotForWindow1('IBL_Skybox_Spot_Dir_DOF_window1.png')
  89. TakeScreenShotForWindow2('IBL_Skybox_Spot_Dir_DOF_window2.png')
  90. OpenSample(nil)