Code Monkey home page Code Monkey logo

Comments (5)

huwb avatar huwb commented on May 30, 2024

my heart sank a little bit when i read this. i had a great plan here - all of the cpu collision queries were supposed to come from displacement textures. this would mean cpu collision takes advantage of the inherent LODing, and the visuals/collision would always exactly match. the cpu would have to just select whichever displacement texture is available at a point and then sample it, without needing to add all the components together.

however when i tried it i got massive pipeline stalls when reading the texture back. i had a test running where i was rendering a texture and then reading it back ~20 frames later and i still got a massive stall. i'm almost certain this is something broken in unity. i will try getting a latest version of unity and reproducing this issue in a small standalone project, and then submit it as a bug report.

in the meantime your idea should work, and i'll look at implementing this. im not stoked on adding more computation and memory accesses to the height samples - but your caching work should offset that cost!

from crest.

huwb avatar huwb commented on May 30, 2024

Promising news - to address this very stall issue unity has introduced an async GPU readback api. I came across it via this recent tweet: https://twitter.com/_kzr/status/951760588127924224

I have a small project which does the old and new readback paths, and the new api has no stall whatsoever, and the implementation is really simple. I've got it working with the right texture format and I'm ready to have a stab at it in Crest. I'll keep you posted.

The catch is that the API is in the experimental stage (introduced in 2018.1), and currently only supports DX11/12. It sounds like Unity will expand the platform support next. However, if the 2018.1 dependency or the current limited platform support sound like issues to you, let me know.

(Older links for the record: https://medium.com/google-developers/real-time-image-capture-in-unity-458de1364a4c , https://answers.unity.com/questions/465409/reading-from-a-rendertexture-is-slow-how-to-improv.html , https://forum.unity.com/threads/readpixels-stalls-the-pipeline-in-unity-5.339324/ ).

from crest.

dizzy2003 avatar dizzy2003 commented on May 30, 2024

from crest.

huwb avatar huwb commented on May 30, 2024

So maybe the great plan worked out after all - reading back the shape data asynchronously worked out well and comes with a load of advantages. I've created a pull request to capture the notes, and any feedback:

#13

Let me know what you think.

from crest.

huwb avatar huwb commented on May 30, 2024

I am closing this for now, as I don't have plans to do further work on this. I wrote my understanding of the status at the bottom of #14 . Reopen if I have overlooked something.

from crest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.