Showing posts with label Light Scattering. Show all posts
Showing posts with label Light Scattering. Show all posts

Wednesday, April 10, 2013

The sun rises in ProcWorld, again

Last week I posted some early screenshots of the nigh-day cycle. There was a lot going wrong in them and you guys were very helpful in pointing out solutions.

I did another iteration on this, while not everything is as it should, I think there was some improvement. This time I have captured a video. The transitions are better appreciated like this. Again let me know what you think.



The main issues with the previous iteration were the brightness of the sky (or lack of it), and how the distant features failed to blend with the sky. This time I made sure there was enough atmosphere so more light was trapped between the horizon and the eye. The distance to the sky is also consistent with the terrain dimensions, now the colors in terrain and sky match better.

A few comments in the previous post suggested a different method called "Precomputed Atmospheric Scattering". It certainly produces better results than the method I am using here, which is the one from O'Neil in GPU Gems 2.

I had a quick look at the method and saw that in its vanilla form it could run slower than what I have now. While the method uses precomputed tables as textures to accelerate rendering, all the work is done in the fragment shader. That means every pixel on screen now had to perform two or three additional texture fetches.

The method from O'Neil does all the heavy lifting in the vertex shader. Consider this scene:


The sky, even if it appears softly shaded, has only a few vertices:


I think in this case it makes a big difference.

The precomputed method could also run in the vertex shader, but then it would take some time to port the tables, which now are in pixel formats that cannot be read by the vertex shader.

Of course there is a chance I am reading this wrong. If you have worked in this area before and see what I am missing please let me know.

Wednesday, April 3, 2013

The sun rises in ProcWorld

So I finally added some proper light scattering to the sky atmosphere in the realtime demo.

I am using the classic approach devised by O'Neil, which produces great results but it is also very sensitive to any change in the input parameters. A lot of tweaking is still required.

Here is a series of shots, keep in mind this is a work in progress but any early comments surely will help.




 



Thursday, June 23, 2011

Mounts and Light

Just a render of a small mount:


I added some fog to this image. Eventually I will be generating how light bounces off the particles in the air. If you  noticed, you can see the top of a mountain more clearly than the bottom. This is because the air at the top is thinner and light gets easier to you.

Hopefully I can have the same principle inside architecture so there will be a nice ambient feel to interior spaces too.