February 27, 2017

[Week 4] Nature rendering


This update comes a bit late, sorry for that!

As I said last week, this week I mostly had to work on some bugs and problems. First, I started working on the depth precission problem that I saw last week, to solve this, I implemented a logarithmic depth buffer. By default, Opengl represents depth in a way that most of the precission is "wasted" near the camera (the near plane) and objects far from the camera (near the far plane) will start to show glitches like z-fighting. This problems ocurs when the values of the depth buffer cant diferenciate two objects. Implementing a logaritmic depth buffer, means that I will write to the depth manually using a logarithmic function, we have to keep in mind that this will remove the early depth test (as we are writing the depth value). Since I've implemented this, I cant see more z-fighting.

I also worked on the terrain, now I'm using instanced rendering to render the chunks, which helped a bit with the performance, with fustrum culling and instancing enabled I can get almost 30FPS more.

The other problem I had, was with the clouds. I've playing around with the parameters and I ended up with a good configuration (with less iterations) that looks almost the same the one I had but performs much better.

Finally I worked on a vegetation system. Each chunk will hold information of the vegetation (for example a model matrix) I'm rendering grass using instanced rendering but I'm not happy with the results, I would like to test other techniques (like generating a huge buffer with all the data or using geometry shaders to generate grass blades on the GPU). I think that I will go with the geometry shaders as the grass must be ordered each frame so the blending will work properly and I dont think it will be good to update each frame a huge buffer.

I dont think this week I'll work on the grass, I would like to work on some postprocessing like lens flares and godrays!

Until next week!
Nacho.