floating-splat.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import type { Scene } from "./_helpers";
  2. export const floatingSplat: Scene = {
  3. name: "Floating Splat",
  4. description:
  5. "A gaussian splat wrapped in Float and Spin animation wrappers with sparkle particles",
  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. "fill-light",
  18. "float-wrapper",
  19. "sparkles",
  20. "grid",
  21. "controls",
  22. ],
  23. },
  24. camera: {
  25. type: "PerspectiveCamera",
  26. props: {
  27. position: [0, 2, 6],
  28. rotation: null,
  29. scale: null,
  30. fov: 45,
  31. near: null,
  32. far: null,
  33. makeDefault: true,
  34. },
  35. children: [],
  36. },
  37. env: {
  38. type: "Environment",
  39. props: {
  40. preset: "studio",
  41. background: false,
  42. blur: 0.5,
  43. intensity: 0.5,
  44. },
  45. children: [],
  46. },
  47. ambient: {
  48. type: "AmbientLight",
  49. props: { color: "#e0e0ff", intensity: 0.3 },
  50. children: [],
  51. },
  52. "key-light": {
  53. type: "DirectionalLight",
  54. props: {
  55. position: [5, 8, 3],
  56. rotation: null,
  57. scale: null,
  58. color: "#ffffff",
  59. intensity: 2,
  60. castShadow: true,
  61. },
  62. children: [],
  63. },
  64. "fill-light": {
  65. type: "PointLight",
  66. props: {
  67. position: [-3, 3, -2],
  68. rotation: null,
  69. scale: null,
  70. color: "#aaccff",
  71. intensity: 10,
  72. distance: 15,
  73. decay: null,
  74. castShadow: null,
  75. },
  76. children: [],
  77. },
  78. "float-wrapper": {
  79. type: "Float",
  80. props: {
  81. position: [0, 1, 0],
  82. rotation: null,
  83. scale: null,
  84. speed: 1.5,
  85. rotationIntensity: 0.2,
  86. floatIntensity: 0.5,
  87. enabled: true,
  88. },
  89. children: ["spin-wrapper"],
  90. },
  91. "spin-wrapper": {
  92. type: "Spin",
  93. props: {
  94. position: null,
  95. rotation: null,
  96. scale: null,
  97. speed: 0.2,
  98. axis: "y",
  99. },
  100. children: ["splat"],
  101. },
  102. splat: {
  103. type: "GaussianSplat",
  104. props: {
  105. src: "https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/stump/stump-7k.splat",
  106. position: [0, 0, 0],
  107. rotation: null,
  108. scale: [0.8, 0.8, 0.8],
  109. castShadow: null,
  110. receiveShadow: null,
  111. alphaHash: null,
  112. toneMapped: null,
  113. visible: true,
  114. },
  115. children: [],
  116. },
  117. sparkles: {
  118. type: "Sparkles",
  119. props: {
  120. position: [0, 1.5, 0],
  121. rotation: null,
  122. scale: [6, 4, 6],
  123. count: 40,
  124. speed: 0.08,
  125. opacity: 0.2,
  126. color: "#ffffff",
  127. size: 0.4,
  128. noise: 0.5,
  129. },
  130. children: [],
  131. },
  132. grid: {
  133. type: "GridHelper",
  134. props: {
  135. position: [0, -0.5, 0],
  136. rotation: null,
  137. scale: null,
  138. size: 20,
  139. divisions: 20,
  140. color: "#222222",
  141. secondaryColor: "#111111",
  142. },
  143. children: [],
  144. },
  145. controls: {
  146. type: "OrbitControls",
  147. props: {
  148. enableDamping: true,
  149. dampingFactor: null,
  150. enableZoom: null,
  151. enablePan: null,
  152. enableRotate: null,
  153. minDistance: 3,
  154. maxDistance: 15,
  155. minPolarAngle: 0.2,
  156. maxPolarAngle: 1.5,
  157. autoRotate: true,
  158. autoRotateSpeed: 0.4,
  159. target: [0, 1, 0],
  160. },
  161. children: [],
  162. },
  163. },
  164. },
  165. };