Closed Draydak closed 5 years ago
Hi @Draydak,
A few things which could help us debug this issue:
#pragma enable_d3d11_debug_symbols
to line 27 in AnimWavesGerstnerBatch.shader
and to line 13 in ShapeCombine.compute
.Doing the first one should be fairly easy, so do that first. If you can take the time to do this it would really help because we are unable to recreate the bug on our end! If any of the intructions are unclear, just let me know.
Oh, another quick thing that you could do is a take a screenshot of what things look like when you uncheck Shape combine pass
in the overlay on the left.
Unchecked shape combine pass, this made big difference
Awesome, the renderdoc capture would really help here (with shape combine pass activated so that bug itself is captured). I know which shader the bug is happening in, because I was able to replicate it on Linux, but a DX11 capture with debug symbols would really help as well.
I need to download Renderdoc etc. (not something I've used) But work is dragging me a way for a bit so might not get that capture to you till later
No worries, will let you know if I find the culprit beforehand
Had a quick go, not sure if this is right as just followed my instincts.
If you need me to toggle something more in RenderDoc / Unity that I've missed let me know
Thanks. The capture itself looks fine, but it seems like you paused the game window before you made it which means that it doesn't contain a capture of the bugged behaviour. If possible please do the same again but whilst the game is running.
(If this isn't what happened, let me know and I will see if I can work out why the relevant info is missing from the capture).
Another option could be to update your drivers (but send through capture first).
The Linux issue appeared to be something else, as it went away after I restarted my PC. :/
Second attempt, triggered from inside Unity (aka read manual page more). At a glance some crest Lod data in there, but it's all voodoo to me. I'm not familiar with RenderDoc so feel free to spell out any specifics I need to do.
That renderdoc capture is exactly what we were after and has already revealed some useful info.
I'm going to dig through it some more, but for some reason renderdoc is reporting that none of the animated wave shaders ever get dispatched (except for the one you are seeing). That would certainly explain the problem. Normally you get this if the kernel cannot be found or something similar, but that would spam errors to the log. I'm going to do some thinking and see if there is something we can do on our end to verify things.
https://drive.google.com/file/d/1A8A76u96RJDnUo5Yuim6Wm3fk3630Qns/view?usp=sharing
Can you give this a go and tell me what results you get?
Still seems to have same issue, the few errors mainly relate to PostProcessing from looks.
`Initialize engine version: 2018.4.2f1 (d6fb3630ea75)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.0]
Renderer: NVIDIA GeForce GT 650M (ID=0xfd1)
Vendor:
VRAM: 2007 MB
Driver: 25.21.14.2531
Likely connected to #301
@Draydak we now have 3 cases of this bug occurring for users.
This is probably a long shot but i noticed above you said it was working for you on earlier versions. You don't happen to know a version/date that was working? It might allow us to compare the versions and give us leads..
Version 7.0.0 definitely works ok for me, downloaded just other day as water is now under the microscope in my project.
I believe it was good until April / May time, but my Git skills are not good enough to confirm.
@Draydak if you have time could you please run this build, and attach a screenshot of what you get? This is taken just before we did a major upgrade to the core crest update - added compute shaders.
https://drive.google.com/open?id=1-UgFF60DSGRyqa5T3U3IYLb1vl4O-OIa
UPDATE: this failed to fix the error for one of the other people experiencing the issue, so it may be a failed fix.
@Draydak after much headscratching we may have ID'd the issue. could you please give this new build a test when you get a chance and let us know if it resolves the issue? (if it does, disregard the previous request above)
https://drive.google.com/open?id=1OBC2MXWC2KerxkKtujekMctnvHsUVSj3
thanks!
Last one first "the fix" Still no good I'm afraid
The Crest-28ebf08b
This does work, if that is any help to you.
Thanks a lot for your patience with this. How does this build fair for you? This is a build made from #316, shadows and foam are broken but waves do work.
https://drive.google.com/file/d/19VYoMT43OQ97ZLrDnkIZBYQkNux4WsaV/view?usp=sharing
Here's another build, it's deliberately broken, but you should get results like this:
https://drive.google.com/open?id=1YsS5eRyKZxOWKpSk2NIxak8XlMSYrc4B
Just trying to throw different things at the wall to see what sticks.
the build from 316 looks as follows, sadly not working
the simple array copy build:
Edit: When windows pastes the correct image
Two builds incoming, they should both look like this (foam, etc. will be broken, but waves should work):
One of these builds has reverted back to using the pixel shader (which is what already works for you), so if that doesn't work we are then in interesting territory.
https://drive.google.com/open?id=1szwYoCRGxEV4CSqKWMNIALYvbBMFG1R5
https://drive.google.com/open?id=1-gu2QictZuxD4fWwJbajSzPcKJ3_Sz6l
Let me know how both of these go if possible, once again, thank you so much for testing!
Build 1:
Build 2:
They both work! Hope that is a good thing
We just realised today that we think the three cases of this that we're aware of are likely all from unity 2018.
We should probably eliminate this important factor from the equation.. @Draydak if you get a chance could you please try this build i made from 2019? Thanks.. https://drive.google.com/open?id=1tKI0jlGswdKQadeyHTLjrn3XxlJD608s
EDIT nevermind, we just found out one of the other people experiencing this is on Unity 2019.2.0f1 , so that likely kills that theory..
I've hijacked the issue description to summarise our findings. The issue does seem to be due to an attempt to read a RWTexture2D (which is weird, because writing to them is fine). That's assuming its not a bug with Unity 2018, hence Huw's test build above. I'm going to setup a bunch of experiments next week in a single Unity (non-crest) project to see if we can pin-down a common denominator. Thanks so much for your patience with this @Draydak!
I've been trying on 2019 myself recently since I've moved my project to that in anticipation of changing it to LWRP. I tested the build anyway, but as expected does not work.
Although I'm doubtful that I will be able to use Crest in my current project and to be honest Crest is probably overkill for my current requirements. I cannot deny the performance of Crest, so it would be a shame not to use it. I can only afford to treat my project as a hobby at moment, so it moves at it's own pace.
I will try and support you guys in any way I can, it only takes a moment to test a build so it's the least I can do.
Summary from @moosichu: We still haven't pinned down the cause of the bug, but we have tried various experiments to verify what does and does not cause it.
It's worth noting that it only affects the ShapeCombine shader.
Here are a variety of configuration descriptions, alongside wether or not they presented the bug:
(🐛 means this configuration presented the bug, 🆗 means that bug wasn't present 😄 )
RWTextureArray2D<float4>
, WaveBuffer sampled using Texture2DArray
with texture sampler. RWTexture2D<float4>
, WaveBuffer sampled using Texture2D
with texture sampler. NOTE: This rules out the cause of the bug being due to reading/writing to the same texture array in the same shader pass, as now the different lods are entirely different textures.RWTextureArray2D<float4>
, WaveBuffer sampled using Texture2DArray
with texture sampler. NOTE: This rules out the cause of the bug being due to indexing the texture array with the wrong type, as this experiment properly used uints. Texture2D
with texture sampler. NOTE: This rules out the cause of the bug being due to compute shaders.It's worth noting that in the renderdoc caputure, the shaders which were meant to dispatch don't show up as having dispatched at all. https://github.com/huwb/crest-oceanrender/files/3342958/CrestIssue279.zip
GPU: GTX 1080, HD Graphics 4000, GT 650 M, GTX 750, Adreno 540 GPU, Intel HD Graphics 5500 CPU: 2X Intel i7 6800 k, i5-3320M, ?, ?, Snapdragon 835 chipset, ? RAM: 64gb, 4gb, ?, 8gb, ?, ? Windows: 8.1, 10 Pro, 10, 7, Android, ?
Spread of unity versions (both 2018 and 2019)
We have a new theory - it may be due to limited/patchy support for typed UAV loads. https://docs.microsoft.com/en-us/windows/win32/direct3d12/typed-unordered-access-view-loads
This build loads the wave data as a single Float32. it will look broken but waves should be visible. could i please get a test run of this with a screenshot of the result?
https://drive.google.com/open?id=1w-aOfXhubgM1aiuG_qfTN_mVcBVzq4SJ
As a side note, it may be worth trying other APIs like Vulkan for example (can be configured in the player settings), although this may be hardware limitation in the end. And this suggestion won't help the android devices.
There's something on the LOD
Yep thats what i get too, so that seems to confirm the issue.
I'll discuss how we might work around this with @moosichu . Thanks @Draydak .
Count me in on having this issue. I first imported Crest into a project on my work computer (with a GTX 1080), and the water looked perfect. I pushed the project to GitHub and headed home. When I got home I loaded it onto my home computer, which has a GTX 950 as well as a GTX 770, and was surprised to find the water was completely flat. Tried fiddling with all kinds of stuff to make sure the Gerstner shape generator was being picked up by Crest... wasn't throwing any errors, it just refuses to make waves.
Should note that I'm using the 'Digital Ruby' branch of WM, though he says he's made only 'very minor changes' in the branch that shouldn't have anything to do with this issue. I have tried pulling the up-to-date master branch of Crest and had the same results.
Version: Direct3D 11.0 [level 11.0]
Renderer: NVIDIA GeForce GTX 770 (ID=0x1184)
Vendor:
VRAM: 4052 MB
Driver: 23.21.13.9077
@moosichu came up with a scheme where the displacements is a single channel texture array, with contiguous sections of the array assigned to each channel:
[ x0 x1 x2 ... y0 y1 y2 ... z0 z1 z2 ... sss0 sss1 sss2 ...]
And we found a way to integrate this without too much hacking or special cases.
This build should produce waves - could we please get verifications that it works for you guys?
https://drive.google.com/open?id=12LxuKlEdZFPC6NPKnJ-l2LhMe3iwbMip
So that's the good news... the less good news is that it the displacement texture readback to CPU (for collision/buoyancy) is going to be a nightmare if we're needing to transfer each channel individually, it will make a complex system even more complex, and will double the required bandwidth.
@moosichu and I will discuss. We have plans to change up how the collision buoyancy is done and not transfer the entire displacement textures from the GPU, and this future implementation should work with this workaround, so that seems to be the best option. We don't have an ETA for this but hope to start experimenting with it soon.
Before the new system arrives, displacement texture readback will not work with these workarounds, and the other options are the Null Collider which is just a flat horizontal plane, or CPU Gerstner which will evaluate the waves on the CPU. The CPU collision does not support shallow water, so is only a good fit for deep, open ocean. There is a prototype which does take the depth caches into account, it's not been cleaned up or extensively tested but might be a good option: #268
I see waves, sea waves... it appears functional! for me at least, hopefully others too.
It's a shame you can't just sample an area around the object you want buoyant, instead of feeding back all the data. But hopefully you clever chaps can come up with something workable.
Absolute aces! Thank you for your patience and testing! 👍 This was definetely a weird issue, now that we know the solution will work, we can get this robust and polished.
Waves ahoy here as well! Very cool!
After discussing we werent happy with the drawbacks of the above, so time for yet another pivot - we made a new version which works around the UAV issue by using normal shaders instead of compute shaders. This adds a few passes but they are simple copies and it should not hit performance. On the plus side this doesnt suffer from the above limitations and 1 or 2 more, and keeps the solution nice and simple.
This should work but could i please get a confirmation or two, again. It looks like we're on the home straight now.
https://drive.google.com/open?id=1Hmnmyv2P1EMvUkurQIyx05jbxasGYb84
Thanks again for your patience..
Can confirm, waves are working
Today a miracle happened - we merged in the above fix into the master branch. Could I please get verifications that it works on the latest version? Thanks!
Report of solutions (for the record):
Scrapping texture arrays
+Tested +Potentially more flexibility with dyn wave sim adaptive time steps -Code becomes more complex and ugly -More draw calls
More tradeoffs here: #316
Splitting into single channel per slice
-Changes semantic meaning of slices in this special case - channels multiplexed into slices, for displacements only
-Require special case functions for sampling displacements
-"Wrap" addressing doesnt work in depth dimension - uv (0, 0, 6.5) might lerp completely different channels..
-We could not get packing to work (branch fix/uav-support-2-pack-f16s
), so this doubles memory/bandwidth requirement for the displacement texture array
-Breaks displacement readbacks, although we want to overhaul this system anyway
Ping pong wave combine (implemented)
+Branches the combine code, rest of code/shaders/semantics remain unchanged -One extra texture copy per LOD to do the 'pong'
Can confirm it is working! 😄
Observations Performance wise it does seem to have suffered, however if that's specific to this change or how much Crest has matured in last few months... I cannot say
On a positive note, the boat scenes are much more stable than I remember! Although I did turn around at one point and see a boat falling from the sky, so it's not perfect.
I'd be interested to hear other peoples experiences, especially on how or if it's affected performance.
Compared to older versions of Crest, the example scenes have quadruple the resolution and more gerstner waves, which is probably where that hit comes from. Shouldn't affect projects with existing settings though.
Yeah that's right. The lod resolution may be a bit higher, and the dynamic wave sim does 1 or 2 more steps.
The new ping pong combine pass can be turned on/off at runtime using the debug gui which can be used to compare perf.
On Wed, 18 Sep 2019, 19:14 Tom Maenan Read Cutting, < notifications@github.com> wrote:
Compared to older versions of Crest, the example scenes have quadruple the resolution and more gerstner waves, which is probably where that hit comes from. Shouldn't affect projects with existing settings though.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crest-ocean/crest/issues/279?email_source=notifications&email_token=AAHFO7JI66DJW5MBJCBAVA3QKJOXJA5CNFSM4H4KT2ZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7AZHZQ#issuecomment-532780006, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHFO7P2S6JBNR5ATHQF63DQKJOXJANCNFSM4H4KT2ZA .
Closing!
A new LWRP package has been submitted with this fix. It should go up in the next couple of days, I'll confirm when it does.
The fix is now live in version 2.2 of the asset.
Describe the bug Fresh download of Crest (29th June 2019) from Git. Open in Unity, open any demo scene and the waves are all Muted / flat. The Whirlpool scene was craziest, see video. There does not appear to be any wake / bow wake on any boats. But it could just be so shallow, it's not visible.
LOD appears to be behaving oddly, also only appearing in bottom image slot (again see video)
Screenshots / video Crest Issue
Log No error's / problems in Log at all.
Versions Git version, master branch downloaded (29th June). Unity 2018.4.2f1
To Reproduce Download from Git master branch to empty folder. Open in Unity, open any demo scene. No changes, no modifications, not added to existing project etc.
Platform Editor and standalone Windows 10 Nvidia Geforce GT 650M
Additional context I believe the graphics card is fully DX11 compatible, so should be capable of handling required shaders. (it worked with earlier versions). All drivers are up-to-date.