March 21, 2017
[Week 7] Nature rendering
Hello once again
For this week, I only implemented one new feature: the first person walker. I added a method in my terrain class that retrieves the height of the terrain at the provided x,z point. With this, I´m clamping the position of the camera above the height of the terrain, so it looks that the user is walking on it.
To make it smooth and prevent heightmap precission errors, I did a lerp so its more smooth.
The other important thing I've been working on is optimizations. Until now, I've been rendering all the effects at full res. This works well but its not the best as it is taking much time. By reducing the resolution of this effects I gained 100FPS and you can't tell the difference.
The water reflections and refractions are rendered at 1/2 resolution. The lens flares and bloom effects are rendered at 1/4th! I tested the demo yesterday in a computer at the university (they have an old Nvidia quadro installed) and it runs at 60FPS.
I removed the Y position of the grass as now I'm sampling it on the geometry shader, this reduces in a third the space it takes to store the grass points.
I had a problem with the water fading (I changed the depth values by implementing the log depth buffer), I couldn't solve it in the correct way (getting back the linear depth) so I did a hack. I'm sampling the terrain heightmap to get the current height. This gives hard edges but I'm performing 5 samples and averaging them so it looks better.
Finally I found a bug with the terrain fragment shader. The fog method makes appear black rectangles on the screen. I will be checking that this week.
See you!
Nacho.