SamuKata
sgthale
sgthale

patreon


Beginning Weather

The last scheduled item on the todo list for v0.4 is weather. I've been working real  hard the past week trying to write a volumetric shader. It was a very difficult problem because performant volumetric rendering is a tough egg to crack. However, I think it came out very well! First attempt:

The approach actually comes from a SIGGRAPH 2015 presentation on how Horizon: Zero Dawn made their own dynamic volumetric clouds. I did some research on my own and wrote my own version. Thankfully I was already professionally familiar with many of the aspects of this technique. Basically how it works is you build a 3D texture with Worley and Perlin noises and traverse it in a ray marching shader. The tough part was tweaking the noises and solving the lighting equation. I built a Unity tool to help me tweak and get things just right. Shown in the gif above.

The really cool thing about this method is that I can control the clouds with an offscreen texture, hence control the weather. Right now I am using a simple cheap pseudo perlin pattern to generate random clouds and move them towards a general direction:

Result (speed x10):

The great thing is that it's very flexible and adds a ton of depth to my scene. I probably won't have time to implement rain for v0.4 but I definitely will in the future. Here's me playing with some sliders:

Showing off the lighting model that it uses to calculate density and transmittance:

What a spooky night could look like in the future:

This weather system will be in the release of v0.4 for this Sunday. However I first need to continue improving the performance for this. Raymarching is a very expensive rendering technique, especially for VR. The first test with my HTC Vive, my framerate was a crappy 40 FPS (Nvidia GTX 970). The SIGGRAPH presentation recommended downsampling your clouds. So I rendered at a quarter resolution and my framerate jumped to 80fps. Pretty good and it still looked good. But I don't think that was enough. I noticed that it was rendering the distant clouds plane material twice, one for each VR eye. So what I did was just render it once for both eyes instead. You don't need the perspective that both eyes provide. Distant objects look the same for either eye. So now I cheat the rendering by marching the clouds once and just drawing the already calculated result with a plane:

Solution also worked for non-VR so I left it to render the same way. My framerate was now at a steady 100 fps. That's all I've been working on the past several days. I am wrapping this up for the release this weekend. The last things I need to tend to is the YouTube video trailer and some last minute bugfixes and improvements. The YouTube video should come in Thursday late at night. The last few improvements that I need to add is related to the controls. I will be implementing better menu functionality and movement rotation controls. Stay tuned FOR SUNDAY.

Beginning Weather

Comments

Trailer delayed because of some VR issues. Was pushing to record today.

sgthale


More Creators