-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
4671 lines (4310 loc) · 195 KB
/
Copy pathscript.js
File metadata and controls
4671 lines (4310 loc) · 195 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ═══════════════════════════════════════════════════════
// Cosmic Explorer — Built by Ritesh Meena (github.com/rtm20)
// Licensed under CC BY-NC 4.0
// https://github.com/rtm20/cosmic-explorer
// ═══════════════════════════════════════════════════════
// ═══════════════════════════════════════════════════════
// PLANET DATA
// ═══════════════════════════════════════════════════════
const PLANET_DATA = {
Sun: {
name: 'Sol', type: 'Estrella tipo G (Secuencia Principal)',
radius: 5, distance: 0, orbitalSpeed: 0, rotationSpeed: 0.001,
color: '#FDB813', emissive: '#F97C0A',
glowColor: '#FF8C00',
description: 'El preludio de fuego que ilumina el vacío. Nuestro Sol es el faro cálido que guía la danza eterna de los mundos, derramando su abrazo dorado sobre cada rincón de nuestra existencia.<br><br><b>🧬 Chispa de origen:</b> Aunque el fuego ardiente en su corazón no permite que la vida eche raíces allí, es su luz la que teje el milagro de la biología. Un recordatorio humilde del poder necesario para sostener la vida, brillando con una serenidad inquebrantable a pesar de su caos interior.',
diameter: '1,392,684 km', mass: '1.989 × 10³⁰ kg',
distanceFromSun: '0 km', gravity: '274 m/s²',
dayLength: '25 Earth days (equatorial)', yearLength: 'N/A',
avgTemp: '5,500°C', minTemp: '5,500°C (surface)', maxTemp: '15,000,000°C (core)',
moons: 0, moonNames: '',
orbitalVelocity: 'N/A',
atmosphere: [
{ name: 'Hidrógeno', pct: 74.9 },
{ name: 'Helio', pct: 23.8 },
{ name: 'Oxígeno', pct: 0.65 },
{ name: 'Otros', pct: 0.65 }
],
facts: [
{ icon: '🔥', text: 'La temperatura del núcleo del Sol alcanza 15 millones de grados Celsius — suficiente para alimentar la fusión nuclear.' },
{ icon: '⚡', text: 'Cada segundo, el Sol fusiona 600 millones de toneladas de hidrógeno en helio, liberando energía enorme.' },
{ icon: '🌊', text: 'La superficie del Sol está cubierta de ondas de plasma y gránulos causados por celdas de convección que ascienden desde el interior.' },
{ icon: '☄', text: 'Las llamaradas solares pueden eyectar plasma a más de 2,000 km/s, a veces interrumpiendo el campo magnético de la Tierra.' },
],
missions: [
{ year: '1990', name: 'Ulysses', agency: 'ESA/NASA' },
{ year: '2018', name: 'Parker Solar Probe', agency: 'NASA' },
{ year: '2020', name: 'Solar Orbiter', agency: 'ESA/NASA' },
],
cssColor: '#FDB813', ringColor: null,
textureType: 'sun',
axialTilt: 0.1265,
},
Mercury: {
name: 'Mercurio', type: 'Planeta terrestre',
radius: 0.6, distance: 14, orbitalSpeed: 0.0041, rotationSpeed: 0.003,
color: '#b5b5b5', emissive: '#333',
glowColor: '#888',
description: 'El silencioso centinela de ceniza que se atreve a rozar el Sol. Mercurio baila en la frontera de las sombras y el fuego, con cicatrices marcadas por la historia primordial de nuestro sistema cósmico.<br><br><b>🧬 Susurro del vacío:</b> En su soledad extrema, donde el calor derrite y el frío congela, el silencio es absoluto. Es un lienzo austero de roca y polvo, una nota muda en el gran concierto, esperando eternamente un aliento que jamás llegará.',
diameter: '4,879 km', mass: '3.30 × 10²³ kg',
distanceFromSun: '57.9 million km', gravity: '3.7 m/s²',
dayLength: '1,408 hours', yearLength: '88 Earth days',
avgTemp: '167°C', minTemp: '-180°C', maxTemp: '430°C',
moons: 0, moonNames: 'None',
orbitalVelocity: '47.4 km/s',
atmosphere: [
{ name: 'Oxígeno', pct: 42 },
{ name: 'Sodio', pct: 29 },
{ name: 'Hidrógeno', pct: 22 },
{ name: 'Otros', pct: 7 }
],
facts: [
{ icon: '🌡', text: 'Mercurio tiene los cambios de temperatura más extremos del Sistema Solar — de -180°C de noche a 430°C de día.' },
{ icon: '🧲', text: 'A pesar de su pequeño tamaño, Mercurio tiene un campo magnético global, generado probablemente por su gran núcleo de hierro.' },
{ icon: '💨', text: 'Mercurio prácticamente no tiene atmósfera para retener calor o proteger su superficie de impactos de micrometeoritos.' },
{ icon: '🌀', text: 'Mercurio rota 3 veces por cada 2 órbitas alrededor del Sol — una resonancia de rotación-órbita 3:2.' },
],
missions: [
{ year: '1974', name: 'Mariner 10', agency: 'NASA' },
{ year: '2004', name: 'MESSENGER', agency: 'NASA' },
{ year: '2018', name: 'BepiColombo', agency: 'ESA/JAXA' },
],
cssColor: '#b5b5b5', ringColor: null,
textureType: 'rocky',
axialTilt: 0.034,
},
Venus: {
name: 'Venus', type: 'Planeta terrestre',
radius: 0.95, distance: 20, orbitalSpeed: 0.0016, rotationSpeed: -0.0007,
color: '#E8B96F', emissive: '#7a4a00',
glowColor: '#D4A843',
description: 'Una belleza velada por misterios ardientes, flotando en el cielo como la estrella del alba. Venus es el espejo turbulento de la Tierra, un poema sobre los delicados equilibrios de la naturaleza y la furia contenida de sus nubes doradas.<br><br><b>🧬 Vientos de misterio:</b> Su abrazo sofocante parece descartar cualquier semilla de vida, pero en los mares de nubes muy por encima de la superficie ardiente, la imaginación nos permite soñar con ecos sutiles de vida flotante, recordándonos que el universo siempre guarda secretos impredecibles.',
diameter: '12,104 km', mass: '4.87 × 10²⁴ kg',
distanceFromSun: '108.2 million km', gravity: '8.87 m/s²',
dayLength: '5,832 hours (retrograde)', yearLength: '225 Earth days',
avgTemp: '465°C', minTemp: '460°C', maxTemp: '470°C',
moons: 0, moonNames: 'None',
orbitalVelocity: '35.0 km/s',
atmosphere: [
{ name: 'Dióxido de carbono', pct: 96.5 },
{ name: 'Nitrógeno', pct: 3.5 },
{ name: 'Dióxido de azufre', pct: 0.015 },
{ name: 'Otros', pct: 0 },
],
facts: [
{ icon: '♨', text: 'A 465°C, Venus es lo suficientemente caliente para derretir plomo — más caliente que Mercurio a pesar de estar al doble de distancia del Sol.' },
{ icon: '🔄', text: 'Venus rota al revés comparado con la mayoría de los planetas. En Venus, el Sol sale por el oeste y se pone por el este.' },
{ icon: '☁', text: 'La densa capa de nubes de ácido sulfúrico refleja el 70% de la luz solar, haciendo de Venus el objeto más brillante del cielo después del Sol y la Luna.' },
{ icon: '💎', text: 'La presión atmosférica en la superficie de Venus es 90 veces la de la Tierra — equivalente a estar a 900 m bajo el agua.' },
],
missions: [
{ year: '1970', name: 'Venera 7', agency: 'Soviet' },
{ year: '1989', name: 'Magellan', agency: 'NASA' },
{ year: '2005', name: 'Venus Express', agency: 'ESA' },
],
cssColor: '#E8B96F', ringColor: null,
textureType: 'rocky_hot',
axialTilt: 3.096,
},
Earth: {
name: 'Tierra', type: 'Planeta terrestre',
radius: 1, distance: 28, orbitalSpeed: 0.001, rotationSpeed: 0.01,
color: '#2E86C1', emissive: '#0a3055',
glowColor: '#4fc3f7',
description: 'Un oasis azul y verde, nuestro querido hogar, suspendido como una joya frágil y vibrante en la oscuridad del espacio. Aquí es donde los ecos del cosmos tomaron forma, floreciendo bajo el abrazo suave del Sol y las caricias del agua.<br><br><b>🧬 El poema de la vida:</b> En este pequeño refugio, cada grano de arena y cada criatura microscópica es un verso vital. La vida se entrelaza de manera inseparable y majestuosa, un vasto coro donde la Tierra entera respira y siente, albergando en su seno la consciencia misma del universo.',
diameter: '12,742 km', mass: '5.97 × 10²⁴ kg',
distanceFromSun: '149.6 million km', gravity: '9.81 m/s²',
dayLength: '24 hours', yearLength: '365.25 days',
avgTemp: '15°C', minTemp: '-89.2°C', maxTemp: '56.7°C',
moons: 1, moonNames: 'The Moon',
orbitalVelocity: '29.8 km/s',
atmosphere: [
{ name: 'Nitrógeno', pct: 78.1 },
{ name: 'Oxígeno', pct: 20.9 },
{ name: 'Argón', pct: 0.93 },
{ name: 'CO₂ y otros', pct: 0.04 },
],
facts: [
{ icon: '💧', text: 'Más del 71% de la superficie terrestre está cubierta por agua líquida — un ingrediente clave para la química de la vida.' },
{ icon: '🧲', text: 'El campo magnético de la Tierra actúa como escudo contra el viento solar dañino y la radiación cósmica.' },
{ icon: '🌙', text: 'La Luna es inusualmente grande en relación a la Tierra — su atracción gravitacional estabiliza la inclinación axial de la Tierra y genera las mareas oceánicas.' },
{ icon: '🌍', text: 'La Tierra es el planeta más denso del Sistema Solar, con una densidad promedio de 5,515 kg/m³.' },
],
missions: [
{ year: '1972', name: 'Apollo 17 (last lunar)', agency: 'NASA' },
{ year: '1999', name: 'Terra Satellite', agency: 'NASA' },
{ year: '2014', name: 'Sentinel Series', agency: 'ESA' },
],
cssColor: '#2E86C1', ringColor: null,
textureType: 'earth',
axialTilt: 0.4091,
},
Mars: {
name: 'Marte', type: 'Planeta terrestre',
radius: 0.75, distance: 37, orbitalSpeed: 0.00053, rotationSpeed: 0.0097,
color: '#C0392B', emissive: '#5a0000',
glowColor: '#E74C3C',
description: 'El guardián rojo del silencio, marcado por el tiempo y el viento. Marte duerme en polvo rojizo y antiguas memorias de agua, una ensoñación de mundos pasados que aguarda pacientemente por nuevas historias bajo su cielo rosado.<br><br><b>🧬 Ecos de vida pasada:</b> Entre sus valles silenciosos y sus vastos desiertos, escuchamos el eco melancólico de la posibilidad. Quizás, hace incontables eras, la vida despertó aquí, dejando su leve susurro grabado en las frías rocas, como una promesa susurrada desde un pasado lejano.',
diameter: '6,779 km', mass: '6.39 × 10²³ kg',
distanceFromSun: '227.9 million km', gravity: '3.72 m/s²',
dayLength: '24.6 hours', yearLength: '687 Earth days',
avgTemp: '-63°C', minTemp: '-143°C', maxTemp: '35°C',
moons: 2, moonNames: 'Phobos, Deimos',
orbitalVelocity: '24.1 km/s',
atmosphere: [
{ name: 'Dióxido de carbono', pct: 95.3 },
{ name: 'Nitrógeno', pct: 2.6 },
{ name: 'Argón', pct: 1.9 },
{ name: 'Otros', pct: 0.3 },
],
facts: [
{ icon: '🏔', text: 'El Monte Olimpo en Marte es el volcán más grande del Sistema Solar — 3 veces la altura del Monte Everest.' },
{ icon: '🌊', text: 'Valles Marineris es un sistema de cañones de 4,000 km de largo y hasta 7 km de profundidad — empequeñeciendo al Gran Cañón de la Tierra.' },
{ icon: '💨', text: 'Las tormentas de polvo en Marte pueden cubrir todo el planeta y durar meses, bloqueando la luz solar.' },
{ icon: '🧊', text: 'Marte tiene casquetes polares que contienen hielo de agua y hielo seco (CO₂ congelado) que crecen y se encogen con las estaciones.' },
],
missions: [
{ year: '1976', name: 'Viking 1 & 2', agency: 'NASA' },
{ year: '2012', name: 'Curiosity Rover', agency: 'NASA' },
{ year: '2021', name: 'Perseverance + Ingenuity', agency: 'NASA' },
],
cssColor: '#C0392B', ringColor: null,
textureType: 'rocky_red',
},
Jupiter: {
name: 'Júpiter', type: 'Gigante gaseoso',
radius: 2.5, distance: 55, orbitalSpeed: 0.000084, rotationSpeed: 0.04,
color: '#C88B3A', emissive: '#3a1a00',
glowColor: '#D4A843',
description: 'El majestuoso gigante, una colosal pintura al óleo que remolina con fuerza eterna. Júpiter es el director de la orquesta celestial, su inmenso abrazo gravitacional protege los mundos interiores mientras canta su antigua canción de tormentas.<br><br><b>🧬 Mares de esperanza:</b> Mientras el soberano mismo es una tormenta interminable e indomable, sus hijos más amados, las lunas, esconden océanos subterráneos, un abrazo acuático y misterioso que nos invita a soñar con reinos donde un nuevo aliento vital podría florecer en la cálida oscuridad de sus profundidades.',
diameter: '139,820 km', mass: '1.898 × 10²⁷ kg',
distanceFromSun: '778.5 million km', gravity: '24.8 m/s²',
dayLength: '9.93 hours', yearLength: '11.86 Earth years',
avgTemp: '-110°C', minTemp: '-145°C (cloud tops)', maxTemp: '24,000°C (core)',
moons: 95, moonNames: 'Io, Europa, Ganymede, Callisto + 91 more',
orbitalVelocity: '13.1 km/s',
atmosphere: [
{ name: 'Hidrógeno', pct: 89.9 },
{ name: 'Helio', pct: 10.2 },
{ name: 'Metano', pct: 0.3 },
{ name: 'Otros', pct: 0.1 },
],
facts: [
{ icon: '🌀', text: 'La Gran Mancha Roja es una tormenta que ha durado al menos 350 años y es 1.3 veces el diámetro de la Tierra.' },
{ icon: '🔱', text: 'El campo magnético de Júpiter es 14 veces más fuerte que el de la Tierra, creando la estructura más grande del Sistema Solar.' },
{ icon: '🌐', text: 'Júpiter es tan masivo que no orbita al Sol — Júpiter y el Sol orbitan un baricentro común.' },
{ icon: '🧲', text: 'La luna Europa de Júpiter es considerada uno de los mejores candidatos para vida extraterrestre, con un océano subterráneo.' },
],
missions: [
{ year: '1979', name: 'Voyager 1 & 2', agency: 'NASA' },
{ year: '1995', name: 'Galileo', agency: 'NASA' },
{ year: '2016', name: 'Juno', agency: 'NASA' },
],
cssColor: '#C88B3A', ringColor: null,
textureType: 'gas_giant_jupiter',
axialTilt: 0.0546,
},
Saturn: {
name: 'Saturno', type: 'Gigante gaseoso',
radius: 2.1, distance: 75, orbitalSpeed: 0.0000339, rotationSpeed: 0.038,
color: '#E4C07A', emissive: '#5a3d00',
glowColor: '#F0D090',
description: 'La corona del cielo, adornada con alas de luz que giran en perfecta armonía. Saturno flota sereno, una obra maestra de cristal y belleza que nos recuerda la perfección matemática y el delicado arte escondido en el silencio espacial.<br><br><b>🧬 Sueños distantes:</b> Sus anillos brillan como un faro para los corazones inquietos. Y allá, entre sus lunas lejanas, el rocío cósmico y los ríos de metano susurran historias de química misteriosa, posibilidades tan maravillosas como exóticas, un testimonio de que la creación siempre encuentra un camino nuevo.',
diameter: '116,460 km', mass: '5.68 × 10²⁶ kg',
distanceFromSun: '1.43 billion km', gravity: '10.4 m/s²',
dayLength: '10.7 hours', yearLength: '29.46 Earth years',
avgTemp: '-140°C', minTemp: '-185°C', maxTemp: '11,700°C (core)',
moons: 146, moonNames: 'Titán, Encélado, Mimas, Rea + 142 más',
orbitalVelocity: '9.7 km/s',
atmosphere: [
{ name: 'Hidrógeno', pct: 96.3 },
{ name: 'Helio', pct: 3.25 },
{ name: 'Metano', pct: 0.45 },
{ name: 'Otros', pct: 0.05 },
],
facts: [
{ icon: '💍', text: 'Los anillos de Saturno están hechos de trozos de hielo y roca que van desde diminutos granos hasta objetos del tamaño de casas.' },
{ icon: '🌊', text: 'La luna Encélado de Saturno dispara géiseres de hielo de agua a 500 km en el espacio, insinuando un océano subterráneo.' },
{ icon: '🪐', text: 'Saturno tiene la densidad más baja de cualquier planeta — flotaría si se colocara en un cuerpo de agua suficientemente grande.' },
{ icon: '🌀', text: 'Una tormenta hexagonal en el polo norte de Saturno abarca 30,000 km de ancho — suficientemente grande para 4 Tierras.' },
],
missions: [
{ year: '1980', name: 'Voyager 1', agency: 'NASA' },
{ year: '2004', name: 'Cassini-Huygens', agency: 'NASA/ESA' },
{ year: '2030', name: 'Dragonfly (Titan)', agency: 'NASA (planned)' },
],
cssColor: '#E4C07A', ringColor: '#c8a04a',
textureType: 'gas_giant_saturn',
hasRings: true,
axialTilt: 0.4665,
},
Uranus: {
name: 'Urano', type: 'Gigante de hielo',
radius: 1.6, distance: 94, orbitalSpeed: 0.0000119, rotationSpeed: -0.022,
color: '#7DE8E8', emissive: '#003a3a',
glowColor: '#5DADE2',
description: 'El lánguido soñador turquesa, que reposa de lado bajo la tranquila luz lejana. Urano guarda secretos azules en sus hielos profundos, una suave y serena presencia que gira lentamente en una órbita melancólica y solitaria.<br><br><b>🧬 Serenidad escarchada:</b> Un mundo de hielo pacífico y enigmático donde la frialdad es suprema. Lejos de la vibrante calidez, es un lugar de inmovilidad sagrada. Si existe algún pulso oculto, debe ser tan tenue y silencioso como una plegaria exhalada en el silencio de una catedral de cristal.',
diameter: '50,724 km', mass: '8.68 × 10²⁵ kg',
distanceFromSun: '2.87 billion km', gravity: '8.87 m/s²',
dayLength: '17.2 hours (retrograde)', yearLength: '84 Earth years',
avgTemp: '-195°C', minTemp: '-224°C', maxTemp: '-153°C',
moons: 27, moonNames: 'Miranda, Ariel, Umbriel, Titania, Oberon',
orbitalVelocity: '6.8 km/s',
atmosphere: [
{ name: 'Hidrógeno', pct: 82.5 },
{ name: 'Helio', pct: 15.2 },
{ name: 'Metano', pct: 2.3 },
{ name: 'Otros', pct: 0 },
],
facts: [
{ icon: '↔', text: 'Urano rota casi completamente de lado, por lo que sus polos reciben más luz solar que su ecuador durante su órbita de 84 años.' },
{ icon: '🌊', text: 'Urano es un gigante de hielo — contiene una mezcla semilíquida de hielos de agua, metano y amoníaco bajo su atmósfera.' },
{ icon: '💨', text: 'Las velocidades del viento en Urano pueden superar los 900 km/h, a pesar de ser el planeta más frío del Sistema Solar.' },
{ icon: '💍', text: 'Urano tiene 13 anillos conocidos que son muy oscuros (casi negros como el carbón) y relativamente delgados.' },
],
missions: [
{ year: '1986', name: 'Voyager 2 (flyby)', agency: 'NASA' },
{ year: '2030s', name: 'Uranus Orbiter (proposed)', agency: 'NASA' },
],
cssColor: '#7DE8E8', ringColor: '#5DADE2',
textureType: 'ice_giant_uranus',
hasRings: true, thinRings: true,
axialTilt: 1.7064,
},
Neptune: {
name: 'Neptuno', type: 'Gigante de hielo',
radius: 1.55, distance: 112, orbitalSpeed: 0.000006, rotationSpeed: 0.023,
color: '#3455DB', emissive: '#000a3a',
glowColor: '#5D6CC0',
description: 'El centinela místico del abismo índigo. Neptuno danza en los confines de la noche, un fiero espíritu del viento en los límites de lo conocido, envuelto en nubes celestes donde la imaginación humana apenas se asoma.<br><br><b>🧬 Misterios del abismo:</b> Aunque sus vientos cantan la furia de lo inaccesible, es en sus gélidos dominios donde reside un eco solemne del infinito. Tritón, capturado en la danza, promete mares ocultos que quizás sostengan latidos frágiles que se esconden en la más íntima sombra cósmica.',
diameter: '49,244 km', mass: '1.02 × 10²⁶ kg',
distanceFromSun: '4.5 billion km', gravity: '11.15 m/s²',
dayLength: '16.1 hours', yearLength: '164.8 Earth years',
avgTemp: '-200°C', minTemp: '-218°C', maxTemp: '-200°C',
moons: 16, moonNames: 'Triton, Proteus, Nereid + 13 more',
orbitalVelocity: '5.4 km/s',
atmosphere: [
{ name: 'Hidrógeno', pct: 80 },
{ name: 'Helio', pct: 19 },
{ name: 'Metano', pct: 1.5 },
{ name: 'Otros', pct: 0 },
],
facts: [
{ icon: '💨', text: 'Neptuno tiene los vientos más fuertes del Sistema Solar — hasta 2,100 km/h, más de 6 veces la fuerza de un huracán en la Tierra.' },
{ icon: '🌀', text: 'La Gran Mancha Oscura — una tormenta del tamaño de la Tierra — fue observada por la Voyager 2 pero desapareció en 1994.' },
{ icon: '🔵', text: 'La luna Tritón de Neptuno orbita en dirección opuesta a la rotación de Neptuno — probablemente fue capturada del Cinturón de Kuiper.' },
{ icon: '🌊', text: 'Neptuno fue el primer planeta encontrado mediante predicción matemática en lugar de observación directa, en 1846.' },
],
missions: [
{ year: '1989', name: 'Voyager 2 (flyby)', agency: 'NASA' },
{ year: '2040s', name: 'Neptune Probe (concept)', agency: 'NASA' },
],
cssColor: '#3455DB', ringColor: null,
textureType: 'ice_giant_neptune',
axialTilt: 0.4943,
},
Moon: {
name: 'Luna', type: 'Satélite natural',
radius: 0.22, distance: 1.8, orbitalSpeed: 0, rotationSpeed: 0.001,
color: '#cccccc', emissive: '#222222',
glowColor: '#888888',
description: 'La eterna confidente de nuestros sueños y vigilante plateada de la noche. La Luna ilumina los caminos inciertos y guía el ritmo de los mares, una presencia constante que conecta a la humanidad bajo un mismo firmamento compartido.<br><br><b>🧬 Reflejo del espíritu:</b> Silenciosa e inerte, la Luna es la memoria intocable de nuestro pasado. Aunque carezca de un latido propio, su brillo ha servido como la cuna de los sueños, la luz que siempre nos susurra que, más allá de la soledad y la esterilidad, siempre aguarda un nuevo horizonte iluminado.',
diameter: '3,474 km', mass: '7.34 × 10²² kg',
distanceFromSun: '384,400 km (from Earth)', gravity: '1.62 m/s²',
dayLength: '29.5 Earth days', yearLength: '27.3 Earth days (orbit)',
avgTemp: '-23°C', minTemp: '-173°C', maxTemp: '127°C',
moons: 0, moonNames: 'N/A — the Moon is itself a satellite',
orbitalVelocity: '1.022 km/s',
atmosphere: [
{ name: 'Helio', pct: 25 },
{ name: 'Neón', pct: 25 },
{ name: 'Hidrógeno', pct: 23 },
{ name: 'Argón', pct: 20 },
],
facts: [
{ icon: '🌕', text: 'La Luna se está alejando lentamente de la Tierra a 3.8 cm por año debido a interacciones de marea.' },
{ icon: '👣', text: '12 humanos han caminado sobre la Luna entre 1969 y 1972 — los únicos humanos en pisar otro mundo.' },
{ icon: '🌑', text: 'La Luna está bloqueada por marea — siempre muestra la misma cara a la Tierra. La cara oculta fue fotografiada por primera vez por Luna 3 en 1959.' },
{ icon: '💧', text: 'La misión LCROSS de la NASA confirmó hielo de agua en cráteres permanentemente sombreados en el polo sur en 2009.' },
{ icon: '🌊', text: 'La gravedad de la Luna es el principal motor de las mareas oceánicas de la Tierra, atrayendo agua hacia protuberancias en lados opuestos del planeta.' },
],
missions: [
{ year: '1969', name: 'Apollo 11 (first landing)', agency: 'NASA' },
{ year: '1970', name: 'Luna 17 (first rover)', agency: 'USSR' },
{ year: '2009', name: 'LCROSS (water discovery)', agency: 'NASA' },
{ year: '2019', name: 'Chang\'e 4 (far side)', agency: 'CNSA' },
{ year: '2023', name: 'Chandrayaan-3', agency: 'ISRO' },
{ year: '2025', name: 'Artemis III (planned)', agency: 'NASA' },
],
cssColor: '#cccccc', ringColor: null,
textureType: 'rocky',
},
};
// ═══════════════════════════════════════════════════════
// PROCEDURAL TEXTURE GENERATOR
// ═══════════════════════════════════════════════════════
// ── 3D NOISE SYSTEM FOR SEAMLESS SPHERE TEXTURES ──
function _hash3(x, y, z) {
let h = ((x * 374761393 + y * 668265263 + z * 1274126177) | 0);
h = ((h ^ (h >> 13)) * 1103515245 + 12345) & 0x7fffffff;
return h / 0x7fffffff;
}
function _smoothNoise3(x, y, z) {
const ix = Math.floor(x), iy = Math.floor(y), iz = Math.floor(z);
const fx = x - ix, fy = y - iy, fz = z - iz;
const sx = fx * fx * (3 - 2 * fx), sy = fy * fy * (3 - 2 * fy), sz = fz * fz * (3 - 2 * fz);
const n000 = _hash3(ix, iy, iz), n100 = _hash3(ix + 1, iy, iz);
const n010 = _hash3(ix, iy + 1, iz), n110 = _hash3(ix + 1, iy + 1, iz);
const n001 = _hash3(ix, iy, iz + 1), n101 = _hash3(ix + 1, iy, iz + 1);
const n011 = _hash3(ix, iy + 1, iz + 1), n111 = _hash3(ix + 1, iy + 1, iz + 1);
const nx00 = n000 * (1 - sx) + n100 * sx, nx10 = n010 * (1 - sx) + n110 * sx;
const nx01 = n001 * (1 - sx) + n101 * sx, nx11 = n011 * (1 - sx) + n111 * sx;
const nxy0 = nx00 * (1 - sy) + nx10 * sy, nxy1 = nx01 * (1 - sy) + nx11 * sy;
return nxy0 * (1 - sz) + nxy1 * sz;
}
function fbm3(x, y, z, octaves, lacunarity, gain) {
let val = 0, amp = 0.5, freq = 1;
lacunarity = lacunarity || 2.0; gain = gain || 0.5;
for (let i = 0; i < octaves; i++) {
val += amp * _smoothNoise3(x * freq, y * freq, z * freq);
amp *= gain; freq *= lacunarity;
}
return val;
}
function sphereCoords(x, y, W, H) {
const lat = Math.PI * (0.5 - y / H);
const lon = 2 * Math.PI * x / W;
return {
nx: Math.cos(lat) * Math.cos(lon),
ny: Math.cos(lat) * Math.sin(lon),
nz: Math.sin(lat),
lat, lon
};
}
function clamp(v, lo, hi) { return v < lo ? lo : v > hi ? hi : v; }
function lerp(a, b, t) { return a + (b - a) * t; }
function lerpColor(r1, g1, b1, r2, g2, b2, t) {
return [lerp(r1, r2, t) | 0, lerp(g1, g2, t) | 0, lerp(b1, b2, t) | 0];
}
function createTexture(type) {
const W = 1024, H = 512;
const canvas = document.createElement('canvas');
canvas.width = W; canvas.height = H;
const ctx = canvas.getContext('2d');
const imgData = ctx.createImageData(W, H);
const px = imgData.data;
function setP(x, y, r, g, b) {
const i = (y * W + x) * 4;
px[i] = r; px[i + 1] = g; px[i + 2] = b; px[i + 3] = 255;
}
function rand(a, b) { return Math.random() * (b - a) + a; }
// ═══════ SUN ═══════
if (type === 'sun') {
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const n1 = fbm3(s.nx * 4 + 10, s.ny * 4 + 10, s.nz * 4 + 10, 4, 2.2, 0.55);
const n2 = fbm3(s.nx * 8 + 30, s.ny * 8 + 30, s.nz * 8 + 30, 3, 2.5, 0.45);
const gran = fbm3(s.nx * 20 + 50, s.ny * 20 + 50, s.nz * 20 + 50, 2, 2, 0.5);
const v = n1 * 0.6 + n2 * 0.25 + gran * 0.15;
const r = clamp(200 + v * 55, 180, 255) | 0;
const g = clamp(120 + v * 135 - (1 - v) * 40, 50, 255) | 0;
const b = clamp(v * 60 - 20, 0, 80) | 0;
setP(x, y, r, g, b);
}
ctx.putImageData(imgData, 0, 0);
// Sunspots
for (let i = 0; i < 15; i++) {
const sx = rand(W * 0.1, W * 0.9), sy = rand(H * 0.2, H * 0.8), sr = rand(8, 35);
const grd = ctx.createRadialGradient(sx, sy, 0, sx, sy, sr);
grd.addColorStop(0, 'rgba(40,10,0,0.8)'); grd.addColorStop(0.4, 'rgba(80,20,0,0.5)');
grd.addColorStop(1, 'rgba(200,100,0,0)');
ctx.fillStyle = grd; ctx.beginPath(); ctx.arc(sx, sy, sr, 0, Math.PI * 2); ctx.fill();
}
// Bright granulation highlights
for (let i = 0; i < 4000; i++) {
const gx = rand(0, W), gy = rand(0, H), gr = rand(1, 5);
ctx.fillStyle = `rgba(255,${(rand(200, 255)) | 0},${(rand(50, 150)) | 0},${rand(0.1, 0.4)})`;
ctx.beginPath(); ctx.arc(gx, gy, gr, 0, Math.PI * 2); ctx.fill();
}
}
// ═══════ MERCURY ═══════
else if (type === 'rocky') {
// Base terrain with noise
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const n = fbm3(s.nx * 5 + 7, s.ny * 5 + 7, s.nz * 5 + 7, 4, 2.1, 0.48);
const fine = fbm3(s.nx * 25 + 3, s.ny * 25 + 3, s.nz * 25 + 3, 2, 2, 0.5);
const v = n * 0.75 + fine * 0.25;
const base = 90 + v * 80;
const r = clamp(base + rand(-5, 5), 60, 190) | 0;
const g = clamp(base - 5 + rand(-5, 5), 55, 180) | 0;
const b = clamp(base - 10 + rand(-3, 3), 50, 170) | 0;
setP(x, y, r, g, b);
}
ctx.putImageData(imgData, 0, 0);
// Caloris Basin (huge impact)
const cx = W * 0.35, cy = H * 0.4;
const cGrd = ctx.createRadialGradient(cx, cy, 0, cx, cy, 120);
cGrd.addColorStop(0, 'rgba(100,95,85,0.6)'); cGrd.addColorStop(0.5, 'rgba(120,115,105,0.4)');
cGrd.addColorStop(0.8, 'rgba(140,135,125,0.2)'); cGrd.addColorStop(1, 'rgba(150,145,135,0)');
ctx.fillStyle = cGrd; ctx.beginPath(); ctx.arc(cx, cy, 120, 0, Math.PI * 2); ctx.fill();
// Many impact craters of various sizes
for (let i = 0; i < 500; i++) {
const crx = rand(0, W), cry = rand(0, H), crr = rand(2, 40);
const depth = crr > 20 ? 0.6 : crr > 10 ? 0.5 : 0.35;
ctx.beginPath(); ctx.arc(crx, cry, crr, 0, Math.PI * 2);
ctx.strokeStyle = `rgba(50,48,44,${depth})`; ctx.lineWidth = crr > 15 ? 2 : 1; ctx.stroke();
// Crater floor (darker)
const innerGrd = ctx.createRadialGradient(crx, cry, 0, crx, cry, crr * 0.8);
innerGrd.addColorStop(0, `rgba(60,58,52,${depth * 0.5})`);
innerGrd.addColorStop(1, `rgba(100,96,88,0)`);
ctx.fillStyle = innerGrd; ctx.fill();
// Bright rim highlight
if (crr > 8) {
ctx.beginPath(); ctx.arc(crx - crr * 0.15, cry - crr * 0.15, crr * 1.02, 0, Math.PI * 2);
ctx.strokeStyle = `rgba(180,175,165,${depth * 0.3})`; ctx.lineWidth = 1; ctx.stroke();
}
// Ray ejecta for large craters
if (crr > 25) {
for (let r2 = 0; r2 < 8; r2++) {
const angle = rand(0, Math.PI * 2), len = rand(crr * 1.5, crr * 4);
ctx.beginPath(); ctx.moveTo(crx, cry);
ctx.lineTo(crx + Math.cos(angle) * len, cry + Math.sin(angle) * len);
ctx.strokeStyle = `rgba(170,165,155,0.15)`; ctx.lineWidth = rand(1, 3); ctx.stroke();
}
}
}
// Scarps (linear ridges)
for (let i = 0; i < 30; i++) {
ctx.beginPath();
let sx2 = rand(0, W), sy2 = rand(0, H);
ctx.moveTo(sx2, sy2);
for (let j = 0; j < 5; j++) { sx2 += rand(-60, 60); sy2 += rand(-30, 30); ctx.lineTo(sx2, sy2); }
ctx.strokeStyle = `rgba(80,75,68,${rand(0.15, 0.3)})`; ctx.lineWidth = rand(1, 2); ctx.stroke();
}
}
// ═══════ VENUS ═══════
else if (type === 'rocky_hot') {
// Dense sulfuric cloud bands
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const band = fbm3(s.nx * 2 + 5, s.ny * 2 + 15, s.nz * 2 + 5, 3, 2.0, 0.5);
const swirl = fbm3(s.nx * 6 + 20, s.ny * 6 + 20, s.nz * 6 + 20, 3, 2.2, 0.5);
const turb = fbm3(s.nx * 12 + 40, s.ny * 12 + 40, s.nz * 12 + 40, 2, 2.0, 0.45);
const fine = fbm3(s.nx * 30 + 60, s.ny * 30 + 60, s.nz * 30 + 60, 2, 2.0, 0.4);
const v = band * 0.35 + swirl * 0.3 + turb * 0.2 + fine * 0.15;
// Highland topology visible underneath
const topo = fbm3(s.nx * 3 + 80, s.ny * 3 + 80, s.nz * 3 + 80, 2, 2.0, 0.5);
const t = v * 0.85 + topo * 0.15;
const r = clamp(180 + t * 75, 150, 255) | 0;
const g = clamp(130 + t * 60 - (1 - t) * 10, 100, 210) | 0;
const b = clamp(50 + t * 40, 20, 120) | 0;
setP(x, y, r, g, b);
}
ctx.putImageData(imgData, 0, 0);
// Vortex patterns at poles
for (let p = 0; p < 2; p++) {
const py = p === 0 ? H * 0.05 : H * 0.95;
for (let i = 0; i < 60; i++) {
const a = rand(0, Math.PI * 2), r2 = rand(20, 150);
ctx.beginPath();
ctx.arc(W * 0.5 + Math.cos(a) * r2 * 0.3, py + Math.sin(a) * r2 * 0.15, rand(10, 40), 0, Math.PI * 2);
ctx.strokeStyle = `rgba(200,160,80,${rand(0.05, 0.15)})`; ctx.lineWidth = rand(1, 3); ctx.stroke();
}
}
// Lightning glow spots
for (let i = 0; i < 12; i++) {
const lx = rand(W * 0.1, W * 0.9), ly = rand(H * 0.15, H * 0.85);
const lg = ctx.createRadialGradient(lx, ly, 0, lx, ly, rand(15, 40));
lg.addColorStop(0, 'rgba(255,240,180,0.15)'); lg.addColorStop(1, 'rgba(255,200,100,0)');
ctx.fillStyle = lg; ctx.beginPath(); ctx.arc(lx, ly, 40, 0, Math.PI * 2); ctx.fill();
}
}
// ═══════ EARTH ═══════
else if (type === 'earth') {
// Generate heightmap for realistic continents
const heightMap = new Float32Array(W * H);
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
// Multi-scale continental noise
const cont = fbm3(s.nx * 2.5 + 10, s.ny * 2.5 + 10, s.nz * 2.5 + 10, 5, 2.1, 0.52);
const detail = fbm3(s.nx * 8 + 30, s.ny * 8 + 30, s.nz * 8 + 30, 3, 2.0, 0.48);
const fine = fbm3(s.nx * 20 + 50, s.ny * 20 + 50, s.nz * 20 + 50, 2, 2.0, 0.45);
const micro = fbm3(s.nx * 50 + 70, s.ny * 50 + 70, s.nz * 50 + 70, 2, 2.0, 0.4);
const h = cont * 0.55 + detail * 0.25 + fine * 0.13 + micro * 0.07;
heightMap[y * W + x] = h;
}
// Find sea level to get ~70% ocean coverage
const sorted = Float32Array.from(heightMap).sort();
const seaLevel = sorted[Math.floor(W * H * 0.62)];
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const h = heightMap[y * W + x];
const absLat = Math.abs(s.lat) / (Math.PI / 2);
let r, g, b;
if (h < seaLevel) {
// OCEAN with depth shading
const depth = clamp((seaLevel - h) / 0.3, 0, 1);
const shallow = depth < 0.15;
if (shallow) {
// Coastal shallow water (lighter blue-green)
const t = depth / 0.15;
[r, g, b] = lerpColor(70, 180, 170, 40, 120, 170, t);
} else {
// Deep ocean
const t = clamp((depth - 0.15) / 0.85, 0, 1);
[r, g, b] = lerpColor(30, 100, 165, 8, 25, 80, t);
}
// Polar ocean is darker/greyer
if (absLat > 0.7) {
const pt = (absLat - 0.7) / 0.3;
r = lerp(r, r * 0.7 + 40, pt) | 0;
g = lerp(g, g * 0.7 + 50, pt) | 0;
b = lerp(b, b * 0.8 + 40, pt) | 0;
}
} else {
// LAND — biome based on latitude and elevation
const elev = clamp((h - seaLevel) / 0.25, 0, 1);
const moisture = fbm3(s.nx * 5 + 100, s.ny * 5 + 100, s.nz * 5 + 100, 2, 2, 0.5);
if (absLat > 0.82) {
// Ice cap
const snow = fbm3(s.nx * 15 + 90, s.ny * 15 + 90, s.nz * 15 + 90, 2, 2, 0.5);
r = clamp(220 + snow * 35, 210, 255) | 0;
g = clamp(230 + snow * 25, 220, 255) | 0;
b = clamp(240 + snow * 15, 235, 255) | 0;
} else if (absLat > 0.65) {
// Tundra / boreal
const t = (absLat - 0.65) / 0.17;
if (t > 0.6) {
// Snow-dusted
[r, g, b] = lerpColor(140, 155, 130, 210, 220, 215, (t - 0.6) / 0.4);
} else {
// Dark boreal forest
[r, g, b] = lerpColor(50, 80, 40, 100, 120, 80, t / 0.6);
}
} else if (absLat > 0.4) {
// Temperate — forests and grasslands
if (elev > 0.7) {
// Mountain snow
[r, g, b] = lerpColor(160, 155, 140, 230, 230, 225, (elev - 0.7) / 0.3);
} else if (elev > 0.5) {
// Rocky mountains
r = (130 + elev * 40) | 0; g = (125 + elev * 30) | 0; b = (110 + elev * 20) | 0;
} else if (moisture > 0.45) {
// Forest
r = (30 + elev * 50) | 0; g = (90 + elev * 60 + moisture * 30) | 0; b = (25 + elev * 30) | 0;
} else {
// Grassland
r = (80 + elev * 50) | 0; g = (120 + elev * 40) | 0; b = (40 + elev * 25) | 0;
}
} else if (absLat > 0.15) {
// Subtropical
if (elev > 0.6) {
r = (150 + elev * 50) | 0; g = (140 + elev * 40) | 0; b = (110 + elev * 30) | 0;
} else if (moisture < 0.35) {
// Desert
const dn = fbm3(s.nx * 12 + 120, s.ny * 12 + 120, s.nz * 12 + 120, 2, 2, 0.5);
r = (190 + dn * 40) | 0; g = (170 + dn * 30) | 0; b = (120 + dn * 25) | 0;
} else {
// Mediterranean / savanna
r = (90 + elev * 50) | 0; g = (110 + elev * 45 + moisture * 20) | 0; b = (40 + elev * 20) | 0;
}
} else {
// Tropical
if (elev > 0.6) {
r = (120 + elev * 50) | 0; g = (115 + elev * 40) | 0; b = (100 + elev * 30) | 0;
} else if (moisture > 0.4) {
// Tropical rainforest (deep green)
r = (15 + elev * 35) | 0; g = (70 + elev * 60 + moisture * 25) | 0; b = (10 + elev * 25) | 0;
} else if (moisture < 0.25) {
// Arid tropical
r = (170 + elev * 40) | 0; g = (145 + elev * 35) | 0; b = (90 + elev * 25) | 0;
} else {
// Tropical grassland
r = (70 + elev * 50) | 0; g = (100 + elev * 50) | 0; b = (30 + elev * 20) | 0;
}
}
// Coastal beach fringe
if (h < seaLevel + 0.005 && h >= seaLevel) {
r = clamp(r * 0.5 + 100, 160, 220) | 0;
g = clamp(g * 0.5 + 90, 155, 210) | 0;
b = clamp(b * 0.3 + 60, 100, 160) | 0;
}
}
setP(x, y, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255));
}
ctx.putImageData(imgData, 0, 0);
// River systems (thin blue lines following terrain gradients)
ctx.strokeStyle = 'rgba(30,90,160,0.35)'; ctx.lineWidth = 1;
for (let ri = 0; ri < 80; ri++) {
let rx = (rand(0, W)) | 0, ry = (rand(H * 0.1, H * 0.9)) | 0;
if (heightMap[ry * W + rx] < seaLevel) continue;
ctx.beginPath(); ctx.moveTo(rx, ry);
for (let step = 0; step < 200; step++) {
let minH = heightMap[ry * W + rx], bestX = rx, bestY = ry;
for (let dy = -1; dy <= 1; dy++) for (let dx = -1; dx <= 1; dx++) {
const nx2 = (rx + dx + W) % W, ny2 = clamp(ry + dy, 0, H - 1);
if (heightMap[ny2 * W + nx2] < minH) { minH = heightMap[ny2 * W + nx2]; bestX = nx2; bestY = ny2; }
}
if (bestX === rx && bestY === ry) break;
rx = bestX; ry = bestY;
ctx.lineTo(rx, ry);
if (heightMap[ry * W + rx] < seaLevel) break;
}
ctx.stroke();
}
}
// ═══════ MARS ═══════
else if (type === 'rocky_red') {
// Detailed terrain
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const absLat = Math.abs(s.lat) / (Math.PI / 2);
const terrain = fbm3(s.nx * 4 + 15, s.ny * 4 + 15, s.nz * 4 + 15, 4, 2.1, 0.5);
const detail = fbm3(s.nx * 15 + 35, s.ny * 15 + 35, s.nz * 15 + 35, 3, 2.0, 0.45);
const albedo = fbm3(s.nx * 2 + 55, s.ny * 2 + 55, s.nz * 2 + 55, 3, 2.0, 0.5);
const v = terrain * 0.5 + detail * 0.25 + albedo * 0.25;
let r, g, b;
if (absLat > 0.85) {
// Polar ice cap
const ice = fbm3(s.nx * 10 + 80, s.ny * 10 + 80, s.nz * 10 + 80, 2, 2, 0.5);
const t = (absLat - 0.85) / 0.15;
const ir = 220 + ice * 35, ig = 225 + ice * 30, ib = 235 + ice * 20;
r = lerp(160 + v * 50, ir, t) | 0;
g = lerp(70 + v * 20, ig, t) | 0;
b = lerp(50 + v * 15, ib, t) | 0;
} else if (albedo > 0.52) {
// Dark terrain regions (like Syrtis Major)
r = clamp(100 + v * 40, 70, 150) | 0;
g = clamp(45 + v * 20, 30, 80) | 0;
b = clamp(30 + v * 15, 20, 60) | 0;
} else {
// Bright rust terrain
r = clamp(165 + v * 60, 120, 230) | 0;
g = clamp(75 + v * 35, 50, 120) | 0;
b = clamp(45 + v * 25, 25, 80) | 0;
}
setP(x, y, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255));
}
ctx.putImageData(imgData, 0, 0);
// Olympus Mons (huge shield volcano)
const omx = W * 0.38, omy = H * 0.35;
const omGrd = ctx.createRadialGradient(omx, omy, 0, omx, omy, 80);
omGrd.addColorStop(0, 'rgba(100,40,25,0.5)'); omGrd.addColorStop(0.2, 'rgba(140,60,35,0.35)');
omGrd.addColorStop(0.7, 'rgba(170,80,50,0.15)'); omGrd.addColorStop(1, 'rgba(180,90,55,0)');
ctx.fillStyle = omGrd; ctx.beginPath(); ctx.arc(omx, omy, 80, 0, Math.PI * 2); ctx.fill();
// Caldera
ctx.beginPath(); ctx.arc(omx, omy, 12, 0, Math.PI * 2);
ctx.fillStyle = 'rgba(60,25,15,0.6)'; ctx.fill();
ctx.strokeStyle = 'rgba(80,35,20,0.4)'; ctx.lineWidth = 2; ctx.stroke();
// Valles Marineris (canyon system)
ctx.beginPath(); ctx.moveTo(W * 0.45, H * 0.47);
ctx.bezierCurveTo(W * 0.5, H * 0.46, W * 0.55, H * 0.48, W * 0.65, H * 0.47);
ctx.bezierCurveTo(W * 0.7, H * 0.465, W * 0.72, H * 0.46, W * 0.75, H * 0.47);
ctx.strokeStyle = 'rgba(60,20,10,0.6)'; ctx.lineWidth = 6; ctx.stroke();
ctx.strokeStyle = 'rgba(90,35,20,0.3)'; ctx.lineWidth = 12; ctx.stroke();
// Impact craters
for (let i = 0; i < 300; i++) {
const crx = rand(0, W), cry = rand(0, H), crr = rand(2, 25);
ctx.beginPath(); ctx.arc(crx, cry, crr, 0, Math.PI * 2);
ctx.strokeStyle = `rgba(80,30,15,${crr > 10 ? 0.35 : 0.2})`; ctx.lineWidth = 1; ctx.stroke();
if (crr > 8) {
const ig2 = ctx.createRadialGradient(crx, cry, 0, crx, cry, crr * 0.7);
ig2.addColorStop(0, 'rgba(70,25,12,0.25)'); ig2.addColorStop(1, 'rgba(120,50,30,0)');
ctx.fillStyle = ig2; ctx.fill();
}
}
// Dust storm wisps
for (let i = 0; i < 20; i++) {
ctx.beginPath();
const dx = rand(0, W), dy = rand(H * 0.2, H * 0.8);
ctx.ellipse(dx, dy, rand(30, 100), rand(8, 25), rand(0, Math.PI), 0, Math.PI * 2);
ctx.fillStyle = `rgba(200,140,90,${rand(0.04, 0.1)})`; ctx.fill();
}
}
// ═══════ JUPITER ═══════
else if (type === 'gas_giant_jupiter') {
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const bLat = s.lat / (Math.PI / 2); // -1 to 1
// Atmospheric bands with turbulence
const bandBase = Math.sin(bLat * 14) * 0.5 + 0.5;
const turb = fbm3(s.nx * 6 + 5, s.ny * 6 + bLat * 3 + 5, s.nz * 6 + 5, 3, 2.2, 0.5);
const fine = fbm3(s.nx * 20 + 25, s.ny * 20 + 25, s.nz * 20 + 25, 3, 2.0, 0.45);
const micro = fbm3(s.nx * 40 + 45, s.ny * 40 + 45, s.nz * 40 + 45, 2, 2.0, 0.4);
const v = bandBase * 0.4 + turb * 0.3 + fine * 0.2 + micro * 0.1;
// Band edge turbulence (eddies)
const edgeTurb = fbm3(s.nx * 12 + 65, s.ny * 12 + 65, s.nz * 12 + 65, 3, 2.3, 0.5);
const vt = v + edgeTurb * 0.08;
let r, g, b;
if (vt > 0.65) {
// Light zone
[r, g, b] = lerpColor(230, 195, 100, 245, 215, 130, (vt - 0.65) / 0.35);
} else if (vt > 0.45) {
// Mid band
[r, g, b] = lerpColor(180, 120, 50, 210, 160, 70, (vt - 0.45) / 0.2);
} else if (vt > 0.3) {
// Dark belt
[r, g, b] = lerpColor(110, 60, 25, 160, 95, 40, (vt - 0.3) / 0.15);
} else {
// Very dark belt
[r, g, b] = lerpColor(70, 35, 15, 110, 55, 25, vt / 0.3);
}
setP(x, y, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255));
}
ctx.putImageData(imgData, 0, 0);
// Great Red Spot (complex layered storm)
const grsX = W * 0.6, grsY = H * 0.57;
for (let layer = 0; layer < 8; layer++) {
const lr = 90 - layer * 8, lh = 55 - layer * 5;
const rot = layer * 0.15;
ctx.save(); ctx.translate(grsX, grsY); ctx.rotate(rot);
const grsGrd = ctx.createRadialGradient(0, 0, 0, 0, 0, lr);
const op = layer < 3 ? 0.3 : 0.15;
if (layer < 3) {
grsGrd.addColorStop(0, `rgba(180,50,20,${op})`);
grsGrd.addColorStop(0.5, `rgba(200,70,30,${op * 0.7})`);
grsGrd.addColorStop(1, `rgba(210,100,50,0)`);
} else {
grsGrd.addColorStop(0, `rgba(210,80,30,${op})`);
grsGrd.addColorStop(1, `rgba(220,120,60,0)`);
}
ctx.fillStyle = grsGrd; ctx.beginPath(); ctx.ellipse(0, 0, lr, lh, 0, 0, Math.PI * 2); ctx.fill();
ctx.restore();
}
// White ovals & smaller storms
const storms = [[W * 0.25, H * 0.68, 30, 18], [W * 0.8, H * 0.42, 22, 14], [W * 0.15, H * 0.35, 18, 10], [W * 0.7, H * 0.72, 25, 15]];
storms.forEach(([sx2, sy2, sw, sh]) => {
const sg = ctx.createRadialGradient(sx2, sy2, 0, sx2, sy2, sw);
sg.addColorStop(0, 'rgba(240,230,200,0.3)'); sg.addColorStop(0.6, 'rgba(230,210,170,0.15)');
sg.addColorStop(1, 'rgba(220,190,140,0)');
ctx.fillStyle = sg; ctx.beginPath(); ctx.ellipse(sx2, sy2, sw, sh, 0, 0, Math.PI * 2); ctx.fill();
});
// Band-edge chevron patterns
for (let i = 0; i < 80; i++) {
const cx2 = rand(0, W), cy2 = rand(0, H);
ctx.beginPath(); ctx.ellipse(cx2, cy2, rand(8, 35), rand(2, 6), rand(-0.3, 0.3), 0, Math.PI * 2);
ctx.strokeStyle = `rgba(180,140,70,${rand(0.05, 0.15)})`; ctx.lineWidth = 1; ctx.stroke();
}
}
// ═══════ SATURN ═══════
else if (type === 'gas_giant_saturn') {
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const bLat = s.lat / (Math.PI / 2);
const band = Math.sin(bLat * 12) * 0.5 + 0.5;
const turb = fbm3(s.nx * 5 + 10, s.ny * 5 + 10, s.nz * 5 + 10, 3, 2.0, 0.48);
const fine = fbm3(s.nx * 18 + 30, s.ny * 18 + 30, s.nz * 18 + 30, 3, 2.0, 0.45);
const v = band * 0.5 + turb * 0.3 + fine * 0.2;
let r, g, b;
if (v > 0.6) {
[r, g, b] = lerpColor(235, 210, 150, 245, 225, 175, (v - 0.6) / 0.4);
} else if (v > 0.35) {
[r, g, b] = lerpColor(200, 170, 100, 225, 195, 130, (v - 0.35) / 0.25);
} else {
[r, g, b] = lerpColor(160, 130, 70, 195, 160, 90, v / 0.35);
}
// North polar hexagon region
if (bLat > 0.8) {
const hexAngle = Math.atan2(s.ny, s.nx);
const hexR = Math.cos(Math.PI / 6) / Math.cos((hexAngle % (Math.PI / 3)) - Math.PI / 6);
const polarDist = (bLat - 0.8) / 0.2;
const hexV = Math.sin(hexAngle * 3 + polarDist * 6) * 0.15;
r = clamp(r - polarDist * 40 + hexV * 30, 80, 255) | 0;
g = clamp(g - polarDist * 30 + hexV * 25, 70, 255) | 0;
b = clamp(b - polarDist * 10 + hexV * 15, 50, 255) | 0;
}
setP(x, y, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255));
}
ctx.putImageData(imgData, 0, 0);
// Subtle storms
for (let i = 0; i < 25; i++) {
const sx2 = rand(0, W), sy2 = rand(H * 0.15, H * 0.85);
ctx.beginPath(); ctx.ellipse(sx2, sy2, rand(10, 45), rand(4, 12), rand(-0.2, 0.2), 0, Math.PI * 2);
ctx.fillStyle = `rgba(240,220,160,${rand(0.03, 0.08)})`; ctx.fill();
}
}
// ═══════ URANUS ═══════
else if (type === 'ice_giant_uranus') {
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const bLat = s.lat / (Math.PI / 2);
const haze = fbm3(s.nx * 3 + 8, s.ny * 3 + 8, s.nz * 3 + 8, 3, 2.0, 0.48);
const band = fbm3(s.nx * 1.5 + 20, s.ny * 1.5 + 20, s.nz * 1.5 + 20, 3, 2.0, 0.5);
const detail = fbm3(s.nx * 12 + 40, s.ny * 12 + 40, s.nz * 12 + 40, 3, 2.0, 0.45);
const fine = fbm3(s.nx * 30 + 60, s.ny * 30 + 60, s.nz * 30 + 60, 2, 2.0, 0.4);
const v = haze * 0.35 + band * 0.3 + detail * 0.2 + fine * 0.15;
// Subtle latitude-dependent color shift
const latTint = Math.abs(bLat);
let r = clamp(100 + v * 50 + latTint * 20, 70, 180) | 0;
let g = clamp(200 + v * 35 - latTint * 10, 170, 250) | 0;
let b = clamp(210 + v * 30 - latTint * 5, 180, 250) | 0;
// Polar brightening
if (latTint > 0.7) {
const pt = (latTint - 0.7) / 0.3;
r = lerp(r, r + 30, pt) | 0; g = lerp(g, g + 15, pt) | 0; b = lerp(b, b + 10, pt) | 0;
}
setP(x, y, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255));
}
ctx.putImageData(imgData, 0, 0);
// Methane cloud patches
for (let i = 0; i < 40; i++) {
const cx2 = rand(0, W), cy2 = rand(0, H);
const cg = ctx.createRadialGradient(cx2, cy2, 0, cx2, cy2, rand(10, 40));
cg.addColorStop(0, `rgba(180,240,240,${rand(0.05, 0.12)})`); cg.addColorStop(1, 'rgba(150,220,220,0)');
ctx.fillStyle = cg; ctx.beginPath(); ctx.arc(cx2, cy2, rand(10, 40), 0, Math.PI * 2); ctx.fill();
}
}
// ═══════ NEPTUNE ═══════
else if (type === 'ice_giant_neptune') {
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
const bLat = s.lat / (Math.PI / 2);
const atmo = fbm3(s.nx * 3 + 12, s.ny * 3 + 12, s.nz * 3 + 12, 4, 2.1, 0.5);
const band = Math.sin(bLat * 10) * 0.3;
const turb = fbm3(s.nx * 8 + 30, s.ny * 8 + 30, s.nz * 8 + 30, 3, 2.2, 0.48);
const detail = fbm3(s.nx * 20 + 50, s.ny * 20 + 50, s.nz * 20 + 50, 3, 2.0, 0.45);
const v = atmo * 0.35 + band * 0.2 + turb * 0.25 + detail * 0.2;
let r = clamp(20 + v * 40, 10, 80) | 0;
let g = clamp(40 + v * 50 + Math.abs(bLat) * 15, 25, 110) | 0;
let b = clamp(140 + v * 80, 100, 230) | 0;
setP(x, y, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255));
}
ctx.putImageData(imgData, 0, 0);
// Great Dark Spot
const gdx = W * 0.3, gdy = H * 0.45;
for (let layer = 0; layer < 5; layer++) {
const lr = 65 - layer * 8, lh = 42 - layer * 5;
const gd = ctx.createRadialGradient(gdx, gdy, 0, gdx, gdy, lr);
gd.addColorStop(0, `rgba(10,15,${80 - layer * 10},${0.35 - layer * 0.05})`);
gd.addColorStop(1, `rgba(20,30,${100 - layer * 8},0)`);
ctx.fillStyle = gd; ctx.beginPath(); ctx.ellipse(gdx, gdy, lr, lh, 0.15, 0, Math.PI * 2); ctx.fill();
}
// Bright companion clouds ("Scooter" and others)
const brightClouds = [[W * 0.35, H * 0.38, 25, 10], [W * 0.55, H * 0.6, 35, 8], [W * 0.7, H * 0.35, 20, 6], [W * 0.15, H * 0.55, 28, 7]];
brightClouds.forEach(([bx, by, bw, bh]) => {
ctx.beginPath(); ctx.ellipse(bx, by, bw, bh, rand(-0.3, 0.3), 0, Math.PI * 2);
ctx.fillStyle = `rgba(150,180,255,${rand(0.15, 0.3)})`; ctx.fill();
});
// High-altitude methane clouds
for (let i = 0; i < 60; i++) {
const mcx = rand(0, W), mcy = rand(0, H);
ctx.beginPath(); ctx.ellipse(mcx, mcy, rand(5, 25), rand(2, 8), rand(0, Math.PI), 0, Math.PI * 2);
ctx.fillStyle = `rgba(120,160,255,${rand(0.05, 0.15)})`; ctx.fill();
}
}
if (type !== 'sun' && type !== 'earth' && type !== 'rocky' && type !== 'rocky_hot' && type !== 'rocky_red' &&
type !== 'gas_giant_jupiter' && type !== 'gas_giant_saturn' && type !== 'ice_giant_uranus' && type !== 'ice_giant_neptune') {
// Fallback
ctx.fillStyle = '#444'; ctx.fillRect(0, 0, W, H);
}
const tex = new THREE.CanvasTexture(canvas);
tex.anisotropy = renderer.capabilities.getMaxAnisotropy();
return tex;
}
// ═══════ EARTH CLOUD LAYER TEXTURE ═══════
function createCloudTexture() {
const W = 512, H = 256;
const canvas = document.createElement('canvas');
canvas.width = W; canvas.height = H;
const ctx = canvas.getContext('2d');
const imgData = ctx.createImageData(W, H);
const px = imgData.data;
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
// Multi-octave cloud noise at different scales
const c1 = fbm3(s.nx * 3 + 200, s.ny * 3 + 200, s.nz * 3 + 200, 4, 2.0, 0.55);
const c2 = fbm3(s.nx * 8 + 220, s.ny * 8 + 220, s.nz * 8 + 220, 3, 2.2, 0.5);
const c3 = fbm3(s.nx * 20 + 240, s.ny * 20 + 240, s.nz * 20 + 240, 2, 2.0, 0.45);
const cloud = c1 * 0.5 + c2 * 0.3 + c3 * 0.2;
// Threshold for cloud visibility
const threshold = 0.42;
let alpha = 0;
if (cloud > threshold) {
alpha = clamp((cloud - threshold) / 0.25, 0, 0.85);
// Thicker clouds near equator
const absLat = Math.abs(s.lat) / (Math.PI / 2);
if (absLat < 0.3) alpha *= 1.1;
// Less clouds at poles
if (absLat > 0.8) alpha *= 0.4;
}
const i = (y * W + x) * 4;
px[i] = 255; px[i + 1] = 255; px[i + 2] = 255; px[i + 3] = clamp(alpha * 255, 0, 255) | 0;
}
ctx.putImageData(imgData, 0, 0);
const tex = new THREE.CanvasTexture(canvas);
tex.anisotropy = renderer.capabilities.getMaxAnisotropy();
return tex;
}
// ═══════ TERRAIN MAP GENERATOR (Normal + Displacement + Specular) ═══════
function createTerrainMaps(type) {
const W = 512, H = 256;
const heights = new Float32Array(W * H);
// Generate heightmap
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const s = sphereCoords(x, y, W, H);
let h;
if (type === 'earth') {
h = fbm3(s.nx * 2.5 + 10, s.ny * 2.5 + 10, s.nz * 2.5 + 10, 5, 2.1, 0.52) * 0.45
+ fbm3(s.nx * 8 + 30, s.ny * 8 + 30, s.nz * 8 + 30, 3, 2.0, 0.48) * 0.3
+ fbm3(s.nx * 20 + 50, s.ny * 20 + 50, s.nz * 20 + 50, 2, 2.0, 0.45) * 0.25;
} else if (type === 'rocky_red') {
h = fbm3(s.nx * 4 + 15, s.ny * 4 + 15, s.nz * 4 + 15, 4, 2.1, 0.5) * 0.5
+ fbm3(s.nx * 15 + 35, s.ny * 15 + 35, s.nz * 15 + 35, 3, 2.0, 0.45) * 0.3
+ fbm3(s.nx * 2 + 55, s.ny * 2 + 55, s.nz * 2 + 55, 2, 2.0, 0.5) * 0.2;
} else {
h = fbm3(s.nx * 5 + 7, s.ny * 5 + 7, s.nz * 5 + 7, 4, 2.1, 0.48) * 0.55
+ fbm3(s.nx * 25 + 3, s.ny * 25 + 3, s.nz * 25 + 3, 3, 2, 0.5) * 0.45;
}
heights[y * W + x] = h;
}
// ── NORMAL MAP (much sharper surface detail than bump) ──
const normCanvas = document.createElement('canvas');
normCanvas.width = W; normCanvas.height = H;
const nctx = normCanvas.getContext('2d');
const nImg = nctx.createImageData(W, H);
const npx = nImg.data;
const str = { earth: 6, rocky_red: 8, rocky: 10, rocky_hot: 5 }[type] || 6;
for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {
const l = heights[y * W + ((x - 1 + W) % W)];
const r = heights[y * W + ((x + 1) % W)];
const u = heights[((y - 1 + H) % H) * W + x];
const d = heights[((y + 1) % H) * W + x];
let dnx = (l - r) * str;
let dny = (u - d) * str;
let dnz = 1.0;
const len = Math.sqrt(dnx * dnx + dny * dny + dnz * dnz);
const i = (y * W + x) * 4;
npx[i] = clamp((dnx / len * 0.5 + 0.5) * 255, 0, 255) | 0;
npx[i + 1] = clamp((dny / len * 0.5 + 0.5) * 255, 0, 255) | 0;