splat-postfx.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import type { Scene } from "./_helpers";
  2. export const splatPostFx: Scene = {
  3. name: "Splat + Post-Processing",
  4. description:
  5. "A gaussian splat with bloom and vignette post-processing effects",
  6. spec: {
  7. root: "scene",
  8. elements: {
  9. scene: {
  10. type: "Group",
  11. props: { position: null, rotation: null, scale: null },
  12. children: [
  13. "camera",
  14. "env",
  15. "ambient",
  16. "key-light",
  17. "splat",
  18. "grid",
  19. "fx",
  20. "controls",
  21. ],
  22. },
  23. camera: {
  24. type: "PerspectiveCamera",
  25. props: {
  26. position: [3, 2, 5],
  27. rotation: null,
  28. scale: null,
  29. fov: 50,
  30. near: null,
  31. far: null,
  32. makeDefault: true,
  33. },
  34. children: [],
  35. },
  36. env: {
  37. type: "Environment",
  38. props: {
  39. preset: "night",
  40. background: false,
  41. blur: 0.8,
  42. intensity: 0.4,
  43. },
  44. children: [],
  45. },
  46. ambient: {
  47. type: "AmbientLight",
  48. props: { color: "#ccccff", intensity: 0.2 },
  49. children: [],
  50. },
  51. "key-light": {
  52. type: "PointLight",
  53. props: {
  54. position: [3, 5, 3],
  55. rotation: null,
  56. scale: null,
  57. color: "#ffeecc",
  58. intensity: 30,
  59. distance: 20,
  60. decay: null,
  61. castShadow: null,
  62. },
  63. children: [],
  64. },
  65. splat: {
  66. type: "GaussianSplat",
  67. props: {
  68. src: "https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/bonsai/bonsai-7k.splat",
  69. position: [0, 0, 0],
  70. rotation: null,
  71. scale: [1, 1, 1],
  72. castShadow: null,
  73. receiveShadow: null,
  74. alphaHash: null,
  75. toneMapped: null,
  76. visible: true,
  77. },
  78. children: [],
  79. },
  80. grid: {
  81. type: "GridHelper",
  82. props: {
  83. position: [0, -0.5, 0],
  84. rotation: null,
  85. scale: null,
  86. size: 20,
  87. divisions: 20,
  88. color: "#222222",
  89. secondaryColor: "#111111",
  90. },
  91. children: [],
  92. },
  93. fx: {
  94. type: "EffectComposer",
  95. props: { enabled: true, multisampling: 8 },
  96. children: ["bloom", "vignette"],
  97. },
  98. bloom: {
  99. type: "Bloom",
  100. props: {
  101. intensity: 0.8,
  102. luminanceThreshold: 0.2,
  103. luminanceSmoothing: 0.5,
  104. mipmapBlur: true,
  105. },
  106. children: [],
  107. },
  108. vignette: {
  109. type: "Vignette",
  110. props: { offset: 0.25, darkness: 0.7 },
  111. children: [],
  112. },
  113. controls: {
  114. type: "OrbitControls",
  115. props: {
  116. enableDamping: true,
  117. dampingFactor: null,
  118. enableZoom: null,
  119. enablePan: null,
  120. enableRotate: null,
  121. minDistance: 2,
  122. maxDistance: 12,
  123. minPolarAngle: 0.3,
  124. maxPolarAngle: 1.5,
  125. autoRotate: true,
  126. autoRotateSpeed: 0.5,
  127. target: [0, 0.5, 0],
  128. },
  129. children: [],
  130. },
  131. },
  132. },
  133. };