Search Unity

Small CustomPass feedback

Discussion in 'High Definition Render Pipeline' started by julian-moschuering, Nov 4, 2019.

  1. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    @antoinel_unity this one is probably for you.

    Layer of CustomPassVolume GameObject should be respected by the camera. A camera culling the layer of a CustomPassVolume should ignore it. Currently all CustomPassVolumes are executed for all cameras independent of culling settings.

    Target XXX Buffer is very limited and sub optimal. My quick suggestion to make this more useful would be:
    • Remove 'Custom': I don't have any need for it. My custom targets have different sizes, different formats or may not be shared. The current implementation wastes memory by creating a full screen custom target I don't use. Maybe make this a mode where the custom pass provides the target textures through some interface instead.
    • Add 'None': Just do nothing. The CustomPass itself is responsible to set it's render targets with this mode. The previous RenderTargets should probably automatically get restored after the custom passes are finished.
    Apart from that the custom pass api pretty much fulfills all my current needs in a simple way. Thank you!
     
  2. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    • CustomPass destructor shouldn't call Cleanup but instead throw a meaningful exception/assert when cleanup wasn't called before. Most stuff done in Cleanup isn't allowed from the GC thread.
     
    Last edited: Nov 5, 2019
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    + for layer
     
  4. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    263
    Hello,

    First, thanks for your feedback :) It's really nice and help us to improve our features.

    Yes, we will definitely add this behavior through the volume layer mask of the camera
    upload_2019-11-6_11-0-41.png

    Currently it's true that it's not super useful but it will become a bit more when there will be a fullscreen custom pass master node in ShaderGraph. Having a different fullscreen target will allow artists to do simple effects such as edge detect or compositing without writing any code. On the other hand, what we can do now is to move the current allocation of the custom buffer to a lazy allocation so when it is not used, it is not allocated.

    Yes, this will be also part of the next package of HDRP for 19.3. But we can't restore the old render targets because we don't know which one have been bound, generally if you're chaining custom passes, they must set all the render targets they're using before doing anything otherwise they'd be dependent of the current context (and all it's side effects).

    This will be removed in the future but as explained here: https://github.com/Unity-Technologi...line/RenderPass/CustomPass/CustomPass.cs#L121 we need to do that in order to avoid any leak from the custom pass which would make it unusable (when you're allocating your render targets it leaks 100MB each each time a value changes in the inspector).
     
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    This is a fantastic news, thanks!
     
  6. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    @antoinel_unity will be possible to have two Custom Pass Volumes with the same injection point but for different cameras with the volume layer mask feature?
     
  7. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    263
  8. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Cool, thanks!