SsrEffect.qml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright (C) 2025 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
  3. import QtQuick
  4. import QtQuick3D
  5. import QtQuick3D.Helpers.impl
  6. SsrEnvEffect {
  7. id: ssrEffect
  8. // Global
  9. property real roughnessCut: 0.65
  10. // Main pass
  11. property real stepSize: 0.01
  12. property real minRayStep: 0.01
  13. property int binarySteps: 8
  14. property int maxSteps: 512
  15. property real baseThickness: 20
  16. readonly property TextureInput ssrSampler: TextureInput { texture: Texture {} }
  17. readonly property TextureInput ssrMaskSampler: TextureInput { texture: Texture {} }
  18. readonly property TextureInput ssrReflConfSampler: TextureInput { texture: Texture {} }
  19. Buffer {
  20. id: ssrBufferMask
  21. name: "ssrBufferMask"
  22. sizeMultiplier: 1.0
  23. format: Buffer.RGBA32F
  24. }
  25. Buffer {
  26. id: ssrBufferMainReflColorConf
  27. name: "ssrBufferMainReflColorConf"
  28. sizeMultiplier: 1.0
  29. format: Buffer.RGBA32F
  30. }
  31. Pass {
  32. id: ssrMaskPass
  33. output: ssrBufferMask
  34. shaders: Shader { stage: Shader.Fragment; shader: "qrc:/qtquick3d_helpers/shaders/ssr_mask.frag" }
  35. }
  36. Pass {
  37. id: ssrMainPass
  38. output: ssrBufferMainReflColorConf
  39. shaders: [
  40. Shader {
  41. stage: Shader.Fragment
  42. shader: "qrc:/qtquick3d_helpers/shaders/ssr_main.frag"
  43. }
  44. ]
  45. commands: [
  46. BufferInput { buffer: ssrBufferMask; sampler: "ssrMaskSampler" }
  47. ]
  48. }
  49. Pass {
  50. id: ssrCompositionPass
  51. shaders: [
  52. Shader {
  53. stage: Shader.Fragment
  54. shader: "qrc:/qtquick3d_helpers/shaders/ssr_composition.frag"
  55. }
  56. ]
  57. commands: [
  58. BufferInput { buffer: ssrBufferMainReflColorConf; sampler: "ssrSampler" }
  59. ]
  60. }
  61. passes: [
  62. ssrMaskPass, ssrMainPass, ssrCompositionPass
  63. ]
  64. }