Tides symulation
- 18 Devlogs
- 59 Total hours
A 3d visualizer and symulation of how tides caused by satelites(for eg. Moon) act on fluids and create tides.
A 3d visualizer and symulation of how tides caused by satelites(for eg. Moon) act on fluids and create tides.
I added a UI to the web page!
It features:
-camera controls: rotating, zooming and home position
-simulation parameters which you can change with sliders.
Everything is conected to the simulation via “cwrap”, which makes you able to use some of your functions, from the c program, in java script.
I went through multiple layout and I am still not shure if I will keep this one.
This was my first time building something like this so I took some help from the AI while making the trackpad and the sliders.
I added a trail behind the satelite to make this more interesting and a direction indicator(which you can turn off) so you know where the satelite is when you zoom in.
I also started working on the shell file which basically grabs the render and ads html features. All the info and other thing will be in this grey area(for now, maybe I will change them later).
BIG NEWS!
I was finally able to convert my C code to WASM using emscripten. I run it on local hosted server but I still cant make it work on github pages.
I also moved part of physics calculations to a specified shader which should significantly boost the performace.
I optimized my simulation and added a camera orientation indicator(top-right corner). It was much harder than I expected but It looks cool.
I am now working on rewriting may program so I can later convert it to WASM using emscriptem. I also made the satelite distance modifiable.
Added an option for user input. Now I will focus on adding friction to the moving ocean.
I fixed some scaling bugs, but there still some left and i cant figure how to fix them.
I also need to add friction soon.
View after fixing radious bug:
I replaced some floats with doubles for better precision and improved the information tab.
Made a huge rework today:
-Reworked the entire pipeline and data structures to make code cleaner and more efficient.
-Fixed some physics mistakes with scales I made before.
-Fixed rendering bug which appeared when I chaned rendering order to a propper one.
Made a custom Information tab, It shows simulation data.
This took me some time, but I am happy with the results.
I added camera movement, for now the camera is centered on the planet but I might change it in the future. I neede to add and rework few functions to make this work.
There was also a major problem, which I learnt is called “gimbal lock”. Before I fixed It the camera was getting flipped when It rotated 90 degrees.
There is also a zoom option(2’nd picture).
I scaled everything to real proportions of earth and moon. Improved pipeline by adding rendering functions and reducing the number of shaders. Made the moon orbit, to see it move I added a second time scale(not based on SI) to make the orbits fast without affecting other scales.
I still need to correct the water based on updated moon position.
Finaly the geometry is calculated by the satelite’s gravity. In a normal scenario the wouldn’t be visible in that scale so I needed to bring the moon verry close to the planet(It is now invisible) and increese its mass.
I am planning to make a zoom options so the deformations will be vissible even with the real data
I tested the fluid deformation in real time(made a small menu to debug it). It wasnt calculated based on physics, i was just incrementing position(this is position of the right peak, the rest is calculated based on that).
Of course i needed to scale it a bit, so you can see the water deformation.
It looks realy cool when the water is “streched” too much:
Fixed a huge geometry bug, made a shader for the water layer. The hardest part was configuring the pipeline so that the water layer and core don’t interfere whith themselfs and break.
Current view:
I improved my shader for solid bodies:
-shading responds to motion(previously it looked like the light sorce was moving with the object)
-now the shading is done per pixel(not per vertex)
-a bit of color is added to the opposite side
Here you can see before and after:
Today i focused on the physics part of the fluid shape. I used quadrupolar tidal bulge approximation via P₂ Legendre polynomial. In terms of physics it sounds complicated, but was easier than i exepected. However I spend a lot of time trying to get the geometry right, becaose my sphere generating algorithm is pretty weird.
Made basic pipeline for my symulation, improved shader use by creating helpful functions. This will be the core of the planet(it wont change geometry) so that was the easier part.