LightCulling.bv.lua 3.7 KB

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