splat-with-primitives.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import type { Scene } from "./_helpers";
  2. export const splatWithPrimitives: Scene = {
  3. name: "Splat + Primitives",
  4. description:
  5. "A gaussian splat scene composed with standard 3D primitives and lights",
  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. "ambient",
  15. "sun",
  16. "splat",
  17. "logo",
  18. "label",
  19. "grid",
  20. "controls",
  21. ],
  22. },
  23. camera: {
  24. type: "PerspectiveCamera",
  25. props: {
  26. position: [4, 3, 6],
  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: "#ffffff", intensity: 0.4 },
  39. children: [],
  40. },
  41. sun: {
  42. type: "DirectionalLight",
  43. props: {
  44. position: [8, 10, 5],
  45. rotation: null,
  46. scale: null,
  47. color: "#fff5e0",
  48. intensity: 2.5,
  49. castShadow: true,
  50. },
  51. children: [],
  52. },
  53. splat: {
  54. type: "GaussianSplat",
  55. props: {
  56. src: "https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/garden/garden-7k.splat",
  57. position: [0, 0, 0],
  58. rotation: null,
  59. scale: [1, 1, 1],
  60. castShadow: null,
  61. receiveShadow: null,
  62. alphaHash: null,
  63. toneMapped: null,
  64. visible: true,
  65. },
  66. children: [],
  67. },
  68. logo: {
  69. type: "Cone",
  70. props: {
  71. position: [-0.4, -0.25, 1],
  72. rotation: [-1.5708, 0, 0],
  73. scale: null,
  74. radius: 0.1,
  75. height: 0.06,
  76. radialSegments: 3,
  77. castShadow: true,
  78. receiveShadow: null,
  79. material: {
  80. color: "#ffffff",
  81. metalness: 0.3,
  82. roughness: 0.4,
  83. emissive: null,
  84. emissiveIntensity: null,
  85. opacity: null,
  86. transparent: null,
  87. wireframe: null,
  88. },
  89. },
  90. children: [],
  91. },
  92. grid: {
  93. type: "GridHelper",
  94. props: {
  95. position: [0, -0.49, 0],
  96. rotation: null,
  97. scale: null,
  98. size: 30,
  99. divisions: 30,
  100. color: "#333333",
  101. secondaryColor: "#1a1a1a",
  102. },
  103. children: [],
  104. },
  105. label: {
  106. type: "ExtrudedText",
  107. props: {
  108. position: [-0.3, -0.28, 1],
  109. rotation: null,
  110. scale: null,
  111. text: "vercel-labs/json-render",
  112. font: null,
  113. size: 0.1,
  114. depth: 0.02,
  115. curveSegments: null,
  116. bevelEnabled: false,
  117. bevelThickness: null,
  118. bevelSize: null,
  119. bevelSegments: null,
  120. centered: false,
  121. castShadow: true,
  122. receiveShadow: null,
  123. material: {
  124. color: "#ffffff",
  125. metalness: 1,
  126. roughness: 0.4,
  127. emissive: null,
  128. emissiveIntensity: null,
  129. opacity: null,
  130. transparent: null,
  131. wireframe: null,
  132. },
  133. },
  134. children: [],
  135. },
  136. controls: {
  137. type: "OrbitControls",
  138. props: {
  139. enableDamping: true,
  140. dampingFactor: null,
  141. enableZoom: null,
  142. enablePan: null,
  143. enableRotate: null,
  144. minDistance: 2,
  145. maxDistance: 20,
  146. minPolarAngle: 0.2,
  147. maxPolarAngle: 1.5,
  148. autoRotate: true,
  149. autoRotateSpeed: 0.3,
  150. target: [0.3, -0.4, 0.4],
  151. },
  152. children: [],
  153. },
  154. },
  155. },
  156. };