starfield.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import type { Scene } from "./_helpers";
  2. export const starfield: Scene = {
  3. name: "Starfield",
  4. description:
  5. "Classic Windows starfield screensaver -- flying through stars at warp speed",
  6. spec: {
  7. root: "scene",
  8. elements: {
  9. scene: {
  10. type: "Group",
  11. props: { position: null, rotation: null, scale: null },
  12. children: [
  13. "cam",
  14. "ambient",
  15. "tunnel",
  16. "stars1",
  17. "stars2",
  18. "sparkle-dust",
  19. "shake",
  20. "post",
  21. "controls",
  22. ],
  23. },
  24. cam: {
  25. type: "PerspectiveCamera",
  26. props: {
  27. position: [0, 0, 0],
  28. rotation: null,
  29. scale: null,
  30. fov: 75,
  31. near: 0.1,
  32. far: 1000,
  33. makeDefault: true,
  34. },
  35. children: [],
  36. },
  37. ambient: {
  38. type: "AmbientLight",
  39. props: { color: "#111122", intensity: 0.15 },
  40. children: [],
  41. },
  42. tunnel: {
  43. type: "WarpTunnel",
  44. props: {
  45. position: [0, 0, 0],
  46. rotation: null,
  47. scale: null,
  48. ringCount: 120,
  49. radius: 4,
  50. length: 40,
  51. speed: 12,
  52. tubeRadius: 0.008,
  53. color1: "#ffffff",
  54. color2: "#aabbff",
  55. },
  56. children: [],
  57. },
  58. stars1: {
  59. type: "Stars",
  60. props: {
  61. radius: 50,
  62. depth: 80,
  63. count: 10000,
  64. factor: 6,
  65. saturation: 0,
  66. fade: true,
  67. speed: 3,
  68. },
  69. children: [],
  70. },
  71. stars2: {
  72. type: "Stars",
  73. props: {
  74. radius: 30,
  75. depth: 50,
  76. count: 5000,
  77. factor: 3,
  78. saturation: 0.1,
  79. fade: true,
  80. speed: 5,
  81. },
  82. children: [],
  83. },
  84. "sparkle-dust": {
  85. type: "Sparkles",
  86. props: {
  87. position: [0, 0, -5],
  88. rotation: null,
  89. scale: [8, 8, 30],
  90. count: 300,
  91. speed: 2,
  92. opacity: 0.6,
  93. color: "#ffffff",
  94. size: 1,
  95. noise: 4,
  96. },
  97. children: [],
  98. },
  99. shake: {
  100. type: "CameraShake",
  101. props: {
  102. intensity: 0.15,
  103. maxYaw: 0.02,
  104. maxPitch: 0.02,
  105. maxRoll: 0.01,
  106. },
  107. children: [],
  108. },
  109. post: {
  110. type: "EffectComposer",
  111. props: { enabled: true, multisampling: 8 },
  112. children: ["bloom", "vignette"],
  113. },
  114. bloom: {
  115. type: "Bloom",
  116. props: {
  117. intensity: 1.5,
  118. luminanceThreshold: 0.15,
  119. luminanceSmoothing: null,
  120. mipmapBlur: true,
  121. },
  122. children: [],
  123. },
  124. vignette: {
  125. type: "Vignette",
  126. props: { offset: 0.1, darkness: 0.9 },
  127. children: [],
  128. },
  129. controls: {
  130. type: "OrbitControls",
  131. props: {
  132. enableDamping: null,
  133. dampingFactor: null,
  134. enableZoom: false,
  135. enablePan: false,
  136. enableRotate: false,
  137. minDistance: null,
  138. maxDistance: null,
  139. minPolarAngle: null,
  140. maxPolarAngle: null,
  141. autoRotate: false,
  142. autoRotateSpeed: null,
  143. },
  144. children: [],
  145. },
  146. },
  147. },
  148. };