-
-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spectrum Driven Small Details #638
base: master
Are you sure you want to change the base?
Conversation
For demonstration purposes only.
Add more debug options. Amplitude multiplier. Added min and max normal scale. Also apply driven normals to strength.
Added some debugging stuff and some possible improvements. |
Solved that one issue with LODs. Was a pretty obvious bug. Added a new issue about scale changing. |
Not ready to merge but ready for some feedback. It demonstrates the idea enough I think. |
Thanks for the bump it's next on my list to look at |
Thanks for this! Really interesting to see this coming through. I've been playing around and i think i get the jist of it. I've realised it's quite tricky thing to make work correctly. One basic problem is that the normal maps do not capture the appearance of the waves at all. In an ideal world, if you zoom in on a patch of water like the below, the only visual thing that changes is detail subtlely gets blended in. Instead what happens is when the actual waves come in they can be very different from the normals (the waves are ramped up a bit too much here and trigger the foam like crazy, which is another potential problem). I need to think about if the normals could be a good approximation to the underlying waves. It makes me think that should be possible to render a patch of waves that tiles horizontally, which could then be used as a normal map? Like what would happen with FFT. This is an entirely new rabbit hole / tangent but just thinking aloud.. If they cant match then maybe they are not driven by the spectrum and function the way they are now, leaving the roughness. I played with the spectrum and observed the roughness. I can see it changing but am struggling to decide if this is a good thing or if it should be left entirely to art. Its possible i was failing at tweaking or focusing on the worst cases, apologies if thats the case. Let me know what you think. |
I haven't looked at the code, so haven't seen if this is taken into account, but it's worth pointing out that the physics of small (capillary) waves is quite different than those of large (gravity) waves. https://en.wikipedia.org/wiki/Capillary_wave Mainly because the restoring force in the former is surface tensions, whilst in the latter it is gravity. just had a look at the changes This would be more relevant if we ever wanted to drive small details procedurally. https://youtu.be/ts2am8WRBXQ?t=466 Uncharted 4 has a nice effect where the wind seemingly generates surface ripples as it blows over it. |
Yeah that's a cool effect
I decided to scratch the itch and try this out. I believe it does tile - at least the waves do. However it's pretty easy to break the tiling property. Going to write notes to capture for the future
I think it's possible to render a repeating patch of waves in a canonical frame and then transform them to achieve the above points. I think we'd probably work in this way if we were using fft as well. Needs more investigation though, will leave for now. |
I have been thinking about this too but to solve another problem where small waves contribute to other data like foam. Because the smaller wavelengths aren't present in the distant LODs, foam generation can be noticeable more potent under the camera with certain settings. I wonder if we could also similarly tile a patch of smaller waves into the foam data? |
Yes i think that could help as well. I think it would be worth exploring moving to purely-repeating wave buffers to allow testing this stuff, at some point.. Tangentially related, i tried a hack to boost the foam - branch |
I have attempted to drive small details strength with values from the ocean wave spectrum. I am not sure I have done it correctly, but it appears to be working. Small details is covered by normals and roughness.
I used the amplitude values. Not sure if that was the best way to go.
For the "enabled" and "disabled" screenshots, the roughness was set to one and zero respectively. The base normal scale needs to be improved and can look strange when the scale is low enough to be visible but too small to look good. I am thinking that driving the scale and strength might work so we ensure normals always look nice when visible.
Let me know what you think.
Main Scene without changes
Enabled
Disabled
Main Scene with low spectrum weight
Enabled
Disabled
Main Scene with zero spectrum weight
Enabled
Disabled
Issues
Noticeable scale change
When weighing out a spectrum, the normal scale will decrease. When the camera has a high altitude, this is very noticeable. It looks almost like the normals scroll at fast speed.
Local Gerstners
Not sure if we should try and handle this case.
TODO
Multiple Gerstners
I think just a static list of global gerstners could work. And then we take the highest value.
Testing
On the OceanRenderer, there are two toggles to enable/disable driven normals and roughness. I have also exposed properties on the OceanChunkRenderer for debugging.