Comments (9)
Ok, thanks for the note. I think the first thing I'll do is an option to make the readback synchronous. This will add stalls but would be useful for comparisons/debugging. I'll post back when I've done this.
Besides that i'm thinking about two directions to solve this currently.
A first one is to compensate for the time delay and move the collision accordingly. See commit 8146864 . It records a timestamp with each readback request, and when it does get collision data it computes the velocity that the surface (height) is changing and then extrapolates forward to the current time. In my tests it was a able to track the surface pretty well, with the exception of some slight noise which i dont think would be a blocker, or could be polished out. It would need some kind of system to cache velocities etc, i can think about this.
The other thought i had was to actually start rendering out shape two frames ahead on the gpu, so that it can come back to the cpu in time (i guess this needs a fixed framerate to work 100%) things that are deterministic in time should work well, but for dynamic simulation stuff i guess this will just shift the lag into the sim. these disadvantages and the mess i'm guessing it will make of the code make me think the first option is worth exploring first.
i'll let you know when i have more..
from crest.
I hacked in the option to do synchronous readbacks (to avoid the async latency) for debugging/comparison. I decided to put it in a branch for now, but could probably be convinced to put it in master with #ifdef's and such. It's a static which I've added to the debug GUI - Use Async Readback.
Turning it on is expected to hit perf (it will make the CPU block-wait for the GPU to render everything and transfer over the shape), but its just for functionality comparison purposes.
If you get a chance, could you confirm this fixes the issue you report above?
from crest.
from crest.
Sigh.. sorry.. i hacked that in a quickly and after experimenting now I've realised _useAsyncReadback must be left true on startup so that everything gets init'd properly, and then turned on/off while running.
My steps:
- Assign OceanCollisionDemo script to camera
- Assign OceanHeightDemo script to a cube
- Press play (with _useAsyncReadback = true)
- Turn _useAsyncReadback on/off using debug gui at runtime to compare
With this, I get something that tracks the surface very closely, even for an aggressive wave:
https://drive.google.com/open?id=1ZH8oc3zR4lioWYXtWZ6D1BoQrUOarKcM
I did my best to clamp it to 30fps. I pushed the hacks i did to make the video: fcf73a1
The white cubes sample the displacement, the red cube inverts the displacement to get the height.
They seem to track the surface closely for me. There is some visible error, but this is a quite extreme wave. Are you seeing the same level of error and is this proving to be an issue?
from crest.
One more capture, this time failing a bit less at running at 30fps:
https://drive.google.com/open?id=1Yml_gAO9fsFlzqikgdXC0UQhsghVNITn
f9bdede
from crest.
from crest.
Oh that made me realise - we should compare readback request queue lengths. This is the number of frames of latency. I've just added this to the debug GUI on master and merged this into this test branch. The GUI shows the min and max queue over all shape lods.
On my laptop I'm getting a solid [2,2] in both editor and standalone.
As you may have already seen, I have dictated the execution order for all update dependencies - it would be worth checking to make sure these are coming through in your project as well.
from crest.
from crest.
That sounds promising! I'll leave this open for the next day or two let me know if it regresses.
from crest.
Related Issues (20)
- Boat Physics - Adding colliders and player to boat causing big issues HOT 1
- Problems when rendering HOT 1
- Shader broken on 2022.2.4 on Metal HOT 5
- URP reflection error when using two cameras after build. HOT 3
- Updating ShapeFFT parameters runtime, generates a lot of garbage HOT 5
- HDRP underwater volumetric lights not working properly HOT 2
- Local / movable spectrums or crest shapes HOT 3
- Foam / wake vibration when approaching whirlpools HOT 20
- Pressing the Windows Key in the editor disables underwater rendering HOT 3
- Wake / foam artifacts when moving the camera quickly HOT 11
- Delayed LOD / tile enabling when using large clipping areas HOT 5
- Depth Cache not populated - Exported Image is Black HOT 8
- Water interaction is not visible when moving camera away from the sea level HOT 1
- Underwater broken with XR multi-pass rendering HOT 1
- No caustics, no shadow data and/or constant shadowing on iOS
- Error of Does not exist some Classes. HOT 1
- Sporadic gaps / precision errors in tiles. HOT 31
- SphereWaterInteraction and RegisterDynamicWavesInput do not work correctly inside a flow area HOT 11
- Activating flow in the material when oceanrenderer is running does only work in editor HOT 2
- FindObjectsSortMode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crest.