multi-splat.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import type { Scene } from "./_helpers";
  2. export const multiSplat: Scene = {
  3. name: "Multi-Splat Gallery",
  4. description: "Multiple gaussian splats arranged in a gallery with spotlights",
  5. spec: {
  6. root: "scene",
  7. elements: {
  8. scene: {
  9. type: "Group",
  10. props: { position: null, rotation: null, scale: null },
  11. children: [
  12. "camera",
  13. "ambient",
  14. "spot-left",
  15. "spot-right",
  16. "splat-left",
  17. "splat-right",
  18. "grid",
  19. "fog",
  20. "controls",
  21. ],
  22. },
  23. camera: {
  24. type: "PerspectiveCamera",
  25. props: {
  26. position: [0, 3, 8],
  27. rotation: null,
  28. scale: null,
  29. fov: 50,
  30. near: null,
  31. far: null,
  32. makeDefault: true,
  33. },
  34. children: [],
  35. },
  36. ambient: {
  37. type: "AmbientLight",
  38. props: { color: "#e0e0ff", intensity: 0.2 },
  39. children: [],
  40. },
  41. "spot-left": {
  42. type: "SpotLight",
  43. props: {
  44. position: [-3, 6, 2],
  45. rotation: null,
  46. scale: null,
  47. color: "#ffddaa",
  48. intensity: 60,
  49. distance: 15,
  50. decay: null,
  51. angle: 0.5,
  52. penumbra: 0.8,
  53. castShadow: true,
  54. },
  55. children: [],
  56. },
  57. "spot-right": {
  58. type: "SpotLight",
  59. props: {
  60. position: [3, 6, 2],
  61. rotation: null,
  62. scale: null,
  63. color: "#aaddff",
  64. intensity: 60,
  65. distance: 15,
  66. decay: null,
  67. angle: 0.5,
  68. penumbra: 0.8,
  69. castShadow: true,
  70. },
  71. children: [],
  72. },
  73. "splat-left": {
  74. type: "GaussianSplat",
  75. props: {
  76. src: "https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/bonsai/bonsai-7k.splat",
  77. position: [-3, 0, 0],
  78. rotation: null,
  79. scale: [0.8, 0.8, 0.8],
  80. castShadow: null,
  81. receiveShadow: null,
  82. alphaHash: null,
  83. toneMapped: null,
  84. visible: true,
  85. },
  86. children: [],
  87. },
  88. "splat-right": {
  89. type: "GaussianSplat",
  90. props: {
  91. src: "https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/garden/garden-7k.splat",
  92. position: [3, 0, 0],
  93. rotation: null,
  94. scale: [0.8, 0.8, 0.8],
  95. castShadow: null,
  96. receiveShadow: null,
  97. alphaHash: null,
  98. toneMapped: null,
  99. visible: true,
  100. },
  101. children: [],
  102. },
  103. grid: {
  104. type: "GridHelper",
  105. props: {
  106. position: [0, -0.5, 0],
  107. rotation: null,
  108. scale: null,
  109. size: 30,
  110. divisions: 30,
  111. color: "#222222",
  112. secondaryColor: "#111111",
  113. },
  114. children: [],
  115. },
  116. fog: {
  117. type: "Fog",
  118. props: {
  119. color: "#0a0a0a",
  120. near: 8,
  121. far: 25,
  122. },
  123. children: [],
  124. },
  125. controls: {
  126. type: "OrbitControls",
  127. props: {
  128. enableDamping: true,
  129. dampingFactor: null,
  130. enableZoom: null,
  131. enablePan: null,
  132. enableRotate: null,
  133. minDistance: 3,
  134. maxDistance: 18,
  135. minPolarAngle: 0.3,
  136. maxPolarAngle: 1.4,
  137. autoRotate: true,
  138. autoRotateSpeed: 0.3,
  139. target: [0, 0.5, 0],
  140. },
  141. children: [],
  142. },
  143. },
  144. },
  145. };