orbital-chaos.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. import { PI } from "./_helpers";
  2. import type { Scene } from "./_helpers";
  3. export const orbitalChaos: Scene = {
  4. name: "Orbital Chaos",
  5. description:
  6. "Everything in motion -- orbiting glass, spinning knots, morphing core, all with bloom",
  7. spec: {
  8. root: "scene",
  9. elements: {
  10. scene: {
  11. type: "Group",
  12. props: { position: null, rotation: null, scale: null },
  13. children: [
  14. "cam",
  15. "env",
  16. "stars",
  17. "ambient",
  18. "core-light",
  19. "accent-1",
  20. "accent-2",
  21. "core-pulse",
  22. "orbit-1",
  23. "orbit-2",
  24. "orbit-3",
  25. "orbit-4",
  26. "orbit-5",
  27. "orbit-6",
  28. "ring-spin-fast",
  29. "ring-spin-slow",
  30. "sparkles",
  31. "post",
  32. "fog",
  33. "controls",
  34. ],
  35. },
  36. cam: {
  37. type: "PerspectiveCamera",
  38. props: {
  39. position: [0, 2, 8],
  40. fov: 50,
  41. makeDefault: true,
  42. },
  43. children: [],
  44. },
  45. env: {
  46. type: "Environment",
  47. props: { preset: "night", background: false, blur: 1, intensity: 0.15 },
  48. children: [],
  49. },
  50. stars: {
  51. type: "Stars",
  52. props: {
  53. radius: 120,
  54. depth: 60,
  55. count: 8000,
  56. factor: 5,
  57. saturation: 0.2,
  58. fade: true,
  59. speed: 0.5,
  60. },
  61. children: [],
  62. },
  63. ambient: {
  64. type: "AmbientLight",
  65. props: { color: "#110022", intensity: 0.3 },
  66. children: [],
  67. },
  68. "core-light": {
  69. type: "PointLight",
  70. props: {
  71. position: [0, 0, 0],
  72. rotation: null,
  73. scale: null,
  74. color: "#ff44aa",
  75. intensity: 80,
  76. distance: 25,
  77. decay: 2,
  78. castShadow: false,
  79. },
  80. children: [],
  81. },
  82. "accent-1": {
  83. type: "PointLight",
  84. props: {
  85. position: [5, 3, 5],
  86. rotation: null,
  87. scale: null,
  88. color: "#00ffff",
  89. intensity: 25,
  90. distance: 20,
  91. decay: 2,
  92. castShadow: false,
  93. },
  94. children: [],
  95. },
  96. "accent-2": {
  97. type: "PointLight",
  98. props: {
  99. position: [-5, -2, -5],
  100. rotation: null,
  101. scale: null,
  102. color: "#ff00ff",
  103. intensity: 25,
  104. distance: 20,
  105. decay: 2,
  106. castShadow: false,
  107. },
  108. children: [],
  109. },
  110. "core-pulse": {
  111. type: "Pulse",
  112. props: {
  113. position: null,
  114. rotation: null,
  115. scale: null,
  116. speed: 0.8,
  117. min: 0.85,
  118. max: 1.15,
  119. },
  120. children: ["core-spin"],
  121. },
  122. "core-spin": {
  123. type: "Spin",
  124. props: {
  125. position: null,
  126. rotation: null,
  127. scale: null,
  128. speed: 0.3,
  129. axis: "y",
  130. },
  131. children: ["core-blob"],
  132. },
  133. "core-blob": {
  134. type: "DistortSphere",
  135. props: {
  136. position: null,
  137. rotation: null,
  138. scale: null,
  139. castShadow: false,
  140. receiveShadow: false,
  141. radius: 1.2,
  142. widthSegments: 64,
  143. heightSegments: 32,
  144. color: "#ff2288",
  145. speed: 4,
  146. distort: 0.6,
  147. metalness: 0.1,
  148. roughness: 0.1,
  149. },
  150. children: [],
  151. },
  152. "orbit-1": {
  153. type: "Orbit",
  154. props: {
  155. position: [0, 0, 0],
  156. rotation: null,
  157. scale: null,
  158. speed: 0.8,
  159. radius: 4,
  160. tilt: 0.5,
  161. },
  162. children: ["orb-1-spin"],
  163. },
  164. "orb-1-spin": {
  165. type: "Spin",
  166. props: {
  167. position: null,
  168. rotation: null,
  169. scale: null,
  170. speed: 2,
  171. axis: "x",
  172. },
  173. children: ["orb-1"],
  174. },
  175. "orb-1": {
  176. type: "GlassSphere",
  177. props: {
  178. position: null,
  179. rotation: null,
  180. scale: null,
  181. castShadow: false,
  182. receiveShadow: false,
  183. radius: 0.4,
  184. widthSegments: 32,
  185. heightSegments: 16,
  186. color: "#00ffff",
  187. transmission: 1,
  188. thickness: 0.5,
  189. roughness: 0,
  190. chromaticAberration: 0.15,
  191. ior: 1.8,
  192. distortion: 0.1,
  193. distortionScale: null,
  194. temporalDistortion: null,
  195. samples: 6,
  196. resolution: 128,
  197. },
  198. children: [],
  199. },
  200. "orbit-2": {
  201. type: "Orbit",
  202. props: {
  203. position: [0, 0.5, 0],
  204. rotation: null,
  205. scale: null,
  206. speed: -0.6,
  207. radius: 5.5,
  208. tilt: 1,
  209. },
  210. children: ["orb-2-spin"],
  211. },
  212. "orb-2-spin": {
  213. type: "Spin",
  214. props: {
  215. position: null,
  216. rotation: null,
  217. scale: null,
  218. speed: 3,
  219. axis: "z",
  220. },
  221. children: ["orb-2"],
  222. },
  223. "orb-2": {
  224. type: "TorusKnot",
  225. props: {
  226. position: null,
  227. rotation: null,
  228. scale: null,
  229. castShadow: false,
  230. receiveShadow: false,
  231. material: {
  232. color: "#ff00ff",
  233. metalness: 0.9,
  234. roughness: 0.1,
  235. emissive: "#ff00ff",
  236. emissiveIntensity: 0.8,
  237. opacity: null,
  238. transparent: null,
  239. wireframe: null,
  240. },
  241. radius: 0.35,
  242. tube: 0.12,
  243. tubularSegments: 64,
  244. radialSegments: 8,
  245. p: 2,
  246. q: 3,
  247. },
  248. children: [],
  249. },
  250. "orbit-3": {
  251. type: "Orbit",
  252. props: {
  253. position: [0, -0.3, 0],
  254. rotation: null,
  255. scale: null,
  256. speed: 1.2,
  257. radius: 3.2,
  258. tilt: 0.3,
  259. },
  260. children: ["orb-3"],
  261. },
  262. "orb-3": {
  263. type: "GlassSphere",
  264. props: {
  265. position: null,
  266. rotation: null,
  267. scale: null,
  268. castShadow: false,
  269. receiveShadow: false,
  270. radius: 0.3,
  271. widthSegments: 32,
  272. heightSegments: 16,
  273. color: "#ff8800",
  274. transmission: 1,
  275. thickness: 0.4,
  276. roughness: 0,
  277. chromaticAberration: 0.1,
  278. ior: 1.6,
  279. distortion: 0,
  280. distortionScale: null,
  281. temporalDistortion: null,
  282. samples: 6,
  283. resolution: 128,
  284. },
  285. children: [],
  286. },
  287. "orbit-4": {
  288. type: "Orbit",
  289. props: {
  290. position: [0, 1, 0],
  291. rotation: null,
  292. scale: null,
  293. speed: -1.5,
  294. radius: 6.5,
  295. tilt: -0.8,
  296. },
  297. children: ["orb-4-spin"],
  298. },
  299. "orb-4-spin": {
  300. type: "Spin",
  301. props: {
  302. position: null,
  303. rotation: null,
  304. scale: null,
  305. speed: -4,
  306. axis: "y",
  307. },
  308. children: ["orb-4"],
  309. },
  310. "orb-4": {
  311. type: "Sphere",
  312. props: {
  313. position: null,
  314. rotation: null,
  315. scale: null,
  316. castShadow: false,
  317. receiveShadow: false,
  318. material: {
  319. color: "#00ff88",
  320. metalness: null,
  321. roughness: null,
  322. emissive: "#00ff88",
  323. emissiveIntensity: 0.8,
  324. opacity: null,
  325. transparent: null,
  326. wireframe: true,
  327. },
  328. radius: 0.35,
  329. widthSegments: 16,
  330. heightSegments: 12,
  331. },
  332. children: [],
  333. },
  334. "orbit-5": {
  335. type: "Orbit",
  336. props: {
  337. position: [0, -0.5, 0],
  338. rotation: null,
  339. scale: null,
  340. speed: 0.4,
  341. radius: 8,
  342. tilt: 0.2,
  343. },
  344. children: ["orb-5-spin"],
  345. },
  346. "orb-5-spin": {
  347. type: "Spin",
  348. props: {
  349. position: null,
  350. rotation: null,
  351. scale: null,
  352. speed: 1.5,
  353. axis: "z",
  354. },
  355. children: ["orb-5"],
  356. },
  357. "orb-5": {
  358. type: "GlassBox",
  359. props: {
  360. position: null,
  361. rotation: null,
  362. scale: null,
  363. castShadow: false,
  364. receiveShadow: false,
  365. width: 0.5,
  366. height: 0.5,
  367. depth: 0.5,
  368. color: "#ff44ff",
  369. transmission: 1,
  370. thickness: 0.4,
  371. roughness: 0,
  372. chromaticAberration: 0.08,
  373. ior: 1.7,
  374. distortion: 0,
  375. distortionScale: null,
  376. temporalDistortion: null,
  377. samples: 6,
  378. resolution: 128,
  379. },
  380. children: [],
  381. },
  382. "orbit-6": {
  383. type: "Orbit",
  384. props: {
  385. position: [0, 0.8, 0],
  386. rotation: null,
  387. scale: null,
  388. speed: 2,
  389. radius: 2.2,
  390. tilt: 1.5,
  391. },
  392. children: ["orb-6"],
  393. },
  394. "orb-6": {
  395. type: "DistortSphere",
  396. props: {
  397. position: null,
  398. rotation: null,
  399. scale: null,
  400. castShadow: false,
  401. receiveShadow: false,
  402. radius: 0.25,
  403. widthSegments: 32,
  404. heightSegments: 16,
  405. color: "#ffcc00",
  406. speed: 5,
  407. distort: 0.7,
  408. metalness: 0.5,
  409. roughness: 0.1,
  410. },
  411. children: [],
  412. },
  413. "ring-spin-fast": {
  414. type: "Spin",
  415. props: {
  416. position: null,
  417. rotation: [0.3, 0, 0],
  418. scale: null,
  419. speed: 0.5,
  420. axis: "y",
  421. },
  422. children: ["ring-inner"],
  423. },
  424. "ring-inner": {
  425. type: "Torus",
  426. props: {
  427. position: null,
  428. rotation: [PI / 2, 0, 0],
  429. scale: null,
  430. castShadow: false,
  431. receiveShadow: false,
  432. material: {
  433. color: "#00ffff",
  434. metalness: 0.9,
  435. roughness: 0.1,
  436. emissive: "#00ccff",
  437. emissiveIntensity: 0.5,
  438. opacity: 0.3,
  439. transparent: true,
  440. wireframe: null,
  441. },
  442. radius: 9,
  443. tube: 0.015,
  444. radialSegments: null,
  445. tubularSegments: 128,
  446. },
  447. children: [],
  448. },
  449. "ring-spin-slow": {
  450. type: "Spin",
  451. props: {
  452. position: null,
  453. rotation: [-0.5, 0, 0.3],
  454. scale: null,
  455. speed: -0.3,
  456. axis: "y",
  457. },
  458. children: ["ring-outer"],
  459. },
  460. "ring-outer": {
  461. type: "Torus",
  462. props: {
  463. position: null,
  464. rotation: [PI / 2, 0, 0],
  465. scale: null,
  466. castShadow: false,
  467. receiveShadow: false,
  468. material: {
  469. color: "#ff00ff",
  470. metalness: 0.9,
  471. roughness: 0.1,
  472. emissive: "#ff00aa",
  473. emissiveIntensity: 0.3,
  474. opacity: 0.2,
  475. transparent: true,
  476. wireframe: null,
  477. },
  478. radius: 11,
  479. tube: 0.012,
  480. radialSegments: null,
  481. tubularSegments: 128,
  482. },
  483. children: [],
  484. },
  485. sparkles: {
  486. type: "Sparkles",
  487. props: {
  488. position: null,
  489. rotation: null,
  490. scale: [18, 18, 18],
  491. count: 400,
  492. speed: 0.4,
  493. opacity: 0.5,
  494. color: "#ffddaa",
  495. size: 1.2,
  496. noise: 2,
  497. },
  498. children: [],
  499. },
  500. post: {
  501. type: "EffectComposer",
  502. props: { enabled: true, multisampling: 8 },
  503. children: ["bloom", "vignette"],
  504. },
  505. bloom: {
  506. type: "Bloom",
  507. props: {
  508. intensity: 2,
  509. luminanceThreshold: 0.15,
  510. luminanceSmoothing: null,
  511. mipmapBlur: true,
  512. },
  513. children: [],
  514. },
  515. vignette: {
  516. type: "Vignette",
  517. props: { offset: 0.4, darkness: 0.7 },
  518. children: [],
  519. },
  520. fog: {
  521. type: "Fog",
  522. props: { color: "#030008", near: 10, far: 40 },
  523. children: [],
  524. },
  525. controls: {
  526. type: "OrbitControls",
  527. props: {
  528. enableDamping: true,
  529. dampingFactor: null,
  530. enableZoom: true,
  531. enablePan: null,
  532. enableRotate: true,
  533. minDistance: 5,
  534. maxDistance: 25,
  535. minPolarAngle: null,
  536. maxPolarAngle: null,
  537. autoRotate: true,
  538. autoRotateSpeed: 0.4,
  539. },
  540. children: [],
  541. },
  542. },
  543. },
  544. };