This will be a long post so grab some snacks
I have been working on implementing a new godray technique:
Some of you might remember I used to have godrays in scatterer a while back, well that implementation was flawed and had many issues, here is a direct comparison between the old and new technique.
The old technique was only getting the "outer surface", and couldn't handle overlapping rays and get the real depth, it also often had gaps.
The new technique creates a light volume and handles overlapping rays and complex shapes, it uses shadow information so is directly tied to shadowmap resolution, shadow distance etc (now you understand why I was insisting on "fixing" shadows in the last update).
To put this new technique to the test, I built this huge monolith.
I call this: "The Temple of Godrays"
I boosted scattering exposure a bit here, you can see light columns formed by the holes in the ceiling
As you can see, it's a true volumetric effect and not screen-space
With this new technique I'm also able to inject any information I want to create godrays, I'm currently adapting it to have EVE clouds cast godrays, although it still needs a lot of work:
Laythe's surface looking magical:
webm: https://gfycat.com/poshuniformerne
I have to say though this looked simple to me going in, it's probably been one of the most complex features for me to implement and pretty much took everything I learned in the last few years about graphics programming and the unity engine to get it working.
These godrays will only work on Directx11 (they require the unified camera setup).
Moving on, a few versions back I added underwater caustics. The next logical step was to create underwater light rays:
Short video: https://gfycat.com/sillypeskybaldeagle
These use a completely different technique from the godray technique used for terrain and clouds, more adapted for short distances and semi-transparencies.
Here the lightrays are derived directly from the caustics textures and config, you can follow any light ray to the matching caustic.
Here are some beauty shots, as you can probably see, this is inspired by subnautica.
We can also do the same “temple test” as we did for godrays but underwater
Moving on, since the ocean shader was added, it has always looked nice, but any ships on the water surface were always static and not interacting with the waves, as if they were anchored in place.
Some will remember that I showed a prototype in 2016 were a ship was interacting with waves. Since the ocean was created and animated on the GPU, in the 2016 implementation I re-did all the ocean calculations on the CPU, so that the height info would be available on the CPU for physics, so it was slow (as it's a computationally heavy task that benefits from parallelization but that's the GPU's job) and had a very hefty CPU impact, moreover my knowledge was limited at the time, and the implementation was unstable and caused ships to disintegrate, often within seconds.
Well, here's the new version:
Webm: https://gfycat.com/splendidcelebrateddodobird
It appears stable even with multiple ships
Watch in HD: https://gfycat.com/evilexcellentbobwhite
Although it can of course destroy your ships if the waves are big.
Here is a boat caught in a massive storm (ridiculous buoyancy on the boat here):
Webm: https://gfycat.com/imaginaryjadedafricanaugurbuzzard
What's impressive, this runs with nearly no performance impact. How can it run so well when the old version destroyed performance? There is a big trick here, can you tell what is going on?
Wave interactions will only work on Directx11, if you haven't guessed, the magic feature that makes this work is async GPU readback which is sadly not implemented by unity for OpenGL.
With this, there are other limitations like jittering and cutting that become apparent in the ocean shader when the waves are bigger (there was never a reason before to have big waves when vessels stayed "anchored"), as well as how static the ocean config is, in a future update I will work on making the ocean dynamic, I will start with a simple weather system so the waves can change dynamically, we'll see where this goes.
Gameplay-wise, it makes moving against the waves difficult, the water seems to slow down ships a lot on every impact, however reasonable/small waves are a pleasure to navigate. I'm also looking forward to see the first guy to stabilize a boat by moving fuel in between tanks with a kOS script. Vessel recovery can be an issue too, although I have workarounds to test.
Moving on, RSS/Rescale users will be happy to know that I’ve fixed this issue where scattering is cut off in the distance (without changing the clip planes)
You might still be able to spot a discrepancy where local terrain and scaled terrain meet, but it's a small one.
Using the same technique I’ve also fixed this issue where mountains might look overbright white when ascending to orbit
And for OpenGL users who must be feeling left out by now due to no godrays and wave interactions on Opengl, at least I have something for you. Since unity added compute shader support outside Directx11: Config tool builds for Linux and Mac:
https://github.com/LGhassen/Scatterer/releases/download/0.1-mac-conftool/ConfigToolLinux.zip
https://github.com/LGhassen/Scatterer/releases/download/0.1-mac-conftool/MacConfTool.app.zip
Also, actual documentation for scatterer is here on the wiki, although still a work in progress
https://github.com/LGhassen/Scatterer/wiki
With that said, I really love modding and exploring what can be done, I feel like I'm close to "finishing" Scatterer, but the topics involved are increasingly complex and time-consuming to work on.
As I want to continue modding, I decided to set up a Patreon, hoping to make modding more sustainable for me. This doesn't mean my mods will become paid, they will be available for everyone of course, however patrons will get early access to in-dev features and previews, and I get to spend more time doing what I love and adding new features everyone can enjoy, and finally finding the time to work on some things that I never could, and fixing the layer of jankiness around my old code (nevermind that scatterer was my first real programming project). I will be uploading a first build shortly, so stay tuned:
Please consider supporting me there if you appreciate my work, and if you can't, that's alright too, releases will always be public.
Edited by blackrack