Creating the scene, scripts and rendering

Unity Development

Procedural generation of tree-like meshes and animation

Procedural Meshes

In the assignment I we have prototyped in Scilab the generation of meshes with root-like shape and implemented it for blender in python. Now we have re-implemented it in C# for the Unity project and improved in some points like expanding the mesh skeleton to 3D, adding sub-epoch growth and the generation of the mesh triangles and vertices for any epoch and sub-epoch, hence being able to animate it smooth over time. In this process some new parameters appeared to control, among other things, the 3D dispersion of branches, texturing and level of detail.

Using the C# script is very simple, you attach it to an empty gameObject in unity, tweak the parameters and it will generate in real time the mesh of the tree/root growing over time

Simulating the days passing and sun position relative to earth

Day/Night cycle

Simulating the day/night cycle was essential to pass the feeling of time. To achieve that we used a skybox texture blending shader and carefully choose four skyboxes textures to interpolate over time. One for each phase of a day, dawn, mid day, evening and night.

To make the shadows "walk" during the day we rotated the light "sun" during the day changing its intensity according with the sine of the angle made with the horizon or the altitude, and disable it during the night. We have also a background light with a very low intensity and fixed position enabled all the time.

Finally, to pass the feeling intended for the scene, two sounds were added, one playing at day and another at night, this would break a bit the fact of the scene being static. Everything was controlled in a C# script, which also interacted with the tree generation script.

Putting all together to compose the scene

Scene composition

.
To compose the scene we needed a terrain, to avoid complication such as large terrains of having to use fog to hide the horizon a mountain was the best choice, as it could fill well the scene and fit the trees without problems.

We hided the edges of the terrain with water, with reflection only, and tweaked its parameters to not look too artificial.

Various trees were placed in the coast near the water in front of the camera. Each tree had a particle system, which was activated at night. Those particles had a low speed and negative gravity emitting a green light to simulate the "phantoms".

Rendering the scene, materials (shaders) and post-processing

Rendering

We choose the "deferred rendering" to render the scene as it had a lot of triangles when all the trees were displayed, and also many lights coming from the particles.

The shaders used were from the default Unity assets, with tweaked parameters to reflect the intended material. To achieve the final looking was obtained using various post-processing:

  • Anti-Aliasing
  • Ambient Occlusion
  • Screen-Space Reflections
  • Eye Adaption
  • Bloom
  • Chromatic Aberration
  • Grain
  • Vignette