Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Replacement for Camera.Render/Camera.RenderWithShader

Discussion in 'Universal Render Pipeline' started by Fewes, Mar 13, 2020.

  1. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    198
    While attempting to make my in-editor AO baker compatible with URP, I've found this page stating that Camera.Render and Camera.RenderWithShader are not supported. Is there a current or planned replacement for this? Without them, it seems impossible to render custom depth maps, a very powerful feature.
     
    hippocoder likes this.
  2. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    There's a replacement:

    Renderer Features, especially the built-in RenderObjects renderer feature.

    upload_2020-3-13_13-58-16.png

    Your actual camera that you want to render depth with needs the right Renderer assigned, and also can have Culling set to none so that you're not rendering double:
    upload_2020-3-13_13-59-15.png

    Result of the above:
    upload_2020-3-13_14-0-9.png
     
  3. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    205
    Yeah... lack of RenderWithShader is most annoying thing in SRP. Lucky you can switch to standard on the fly, bake what you want, and switch back.
     
  4. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    198
    Using Renderer Features seems like using a sledgehammer to crack a nut-kind of solution. Previously I could just call a single function. Any input from Unity on if this is the intended way to replace Camera.Render? I'm a little confused as to why URP makes it incompatible, anyway.
     
    hippocoder likes this.
  5. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    205
    This in not URP specific issue. SRP just don`t have RenderWithShader functionality.
     
  6. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    @phil_lira any idea how this can be achieved? seems useful for a lot of quick tooling and bouncing back and forth between URP and built-in seems taxing...
     
  7. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    I can only repeat that RendererFeatures have been previously said to be the replacement for URP. I'd also hope this to be easier and more consistent between pipelines... Looking forward to official Unity feedback.
     
unityunity