February 5, 2017

[Week 1] Nature Rendering


As I've mentioned in previous post, this year I will be working on my computing project. I decided to render a nature scene, this involves  the rendering of large terrains, clouds, grass , water etc. I would like to make a demo where the camera flies around showing the scene. I would also like to implement a VR renderer this will mean that I have to take care of the performance of the demo since the start.

One of the things that I'll be doing to document the process of the project are those blog posts, this is the first entry of 15.

This week I oficially started working on the project, I would like to set a few milestones to check the state of the project, next week I'll do it.

So lets move to what I've been doing.

First of all, the initial idea was to work with DX12 but after a lot of thinking, I decided to move to Opengl.Why? I feel more confortable with it and I can develop faster, this means that I'll be able to make more and more complex effects, the downside, when the time to find a job comes, some contractors would have prefered to see a modern API instead of Opengl.

With that in mind, I've developed a framework to develop the demo. The framework has the following features.


  • Time managment (fixed time step, cache delta time and fps etc)
  • Window creation
  • Input system (key down,mouse position etc)
  • Camera (move and look around)
  • Some opengl wrapper classes (mesh,shader,material,UBO etc)
  • Interface (ImGui)


This was easy to make as I've done it before. Once I finished the framework I started working on the demo. Firstly I did a basic terrain chunk system, where I can generate a terrain divided in chunks (there is a bug with the mesh generation, 2 rows are missing, next week I'll work on this). Also, I added a clouds postprocess.
I'm casting rays from the camera and checking if those rays hit with the "cloud cover" if so, I use fractal noise to find the density of the cloud. I'm doing it a little bit fancy by sampling a number of times more to emulate volume.
I realised that it will be really easy to cast shadows from the clouds into the terrain, as I have a noise function, I can sample the same noise from the terrain and see if the sun is ocluded, this way we can simulate shadows.

That's all for this week, next week I'll be solving some bugs: problem with the terrain mesh and the clouds being rendered above everything.