SkinnedMotionVector.bv.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 = 'SkinnedMotionVector'
  13. Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder .. g_testCaseFolder))
  14. function TestDelayedCapture(atTime, screenshotFileName)
  15. SetImguiValue('Reset Clock', true)
  16. IdleSeconds(atTime)
  17. CaptureScreenshotWithPreview(g_testCaseFolder .. '/' .. screenshotFileName)
  18. IdleFrames(1)
  19. end
  20. OpenSample('Features/SkinnedMesh')
  21. ResizeViewport(1920, 1080)
  22. NoClipCameraController_SetPitch(DegToRad(-30))
  23. SetImguiValue('Draw bones', false)
  24. SelectImageComparisonToleranceLevel("Level E")
  25. -- Show the pass tree tool and enable preview image attachment so we can capture the motion vector image
  26. ShowTool('PassTree', true)
  27. SetImguiValue('Show Pass Attachments', true)
  28. SetImguiValue('Preview Attachment', true)
  29. SetImguiValue('Color Range', Vector2(0.0, 0.01)) -- Use a constrained color range so small values will show up better
  30. SetImguiValue('MeshMotionVectorPass/[InputOutput] [MotionInputOutput] [Image] CameraMotion [R16G16_FLOAT] [1920x1080]', true)
  31. IdleFrames(1) -- Wait one frame to apply imgui change
  32. -- We need to lock the frame time to get deterministic timing of the screenshots for consistency between runs
  33. LockFrameTime(1/100)
  34. SetShowImGui(false)
  35. IdleFrames(1)
  36. -- capture image attachment previews at different points in the animation
  37. TestDelayedCapture(0.2, 'MotionVector1.png')
  38. TestDelayedCapture(1.5, 'MotionVector2.png')
  39. TestDelayedCapture(2.3, 'MotionVector3.png')
  40. SetShowImGui(true)
  41. -- Hide the pass tree tool
  42. SetImguiValue('Color Range', Vector2(0.0, 1.0))
  43. IdleFrames(1) -- Make sure Color Range is applied before hiding Preview Attachment
  44. SetImguiValue('Preview Attachment', false)
  45. SetImguiValue('Show Pass Attachments', false)
  46. IdleFrames(1) -- Wait one frame to apply imgui change
  47. ShowTool('PassTree', false)
  48. UnlockFrameTime()
  49. OpenSample(nil)