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
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Manually managing the RTAS : removeInstance (feature suggestion)

Discussion in 'HDRP Ray Tracing' started by m0nsky, Nov 11, 2020.

  1. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Hi guys,

    I'm trying to manage my RTAS as efficient as possible. I'm currently keeping the RTAS "alive" without disposing and creating a new RTAS every frame. I only add instances when I need to and if a instance is already present in the RTAS, I just update the instance's transform.

    However, when I want to remove an instance from the RTAS, for example, when it's too far away, the only way to currently do this is by disposing the RTAS, recreating the RTAS and re-adding every renderer instance from scratch.

    I would like to suggest a removeInstance() function, if possible. It would make things a lot easier.

    Thanks,
    m0nsky
     
    rz_0lento likes this.
  2. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
    Hi!

    Thanks for the suggestion! There was a RemoveInstance function in the engine but not exposed to C#. I exposed the function and it will be available in 2021.1 in one of the alpha versions.
     
    rz_0lento and m0nsky like this.
  3. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Thanks a lot, I appreciate it.
    Another thing, would it be possible to get a function to update the instance flag without removing and re-adding the instance?
     
  4. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
  5. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Indeed. I was planning to use this to implement RTAS occlusion culling when using ray tracing in VR, but have objects behind me affect ray traced reflections only.
     
  6. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
    Yes, it's doable. I'll add an UpdateMask function.
     
    rz_0lento and m0nsky like this.
  7. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
    Hi!

    The new functions RemoveInstance and UpdateInstanceMask will be available starting with 2021.1.0a10 (changeset 3a11545dbc50).

    Note that using these functions will change the content of the acceleration structure and to actually see their effect you'll need to call RayTracingAccelerationStructure.Build or CommandBuffer.BuildRayTracingAccelerationStructure if you work with CommandBuffers.
     
    m0nsky and rz_0lento like this.
  8. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Great. I'm looking forward to it.
     
  9. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    m0nsky likes this.