pipes.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. import type { Scene } from "./_helpers";
  2. const goldMaterial = {
  3. color: "#cc8833",
  4. metalness: 1,
  5. roughness: 0.05,
  6. };
  7. const blueMaterial = {
  8. color: "#3388cc",
  9. metalness: 1,
  10. roughness: 0.05,
  11. };
  12. const magentaMaterial = {
  13. color: "#cc3388",
  14. metalness: 1,
  15. roughness: 0.05,
  16. };
  17. export const pipes: Scene = {
  18. name: "Pipes",
  19. description:
  20. "Classic 3D Pipes screensaver -- chrome pipes snaking through space at right angles",
  21. spec: {
  22. root: "scene",
  23. elements: {
  24. scene: {
  25. type: "Group",
  26. props: { position: null, rotation: null, scale: null },
  27. children: [
  28. "camera",
  29. "env",
  30. "ambient",
  31. "directional",
  32. "pipe-system",
  33. "post",
  34. "fog",
  35. "controls",
  36. ],
  37. },
  38. camera: {
  39. type: "PerspectiveCamera",
  40. props: {
  41. position: [0, 3, 12],
  42. rotation: null,
  43. scale: null,
  44. fov: 50,
  45. near: null,
  46. far: null,
  47. makeDefault: true,
  48. },
  49. children: [],
  50. },
  51. env: {
  52. type: "Environment",
  53. props: {
  54. preset: "warehouse",
  55. background: false,
  56. blur: 0.5,
  57. intensity: 1,
  58. },
  59. children: [],
  60. },
  61. ambient: {
  62. type: "AmbientLight",
  63. props: { color: "#ffffff", intensity: 0.3 },
  64. children: [],
  65. },
  66. directional: {
  67. type: "DirectionalLight",
  68. props: {
  69. position: [5, 10, 5],
  70. rotation: null,
  71. scale: null,
  72. color: "#ffffff",
  73. intensity: 1,
  74. castShadow: null,
  75. },
  76. children: [],
  77. },
  78. "pipe-system": {
  79. type: "Spin",
  80. props: {
  81. position: null,
  82. rotation: null,
  83. scale: null,
  84. speed: 0.1,
  85. axis: "y",
  86. },
  87. children: ["pipe1-group", "pipe2-group", "pipe3-group"],
  88. },
  89. "pipe1-group": {
  90. type: "Group",
  91. props: { position: null, rotation: null, scale: null },
  92. children: [
  93. "p1-j0",
  94. "p1-s1",
  95. "p1-j1",
  96. "p1-s2",
  97. "p1-j2",
  98. "p1-s3",
  99. "p1-j3",
  100. "p1-s4",
  101. "p1-j4",
  102. "p1-s5",
  103. "p1-j5",
  104. "p1-s6",
  105. "p1-j6",
  106. ],
  107. },
  108. "p1-j0": {
  109. type: "Sphere",
  110. props: {
  111. position: [-3, -3, 0],
  112. rotation: null,
  113. scale: null,
  114. castShadow: null,
  115. receiveShadow: null,
  116. material: goldMaterial,
  117. radius: 0.12,
  118. widthSegments: null,
  119. heightSegments: null,
  120. },
  121. children: [],
  122. },
  123. "p1-j1": {
  124. type: "Sphere",
  125. props: {
  126. position: [-3, 0, 0],
  127. rotation: null,
  128. scale: null,
  129. castShadow: null,
  130. receiveShadow: null,
  131. material: goldMaterial,
  132. radius: 0.12,
  133. widthSegments: null,
  134. heightSegments: null,
  135. },
  136. children: [],
  137. },
  138. "p1-j2": {
  139. type: "Sphere",
  140. props: {
  141. position: [1, 0, 0],
  142. rotation: null,
  143. scale: null,
  144. castShadow: null,
  145. receiveShadow: null,
  146. material: goldMaterial,
  147. radius: 0.12,
  148. widthSegments: null,
  149. heightSegments: null,
  150. },
  151. children: [],
  152. },
  153. "p1-j3": {
  154. type: "Sphere",
  155. props: {
  156. position: [1, 2, 0],
  157. rotation: null,
  158. scale: null,
  159. castShadow: null,
  160. receiveShadow: null,
  161. material: goldMaterial,
  162. radius: 0.12,
  163. widthSegments: null,
  164. heightSegments: null,
  165. },
  166. children: [],
  167. },
  168. "p1-j4": {
  169. type: "Sphere",
  170. props: {
  171. position: [1, 2, -3],
  172. rotation: null,
  173. scale: null,
  174. castShadow: null,
  175. receiveShadow: null,
  176. material: goldMaterial,
  177. radius: 0.12,
  178. widthSegments: null,
  179. heightSegments: null,
  180. },
  181. children: [],
  182. },
  183. "p1-j5": {
  184. type: "Sphere",
  185. props: {
  186. position: [1, 0, -3],
  187. rotation: null,
  188. scale: null,
  189. castShadow: null,
  190. receiveShadow: null,
  191. material: goldMaterial,
  192. radius: 0.12,
  193. widthSegments: null,
  194. heightSegments: null,
  195. },
  196. children: [],
  197. },
  198. "p1-j6": {
  199. type: "Sphere",
  200. props: {
  201. position: [-1, 0, -3],
  202. rotation: null,
  203. scale: null,
  204. castShadow: null,
  205. receiveShadow: null,
  206. material: goldMaterial,
  207. radius: 0.12,
  208. widthSegments: null,
  209. heightSegments: null,
  210. },
  211. children: [],
  212. },
  213. "p1-s1": {
  214. type: "Cylinder",
  215. props: {
  216. position: [-3, -1.5, 0],
  217. rotation: null,
  218. scale: null,
  219. castShadow: null,
  220. receiveShadow: null,
  221. material: goldMaterial,
  222. radiusTop: 0.08,
  223. radiusBottom: 0.08,
  224. height: 3,
  225. radialSegments: 12,
  226. },
  227. children: [],
  228. },
  229. "p1-s2": {
  230. type: "Cylinder",
  231. props: {
  232. position: [-1, 0, 0],
  233. rotation: [0, 0, 1.5708],
  234. scale: null,
  235. castShadow: null,
  236. receiveShadow: null,
  237. material: goldMaterial,
  238. radiusTop: 0.08,
  239. radiusBottom: 0.08,
  240. height: 4,
  241. radialSegments: 12,
  242. },
  243. children: [],
  244. },
  245. "p1-s3": {
  246. type: "Cylinder",
  247. props: {
  248. position: [1, 1, 0],
  249. rotation: null,
  250. scale: null,
  251. castShadow: null,
  252. receiveShadow: null,
  253. material: goldMaterial,
  254. radiusTop: 0.08,
  255. radiusBottom: 0.08,
  256. height: 2,
  257. radialSegments: 12,
  258. },
  259. children: [],
  260. },
  261. "p1-s4": {
  262. type: "Cylinder",
  263. props: {
  264. position: [1, 2, -1.5],
  265. rotation: [1.5708, 0, 0],
  266. scale: null,
  267. castShadow: null,
  268. receiveShadow: null,
  269. material: goldMaterial,
  270. radiusTop: 0.08,
  271. radiusBottom: 0.08,
  272. height: 3,
  273. radialSegments: 12,
  274. },
  275. children: [],
  276. },
  277. "p1-s5": {
  278. type: "Cylinder",
  279. props: {
  280. position: [1, 1, -3],
  281. rotation: null,
  282. scale: null,
  283. castShadow: null,
  284. receiveShadow: null,
  285. material: goldMaterial,
  286. radiusTop: 0.08,
  287. radiusBottom: 0.08,
  288. height: 2,
  289. radialSegments: 12,
  290. },
  291. children: [],
  292. },
  293. "p1-s6": {
  294. type: "Cylinder",
  295. props: {
  296. position: [0, 0, -3],
  297. rotation: [0, 0, 1.5708],
  298. scale: null,
  299. castShadow: null,
  300. receiveShadow: null,
  301. material: goldMaterial,
  302. radiusTop: 0.08,
  303. radiusBottom: 0.08,
  304. height: 2,
  305. radialSegments: 12,
  306. },
  307. children: [],
  308. },
  309. "pipe2-group": {
  310. type: "Group",
  311. props: { position: null, rotation: null, scale: null },
  312. children: [
  313. "p2-j0",
  314. "p2-s1",
  315. "p2-j1",
  316. "p2-s2",
  317. "p2-j2",
  318. "p2-s3",
  319. "p2-j3",
  320. "p2-s4",
  321. "p2-j4",
  322. "p2-s5",
  323. "p2-j5",
  324. "p2-s6",
  325. "p2-j6",
  326. ],
  327. },
  328. "p2-j0": {
  329. type: "Sphere",
  330. props: {
  331. position: [2, -3, 2],
  332. rotation: null,
  333. scale: null,
  334. castShadow: null,
  335. receiveShadow: null,
  336. material: blueMaterial,
  337. radius: 0.12,
  338. widthSegments: null,
  339. heightSegments: null,
  340. },
  341. children: [],
  342. },
  343. "p2-j1": {
  344. type: "Sphere",
  345. props: {
  346. position: [2, 1, 2],
  347. rotation: null,
  348. scale: null,
  349. castShadow: null,
  350. receiveShadow: null,
  351. material: blueMaterial,
  352. radius: 0.12,
  353. widthSegments: null,
  354. heightSegments: null,
  355. },
  356. children: [],
  357. },
  358. "p2-j2": {
  359. type: "Sphere",
  360. props: {
  361. position: [2, 1, -2],
  362. rotation: null,
  363. scale: null,
  364. castShadow: null,
  365. receiveShadow: null,
  366. material: blueMaterial,
  367. radius: 0.12,
  368. widthSegments: null,
  369. heightSegments: null,
  370. },
  371. children: [],
  372. },
  373. "p2-j3": {
  374. type: "Sphere",
  375. props: {
  376. position: [-1, 1, -2],
  377. rotation: null,
  378. scale: null,
  379. castShadow: null,
  380. receiveShadow: null,
  381. material: blueMaterial,
  382. radius: 0.12,
  383. widthSegments: null,
  384. heightSegments: null,
  385. },
  386. children: [],
  387. },
  388. "p2-j4": {
  389. type: "Sphere",
  390. props: {
  391. position: [-1, 4, -2],
  392. rotation: null,
  393. scale: null,
  394. castShadow: null,
  395. receiveShadow: null,
  396. material: blueMaterial,
  397. radius: 0.12,
  398. widthSegments: null,
  399. heightSegments: null,
  400. },
  401. children: [],
  402. },
  403. "p2-j5": {
  404. type: "Sphere",
  405. props: {
  406. position: [-3, 4, -2],
  407. rotation: null,
  408. scale: null,
  409. castShadow: null,
  410. receiveShadow: null,
  411. material: blueMaterial,
  412. radius: 0.12,
  413. widthSegments: null,
  414. heightSegments: null,
  415. },
  416. children: [],
  417. },
  418. "p2-j6": {
  419. type: "Sphere",
  420. props: {
  421. position: [-3, 4, 1],
  422. rotation: null,
  423. scale: null,
  424. castShadow: null,
  425. receiveShadow: null,
  426. material: blueMaterial,
  427. radius: 0.12,
  428. widthSegments: null,
  429. heightSegments: null,
  430. },
  431. children: [],
  432. },
  433. "p2-s1": {
  434. type: "Cylinder",
  435. props: {
  436. position: [2, -1, 2],
  437. rotation: null,
  438. scale: null,
  439. castShadow: null,
  440. receiveShadow: null,
  441. material: blueMaterial,
  442. radiusTop: 0.08,
  443. radiusBottom: 0.08,
  444. height: 4,
  445. radialSegments: 12,
  446. },
  447. children: [],
  448. },
  449. "p2-s2": {
  450. type: "Cylinder",
  451. props: {
  452. position: [2, 1, 0],
  453. rotation: [1.5708, 0, 0],
  454. scale: null,
  455. castShadow: null,
  456. receiveShadow: null,
  457. material: blueMaterial,
  458. radiusTop: 0.08,
  459. radiusBottom: 0.08,
  460. height: 4,
  461. radialSegments: 12,
  462. },
  463. children: [],
  464. },
  465. "p2-s3": {
  466. type: "Cylinder",
  467. props: {
  468. position: [0.5, 1, -2],
  469. rotation: [0, 0, 1.5708],
  470. scale: null,
  471. castShadow: null,
  472. receiveShadow: null,
  473. material: blueMaterial,
  474. radiusTop: 0.08,
  475. radiusBottom: 0.08,
  476. height: 3,
  477. radialSegments: 12,
  478. },
  479. children: [],
  480. },
  481. "p2-s4": {
  482. type: "Cylinder",
  483. props: {
  484. position: [-1, 2.5, -2],
  485. rotation: null,
  486. scale: null,
  487. castShadow: null,
  488. receiveShadow: null,
  489. material: blueMaterial,
  490. radiusTop: 0.08,
  491. radiusBottom: 0.08,
  492. height: 3,
  493. radialSegments: 12,
  494. },
  495. children: [],
  496. },
  497. "p2-s5": {
  498. type: "Cylinder",
  499. props: {
  500. position: [-2, 4, -2],
  501. rotation: [0, 0, 1.5708],
  502. scale: null,
  503. castShadow: null,
  504. receiveShadow: null,
  505. material: blueMaterial,
  506. radiusTop: 0.08,
  507. radiusBottom: 0.08,
  508. height: 2,
  509. radialSegments: 12,
  510. },
  511. children: [],
  512. },
  513. "p2-s6": {
  514. type: "Cylinder",
  515. props: {
  516. position: [-3, 4, -0.5],
  517. rotation: [1.5708, 0, 0],
  518. scale: null,
  519. castShadow: null,
  520. receiveShadow: null,
  521. material: blueMaterial,
  522. radiusTop: 0.08,
  523. radiusBottom: 0.08,
  524. height: 3,
  525. radialSegments: 12,
  526. },
  527. children: [],
  528. },
  529. "pipe3-group": {
  530. type: "Group",
  531. props: { position: null, rotation: null, scale: null },
  532. children: [
  533. "p3-j0",
  534. "p3-s1",
  535. "p3-j1",
  536. "p3-s2",
  537. "p3-j2",
  538. "p3-s3",
  539. "p3-j3",
  540. "p3-s4",
  541. "p3-j4",
  542. "p3-s5",
  543. "p3-j5",
  544. ],
  545. },
  546. "p3-j0": {
  547. type: "Sphere",
  548. props: {
  549. position: [-2, 3, 3],
  550. rotation: null,
  551. scale: null,
  552. castShadow: null,
  553. receiveShadow: null,
  554. material: magentaMaterial,
  555. radius: 0.12,
  556. widthSegments: null,
  557. heightSegments: null,
  558. },
  559. children: [],
  560. },
  561. "p3-j1": {
  562. type: "Sphere",
  563. props: {
  564. position: [-2, -2, 3],
  565. rotation: null,
  566. scale: null,
  567. castShadow: null,
  568. receiveShadow: null,
  569. material: magentaMaterial,
  570. radius: 0.12,
  571. widthSegments: null,
  572. heightSegments: null,
  573. },
  574. children: [],
  575. },
  576. "p3-j2": {
  577. type: "Sphere",
  578. props: {
  579. position: [1, -2, 3],
  580. rotation: null,
  581. scale: null,
  582. castShadow: null,
  583. receiveShadow: null,
  584. material: magentaMaterial,
  585. radius: 0.12,
  586. widthSegments: null,
  587. heightSegments: null,
  588. },
  589. children: [],
  590. },
  591. "p3-j3": {
  592. type: "Sphere",
  593. props: {
  594. position: [1, -2, -2],
  595. rotation: null,
  596. scale: null,
  597. castShadow: null,
  598. receiveShadow: null,
  599. material: magentaMaterial,
  600. radius: 0.12,
  601. widthSegments: null,
  602. heightSegments: null,
  603. },
  604. children: [],
  605. },
  606. "p3-j4": {
  607. type: "Sphere",
  608. props: {
  609. position: [1, 0, -2],
  610. rotation: null,
  611. scale: null,
  612. castShadow: null,
  613. receiveShadow: null,
  614. material: magentaMaterial,
  615. radius: 0.12,
  616. widthSegments: null,
  617. heightSegments: null,
  618. },
  619. children: [],
  620. },
  621. "p3-j5": {
  622. type: "Sphere",
  623. props: {
  624. position: [-3, 0, -2],
  625. rotation: null,
  626. scale: null,
  627. castShadow: null,
  628. receiveShadow: null,
  629. material: magentaMaterial,
  630. radius: 0.12,
  631. widthSegments: null,
  632. heightSegments: null,
  633. },
  634. children: [],
  635. },
  636. "p3-s1": {
  637. type: "Cylinder",
  638. props: {
  639. position: [-2, 0.5, 3],
  640. rotation: null,
  641. scale: null,
  642. castShadow: null,
  643. receiveShadow: null,
  644. material: magentaMaterial,
  645. radiusTop: 0.08,
  646. radiusBottom: 0.08,
  647. height: 5,
  648. radialSegments: 12,
  649. },
  650. children: [],
  651. },
  652. "p3-s2": {
  653. type: "Cylinder",
  654. props: {
  655. position: [-0.5, -2, 3],
  656. rotation: [0, 0, 1.5708],
  657. scale: null,
  658. castShadow: null,
  659. receiveShadow: null,
  660. material: magentaMaterial,
  661. radiusTop: 0.08,
  662. radiusBottom: 0.08,
  663. height: 3,
  664. radialSegments: 12,
  665. },
  666. children: [],
  667. },
  668. "p3-s3": {
  669. type: "Cylinder",
  670. props: {
  671. position: [1, -2, 0.5],
  672. rotation: [1.5708, 0, 0],
  673. scale: null,
  674. castShadow: null,
  675. receiveShadow: null,
  676. material: magentaMaterial,
  677. radiusTop: 0.08,
  678. radiusBottom: 0.08,
  679. height: 5,
  680. radialSegments: 12,
  681. },
  682. children: [],
  683. },
  684. "p3-s4": {
  685. type: "Cylinder",
  686. props: {
  687. position: [1, -1, -2],
  688. rotation: null,
  689. scale: null,
  690. castShadow: null,
  691. receiveShadow: null,
  692. material: magentaMaterial,
  693. radiusTop: 0.08,
  694. radiusBottom: 0.08,
  695. height: 2,
  696. radialSegments: 12,
  697. },
  698. children: [],
  699. },
  700. "p3-s5": {
  701. type: "Cylinder",
  702. props: {
  703. position: [-1, 0, -2],
  704. rotation: [0, 0, 1.5708],
  705. scale: null,
  706. castShadow: null,
  707. receiveShadow: null,
  708. material: magentaMaterial,
  709. radiusTop: 0.08,
  710. radiusBottom: 0.08,
  711. height: 4,
  712. radialSegments: 12,
  713. },
  714. children: [],
  715. },
  716. post: {
  717. type: "EffectComposer",
  718. props: { enabled: true, multisampling: 8 },
  719. children: ["bloom", "vignette"],
  720. },
  721. bloom: {
  722. type: "Bloom",
  723. props: {
  724. intensity: 0.4,
  725. luminanceThreshold: 0.4,
  726. luminanceSmoothing: null,
  727. mipmapBlur: true,
  728. },
  729. children: [],
  730. },
  731. vignette: {
  732. type: "Vignette",
  733. props: { offset: 0.3, darkness: 0.4 },
  734. children: [],
  735. },
  736. fog: {
  737. type: "Fog",
  738. props: { color: "#111111", near: 10, far: 30 },
  739. children: [],
  740. },
  741. controls: {
  742. type: "OrbitControls",
  743. props: {
  744. enableDamping: true,
  745. dampingFactor: null,
  746. enableZoom: null,
  747. enablePan: null,
  748. enableRotate: null,
  749. minDistance: 5,
  750. maxDistance: 20,
  751. minPolarAngle: null,
  752. maxPolarAngle: null,
  753. autoRotate: true,
  754. autoRotateSpeed: 0.6,
  755. },
  756. children: [],
  757. },
  758. },
  759. },
  760. };