storm-cell.ts 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. import type { Scene } from "./_helpers";
  2. export const stormCell: Scene = {
  3. name: "Storm Cell",
  4. description:
  5. "Dark violent thunderstorm -- spinning cloud masses, pulsing lightning, rain particles, camera shake",
  6. spec: {
  7. root: "scene",
  8. elements: {
  9. scene: {
  10. type: "Group",
  11. props: { position: null, rotation: null, scale: null },
  12. children: [
  13. "sky",
  14. "ambient",
  15. "sun",
  16. "cloud-spin-1",
  17. "cloud-spin-2",
  18. "cloud-spin-3",
  19. "lightning-1-pulse",
  20. "lightning-2-pulse",
  21. "lightning-3-pulse",
  22. "rain",
  23. "shake",
  24. "post",
  25. "fog",
  26. "controls",
  27. ],
  28. },
  29. sky: {
  30. type: "Sky",
  31. props: {
  32. distance: null,
  33. sunPosition: [10, 2, 0],
  34. inclination: null,
  35. azimuth: null,
  36. turbidity: 20,
  37. rayleigh: 0.5,
  38. mieCoefficient: 0.01,
  39. mieDirectionalG: 0.9,
  40. },
  41. children: [],
  42. },
  43. ambient: {
  44. type: "AmbientLight",
  45. props: { color: "#111122", intensity: 0.15 },
  46. children: [],
  47. },
  48. sun: {
  49. type: "DirectionalLight",
  50. props: {
  51. position: [10, 3, 0],
  52. rotation: null,
  53. scale: null,
  54. color: "#334466",
  55. intensity: 0.5,
  56. castShadow: true,
  57. },
  58. children: [],
  59. },
  60. "cloud-spin-1": {
  61. type: "Spin",
  62. props: {
  63. position: [0, 4, 0],
  64. rotation: null,
  65. scale: null,
  66. speed: 0.08,
  67. axis: "y",
  68. },
  69. children: ["cloud-1"],
  70. },
  71. "cloud-1": {
  72. type: "Cloud",
  73. props: {
  74. position: [0, 0, 0],
  75. rotation: null,
  76. scale: null,
  77. seed: 1,
  78. segments: 40,
  79. bounds: [25, 3, 25],
  80. volume: 15,
  81. speed: 0.3,
  82. fade: 20,
  83. opacity: 0.9,
  84. color: "#222233",
  85. growth: 10,
  86. },
  87. children: [],
  88. },
  89. "cloud-spin-2": {
  90. type: "Spin",
  91. props: {
  92. position: [0, 6, -3],
  93. rotation: null,
  94. scale: null,
  95. speed: -0.05,
  96. axis: "y",
  97. },
  98. children: ["cloud-2"],
  99. },
  100. "cloud-2": {
  101. type: "Cloud",
  102. props: {
  103. position: [0, 0, 0],
  104. rotation: null,
  105. scale: null,
  106. seed: 42,
  107. segments: 30,
  108. bounds: [20, 2, 20],
  109. volume: 12,
  110. speed: 0.2,
  111. fade: 15,
  112. opacity: 0.7,
  113. color: "#1a1a2a",
  114. growth: 8,
  115. },
  116. children: [],
  117. },
  118. "cloud-spin-3": {
  119. type: "Spin",
  120. props: {
  121. position: [0, 8, 2],
  122. rotation: null,
  123. scale: null,
  124. speed: 0.03,
  125. axis: "y",
  126. },
  127. children: ["cloud-3"],
  128. },
  129. "cloud-3": {
  130. type: "Cloud",
  131. props: {
  132. position: [0, 0, 0],
  133. rotation: null,
  134. scale: null,
  135. seed: 99,
  136. segments: 25,
  137. bounds: [30, 2, 30],
  138. volume: 10,
  139. speed: 0.15,
  140. fade: 25,
  141. opacity: 0.5,
  142. color: "#2a2a3a",
  143. growth: 6,
  144. },
  145. children: [],
  146. },
  147. "lightning-1-pulse": {
  148. type: "Pulse",
  149. props: {
  150. position: [2, 5, -1],
  151. rotation: null,
  152. scale: null,
  153. speed: 3,
  154. min: 0,
  155. max: 1,
  156. },
  157. children: ["lightning-1"],
  158. },
  159. "lightning-1": {
  160. type: "PointLight",
  161. props: {
  162. position: [0, 0, 0],
  163. rotation: null,
  164. scale: null,
  165. color: "#aabbff",
  166. intensity: 80,
  167. distance: 30,
  168. decay: 2,
  169. castShadow: false,
  170. },
  171. children: [],
  172. },
  173. "lightning-2-pulse": {
  174. type: "Pulse",
  175. props: {
  176. position: [-3, 6, 3],
  177. rotation: null,
  178. scale: null,
  179. speed: 4.5,
  180. min: 0,
  181. max: 1,
  182. },
  183. children: ["lightning-2"],
  184. },
  185. "lightning-2": {
  186. type: "PointLight",
  187. props: {
  188. position: [0, 0, 0],
  189. rotation: null,
  190. scale: null,
  191. color: "#aaccff",
  192. intensity: 60,
  193. distance: 25,
  194. decay: 2,
  195. castShadow: false,
  196. },
  197. children: [],
  198. },
  199. "lightning-3-pulse": {
  200. type: "Pulse",
  201. props: {
  202. position: [0, 4, -4],
  203. rotation: null,
  204. scale: null,
  205. speed: 2.5,
  206. min: 0,
  207. max: 1,
  208. },
  209. children: ["lightning-3"],
  210. },
  211. "lightning-3": {
  212. type: "PointLight",
  213. props: {
  214. position: [0, 0, 0],
  215. rotation: null,
  216. scale: null,
  217. color: "#99bbff",
  218. intensity: 40,
  219. distance: 20,
  220. decay: 2,
  221. castShadow: false,
  222. },
  223. children: [],
  224. },
  225. rain: {
  226. type: "Sparkles",
  227. props: {
  228. position: [0, 5, 0],
  229. rotation: null,
  230. scale: [20, 15, 20],
  231. count: 500,
  232. speed: 5,
  233. opacity: 0.4,
  234. color: "#6688aa",
  235. size: 0.5,
  236. noise: 0.5,
  237. },
  238. children: [],
  239. },
  240. shake: {
  241. type: "CameraShake",
  242. props: {
  243. intensity: 0.2,
  244. maxYaw: 0.02,
  245. maxPitch: 0.03,
  246. maxRoll: 0.01,
  247. },
  248. children: [],
  249. },
  250. post: {
  251. type: "EffectComposer",
  252. props: { enabled: true, multisampling: 8 },
  253. children: ["bloom", "vignette"],
  254. },
  255. bloom: {
  256. type: "Bloom",
  257. props: {
  258. intensity: 0.8,
  259. luminanceThreshold: 0.3,
  260. luminanceSmoothing: null,
  261. mipmapBlur: true,
  262. },
  263. children: [],
  264. },
  265. vignette: {
  266. type: "Vignette",
  267. props: { offset: 0.3, darkness: 0.8 },
  268. children: [],
  269. },
  270. fog: {
  271. type: "Fog",
  272. props: { color: "#0a0a15", near: 5, far: 30 },
  273. children: [],
  274. },
  275. controls: {
  276. type: "OrbitControls",
  277. props: {
  278. enableDamping: null,
  279. dampingFactor: null,
  280. enableZoom: true,
  281. enablePan: null,
  282. enableRotate: true,
  283. minDistance: 3,
  284. maxDistance: 20,
  285. minPolarAngle: 0.2,
  286. maxPolarAngle: 1.3,
  287. autoRotate: true,
  288. autoRotateSpeed: 0.1,
  289. },
  290. children: [],
  291. },
  292. },
  293. },
  294. };