PassTree.bv.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/PassTree/')
  12. Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
  13. -- Select an attachment; take a screenshot with preview output (used for screenshot comparison); capture and save the attachment.
  14. -- Note: each imgui value need 1 frame to apply the value.
  15. function TestAttachment(attachmentName, screenshotFileName)
  16. SetImguiValue(attachmentName, true)
  17. IdleFrames(2)
  18. CaptureScreenshotWithPreview(g_screenshotOutputFolder .. screenshotFileName)
  19. IdleFrames(1)
  20. SetImguiValue('Save Attachment', true)
  21. IdleFrames(3)
  22. end
  23. -- Test PassTree tool with shading sample
  24. OpenSample('RPI/Mesh')
  25. ResizeViewport(800, 600)
  26. SelectImageComparisonToleranceLevel("Level G")
  27. -- choose model, material and lighting
  28. SetImguiValue('Models/##Available', 'objects/shaderball_simple.azmodel')
  29. SetImguiValue('Enable Material Override', true)
  30. SetImguiValue('Materials/##Available', 'materials/defaultpbr.azmaterial')
  31. SetImguiValue('Lighting Preset##SampleBase/Thumbnail', true)
  32. -- set camera transform
  33. ArcBallCameraController_SetHeading(DegToRad(144.671860))
  34. ArcBallCameraController_SetPitch(DegToRad(-17.029560))
  35. ArcBallCameraController_SetDistance(6.590300)
  36. -- Show the tool and enable preview image attachment
  37. ShowTool('PassTree', true)
  38. SetImguiValue('Show Pass Attachments', true)
  39. SetImguiValue('Preview Attachment', true)
  40. SetShowImGui(false)
  41. -- capture image attachment previews and capture them for different formats
  42. TestAttachment('ForwardMSAAPass/[Input] [BRDFTextureInput] [Image] BRDFTexture [R16G16_FLOAT] [256x256]', 'brdf.png')
  43. TestAttachment('ForwardMSAAPass/[Output] [AlbedoOutput] [Image] AlbedoImage [R8G8B8A8_UNORM] [800x600] [MSAA_4x]', 'albedo.png')
  44. TestAttachment('MSAAResolveDepthPass/[Input] [Input] [Image] DepthStencil [D32_FLOAT_S8X24_UINT] [800x600] [MSAA_4x]', 'depthStencilMs.png')
  45. TestAttachment('MSAAResolveDepthPass/[Output] [Output] [Image] ResolvedDepthOutput [D32_FLOAT_S8X24_UINT] [800x600]', 'depthStencilResolve.png')
  46. TestAttachment('DepthDownsample/[Input] [FullResDepth] [Image] LinearDepth [R32_FLOAT] [800x600]', 'linearDepth.png')
  47. TestAttachment('MSAAResolveSpecularPass/[Output] [Output] [Image] ResolvedOutput [R16G16B16A16_FLOAT] [800x600]', 'specularResolved.png')
  48. SetShowImGui(true)
  49. -- Hide the tool
  50. SetImguiValue('Preview Attachment', false)
  51. SetImguiValue('Show Pass Attachments', false)
  52. IdleFrames(1) -- Wait one frame to apply imgui change
  53. ShowTool('PassTree', false)
  54. OpenSample(nil)