Three JS and Physics Behavior Testing

Lab1 - Some shadow testing.

Lab1 experiments with shadow effects and keyboard control. The small cube is the "test subject". There is a small octahedron on the forward facing face so that you can keep track of your orientation. This lab is not "mobile device friendly" except for when using Orbital Controls because I have not incorportated any kind of pointer select with grab/drag features (future lab). The following keys control the small cube's behavior:

Key Behavior
w Move 1 unit forward.
s Move 1 unit backward.
a Move 1 unit left.
d Move 1 unit right.
q Roll 1 unit left.
e Roll 1 unit right.
r Yaw 1 unit left.
f Yaw 1 unit right.
z Pitch 1 unit down.
x Pitch 1 unit up.
space Move 1 unit up.
c Move 1 unit down
o Switch to Orbital Controls mode: hold left button down to rotate, hold right button down to move camera, use wheel to zoom in and out.
p Switch to Object Perspective mode (3D first-person for small cube). There is no Zoom while in this mode.

Lab2 - Our solar system to scale.

This lab begins to setup our solar system to scale. For now I have placed both the sun and the earth into the scene, together with a ship.

Key Behavior
g Translate ship to Sun location.
b Translate ship to Earth location.
p Change view to ship perspective.
l Change view to closeup of sun.
t Change view to earth.
o Change view to sun at distance.
1 Forward Ship View
2 Backward Ship View
3 Left Ship View
4 Right Ship View
5 Top Ship View
6 Bottom Ship View

Lab3 - Our solar system to scale with gravity. This one is fun! Put yourself in LEO and enjoy the view as you whip around the Earth at 7 km/s.

Fun factoid: humans can only handle approximately 2 G for any sustained period of time. Anything over 2 G starts to get very uncomfortable. Something like 80 G -- which is what the acceleration slider will allow you to use for the shp -- would kill a human. So, if you want a "realistic" experience, keep acceleration below 2 G. It will give you an appreciation for the distances and object sizes in this simulation. Also, when you can only accelerate at 2 G, or maybe 3 G, mistakes in your navigation will become apparent when you try to postion the ship into an orbit :) 80 G is for wusses unless you are travelling to the sun (which would be masochistic at anything slower than 80 G :))!

As a reminder, for now there is no managed session state, so a page refresh or any navigation from simulation page, will reset everything.

Lab4 WIP attempt to stop with ESC

This lab is also the index reference.

Lab5 An axample from ThreeJS that I'm using to test with go templates...

Lab6 Javascript testing

A place to sample snippets of javascript to test compatibility. Also a place to view icons.

Lab7 Galaxy testing
Lab8 Lab7, but using particle shader... Standard Galaxy
Lab9 Lab7, but using particle shader... Large Galaxy
Lab10 Lab7, but using particle shader... Standard Galaxy with particle size effect
Lab8 is a decent representation of a spiral galaxy with modest memory requirements (about 4mb). There are around 10,000 stars in the galaxy.
Lab9 is a large galaxy with over 136000 stars with large memory requirement of 12mb.
Lab 10 shows particle effect using shader to continuously alter the size of a star.

Test galaxy generation.

  • I use a Fermat Spiral to model a galaxy. In particular, see "The golden ratio and the golden angle."
  • The other types to be added later: logarithmic spiral, Archimedean spiral, an x cubed shape, and a spherical shape distribution.
  • Variables for procedural generation will include galactic ecliptic inclination, stellar ecliptic inclination, stellar type, planetary and asteroid density, and much more.
  • The next step is to create a procedural generator on the backend that will (1) generate the galaxy list, (2) generate and persist stelar information, (3) generate planets and moons.
  • This next work will include API REST endpoints for retrieving a galaxy star list.
  • Interaction starts with Galaxy map. User then can drill in on a particular galaxy to view stars, then click on stars to view planetary systems.
  • Left clicking on an element will select it. Right clicking on element will generate an option menu object.
  • Improve the Fermat Spiral by introducing pseudo random offsets to the star locations to give a more natural look.