LightCulling.bv.lua 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. function ResetEntityCounts()
  13. SetImguiValue('Point Lights/Point light count', 0)
  14. SetImguiValue('Decals/Decal count', 0)
  15. SetImguiValue('Disk Lights/Disk light count', 0)
  16. SetImguiValue('Capsule Lights/Capsule light count', 0)
  17. SetImguiValue('Quad Lights/Quad light count', 0)
  18. end
  19. function TakeScreenshotPointLights()
  20. ResetEntityCounts()
  21. NoClipCameraController_SetPosition(Vector3(9.323411, 1.602668, 1.573688))
  22. NoClipCameraController_SetHeading(DegToRad(102.822502))
  23. NoClipCameraController_SetPitch(DegToRad(13.369015))
  24. NoClipCameraController_SetFov(DegToRad(90))
  25. SetImguiValue('Point Lights/Point light count', 75)
  26. SetImguiValue('Point Lights/Bulb Radius', 2)
  27. SetImguiValue('Point Lights/Point Intensity', 55)
  28. IdleFrames(1)
  29. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_pointlights.png')
  30. end
  31. function TakeScreenshotDiskLights()
  32. ResetEntityCounts()
  33. NoClipCameraController_SetFov(DegToRad(90))
  34. SetImguiValue('Disk Lights/Disk light count', 200)
  35. IdleFrames(1)
  36. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_disklights.png')
  37. end
  38. function TakeScreenshotCapsuleLights()
  39. ResetEntityCounts()
  40. NoClipCameraController_SetFov(DegToRad(90))
  41. SetImguiValue('Capsule Lights/Capsule light count', 200)
  42. IdleFrames(1)
  43. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_capsulelights.png')
  44. end
  45. function TakeScreenshotQuadLights()
  46. ResetEntityCounts()
  47. NoClipCameraController_SetFov(DegToRad(90))
  48. SetImguiValue('Quad Lights/Quad light count', 50)
  49. SetImguiValue('Quad Lights/Quad Attenuation Radius', 15)
  50. SetImguiValue('Quad Lights/Quad light width', 10)
  51. SetImguiValue('Quad Lights/Quad light height', 5)
  52. IdleFrames(1)
  53. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_quadlights.png')
  54. end
  55. function TakeScreenshotDecals()
  56. ResetEntityCounts()
  57. NoClipCameraController_SetFov(DegToRad(90))
  58. SetImguiValue('Decals/Decal count', 200)
  59. IdleFrames(1)
  60. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_decals.png')
  61. end
  62. function TakeScreenShotLookingStraightDown()
  63. ResetEntityCounts()
  64. NoClipCameraController_SetPosition(Vector3(0, 0, 5))
  65. NoClipCameraController_SetHeading(DegToRad(0.0))
  66. NoClipCameraController_SetPitch(DegToRad(-90.0))
  67. NoClipCameraController_SetFov(DegToRad(90))
  68. SetImguiValue('Point Lights/Point light count', 50)
  69. SetImguiValue('Point Lights/Point Intensity', 200)
  70. IdleFrames(1)
  71. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_lookingdown.png')
  72. end
  73. function EnableOnlyTestHeatmap()
  74. -- By setting the heatmap to 100% we can test the culling and culling only.
  75. -- Without this, we could also be pickup up shading issues, something that can be tested by other samples
  76. SetImguiValue('Heatmap/Opacity', 1.0)
  77. end
  78. g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/' .. g_testEnv .. '/LightCulling/')
  79. Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
  80. SelectImageComparisonToleranceLevel("Level E")
  81. OpenSample('Features/LightCulling')
  82. ResizeViewport(1600, 900)
  83. EnableOnlyTestHeatmap()
  84. TakeScreenshotPointLights()
  85. TakeScreenshotDiskLights()
  86. TakeScreenshotCapsuleLights()
  87. TakeScreenshotQuadLights()
  88. TakeScreenshotDecals()
  89. TakeScreenShotLookingStraightDown()
  90. OpenSample(nil)