Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Will raytracing support animations and mesh manipulation?

Discussion in 'HDRP Ray Tracing' started by Mr-Mechanical, Feb 18, 2020.

  1. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
    This is a very important feature for me, so I'm curious if this is possible or will be possible soon..
    excerpt from docs:
    HDRP ray tracing in Unity 2019.3 has the following limitations:
    • Does not support deformers (skin, vertex animation).
    • Does not support VFX and Terrain.
    • Does not support several of HDRP's Materials. This includes Hair, StackLit, Eye, and AxF Materials.
    • Does not have correct culling for shadows. It uses frustum culling instead.
    Thank you.
     
    originalemanuel2 likes this.
  2. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi,
    Skinning, blend shape and alembic files support will come with 2020.1. There is no ETA for others limitation for now.
     
    Mr-Mechanical likes this.
  3. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
    Seb Lagarde, thank you so much for your response! Skinning for raytracing 2020.1 is an exciting feature. Could that mean manipulating mesh.vertices array could be possible with 2020.1 raytracing? The meshes in my game have scripts that deform meshes via mesh.vertices. Thank you for your help.
     
  4. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    If you deform your mesh via c# code and not from shaders, I'd assume it would work already in 2019.3. But vertex offset via shaders for sure doesn't work on 2019.3 or 2020.1 (I've tested and it's confirmed to not be among supported functionality atm).

    For skinned meshes, the support is on 8.0.1 which you can find in package manager now while using 2020.1.
     
    Mr-Mechanical likes this.
  5. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    How we are supposed to use Raytracing when we have animated vegetation and water? Skinned mesh is not an option and doing it via C# also not, HDRP is already very CPU bound, so you are supposed to put more workload to the GPU.
    What does the Nvidia docs say regarding this topic? Is it not possible at all?
     
  6. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    It's possible since UE4 does support this (vertex offset is called "World Position Offset" on UE material graph).
     
  7. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Really frustrating Unity lacks behind. :(
     
  8. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    173
    Starting with 2020.1 you can actually modify the vertices from C#. Just make sure you use Dynamic Geometry in Ray Tracing mode in your Mesh Renderer. This is to update the acceleration structure after you modified the mesh contents. Skinned Mesh Renderers use Dynamic Geometry option by default.
     
    Mr-Mechanical likes this.
  9. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Is there any plans on supporting raytracing with vertex offset done via shader graph?
     
    newguy123, KU5D and LooperVFX like this.
  10. LooperVFX

    LooperVFX

    Joined:
    Dec 3, 2018
    Posts:
    180
    @Matjio I noticed that most of the features in this thread have either landed, or are being tracked on the HDRP roadmap (productboard) because you added them. Thank you for this, and the new roadmap hub that just launched is excellent!

    There is one major item not yet on the roadmap. Can an item be created on the HDRP roadmap for this? i.e. "Raytracing support of Vertex Position Offset"

    This a must have for raytraced rendering of animated foliage, and many other use cases with anything interesting in the vertex shader stage.

    Here is the equivalent feature in action in UE4 that @rz_0lento mentioned, accessible by enabling "Evaluate World Position Offset" on the RayTracing settings of an Actor
    unrealengine4_raytraced_foliage_worldpositionoffset.gif
    Documentation: https://docs.unrealengine.com/en-US...yTracing/RayTracingSettings/index.html#actors

    And here is an example of a Unity shader graph with this technique that does not currently work with raytracing. Any shader or shader graph that sets the vertex position at all, really as far as I know:
    Screenshot 2021-03-17 185013.png
    Thank you and happy GDC 2021!
     
    FuncyLee, keenanwoodall and newguy123 like this.
  11. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Hello ! As a matter of fact, a solution for this is currently being worked on and on its way to be integrated in 2021.2 alphas.

    This adds a new mode, called Hybrid, in the Screen Space Reflection override (in addition to classic SSR mode and Ray Tracing mode). This mode will use ray traced reflection in performance mode combined with a screen space ray marching technique.

    It will enable HDRP to include on-screen opaque particles, vertex animations, and decals (which are all not supported with raytracing currently) on ray traced reflection and ray traced global illumination.

    In hybrid tracing mode, HDRP still uses ray tracing for any geometry inside the ray tracing acceleration structure, regardless of whether vertex animation or decals modify the geometry's surface. This means if HDRP fails to intersect the on-screen deformed geometry, it intersects the original mesh inside in the ray tracing acceleration structure. This may cause visual discrepancies between what you see and what you expect.
     
  12. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I do love that Hybrid is coming (I've tested it early on as can be seen on the PR comments) and it sure helps for now. It means that we can now fallback to old style screen space effects for things that are not on RTAS (which again is way better than the old setup). That being said I still hope in future we can get vertex animations on real RT reflections as it clearly is possible to do (as seen happening on competing game engine). I can imagine it being hard to sell hybrid for gamers where they toggle expensive RT reflection option on game and they still see screenspace reflections there for things they care about... It's not ideal and is more like temporary solution IMHO.

    Just to clarify this for people just hearing about the new hybrid mode, you basically now have a decision to make beforehand: do you want your mesh renderer to go to RTAS (which means raytracing works for static meshes, alembic animation and skeletal meshes) or if you don't use RT for that mesh at all and then the screenspace effects work for everything, including things that RT currently doesn't support (which are mainly particles, decals, terrain and vertex animation). Hybrid mode then picks between screenspace and raytraced effect on these meshes based on your design decisions.
     
    LooperVFX likes this.
  13. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    173
    You can now change the contents of a Mesh vertex buffer using compute shaders starting with 2021.2 a19. Just remember to use Dynamic Geometry for Ray Tracing Mode in the Mesh Renderer if you recompute the positions every frame. Here is an example https://twitter.com/_kzr/status/1402283506441494529?s=21
     
    Last edited: Jun 8, 2021