An open API service indexing awesome lists of open source software.

https://github.com/iveevi/tranquil


https://github.com/iveevi/tranquil

Last synced: 8 months ago
JSON representation

Awesome Lists containing this project

README

          

# Tranquil

Tranquil is a relaxing simulation of complex effects like caustics, clouds, water, and wind. It is written in C++ and uses OpenGL for rendering.

This project intends to explore many other effects. However, the current `main` branch will no longer be maintained. Please see the new `rust` branch for more active development.

See a short video of the current state of the project [here](https://www.youtube.com/watch?v=eTDaw-ayivQ).

# Running

The project is built with [smake](https://github.com/vedavamadathil/smake). Once `smake` has been installed in your system, simply run `smake main -j [THREADS]` and the executable will be built and run.

# Details

Video demo above has a relatively low resolution; this was intended as an artistic choice. In the end, I want to achieve a pretty simulation which is visually pleasing and complex at the same time.

The rendering is done using raytracing through GLSL shaders. To reduce the cost of rendering and keeping the simulation somewhat pleasing to watch, the resolution is divided in two in both dimensions (so every ray cast will correspond to 4 pixels).

The current features are listed below.

* **Basic mesh rendering:** uses standard BVHs to accelerate ray intersection tests.
* **Height map:** generated with 2D Perlin noise, and raytraced with a simple, but error-prone, ray marching algorithm.
* **Grass:** there are actually two ways grass is shown and simulated
* **Height map offset:** an additional, higher frequency layer of Perlin noise is added to the height map to emulate grass.
* **Bezier curves:** individual grass blades are parametrized by quadratic bezier curves, and rendered using a standard ray intersection test. By itself this is a very intensive task -- beware when trying for yourself! To improve performance a bit these blades are reduced to a simple line when they are far enough from the camera.
* **Wind:** Also depends on a Perlin noise map. Random velocities are generated per time step, and the map is updated accordingly. The wind is then applied to the grass blades.
* **Water:** Convincing water waves are generated by sliding independent normal textures across the water surface -- water is currently a flat place.
* **Clouds:** Currently based on a 2D Perlin noise map. The clouds are rendered by splatting them onto a rectangle in the sky (I know, not very realistic). The clouds cast shadows onto the ground, and move according to the wind velocities.
* **Sun:** moves in a circle around the scene, and casts shadows on the terrain. Though simple, it adds a lot of realism to the scene.

A major inspiration for this project is t3ssel8r's [YouTube channel](https://www.youtube.com/c/t3ssel8r). I highly recommend checking it out.

# References

These are somewhat arbitrary, but interesting nonetheless.

* http://manao.inria.fr/perso/~ihrke/Publications/i3d08_lowres.pdf
* https://gfx.cs.princeton.edu/pubs/Gerstner_2012_PIA/Gerstner_2012_PIA_full.pdf