Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

urp planar reflections

Discussion in 'Scripting' started by Mister-D, Sep 19, 2020.

  1. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    can anyone port the "planarreflections" script from the urp boat demo to the current URP version?
    or at least point me in the right direction ;)
     

    Attached Files:

  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
  3. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    ive checked it ,doesnt work

    ive fixed the script myself(see attachment)


    but now im getting this warning constantly >

    "Renderer at index 1 is missing, falling back to Default Renderer URP1_Renderer"
     

    Attached Files:

  4. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    any ideas why the script triggers this warning?
     
  5. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    no one knows what renderer at index 1 warning meens?
     
  6. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    I know this is late and you probably figured this out already, but for anyone else facing the same question here is what I have found.

    In the planar reflections script in CreateMirrorObjects there is a line
    "cameraData.SetRenderer(1);"

    If you look at the UniversalAdditionalCameraData script attached to your main camera, you will find the index value of its renderer. For me this was set to default (value -1) and the only other one I had was "Forward", which is at index 0. So there was no index 1 - hence the warning.
    I'm not clear on why this value is hardcoded in the script vs. the copied data from the main camera, but setting "cameraData.SetRenderer(0);" fixed the warning for me. So just replace the index with the value of your desired renderer.

    Hope this helps someone.
     
    Last edited: May 11, 2021
  7. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    yeah i allready fixed it, but tnx for the answer, might be usefull for others
     
  8. KCharlier

    KCharlier

    Joined:
    Nov 24, 2018
    Posts:
    5
    was usefull for me, it works, thx @bnmguy
     
  9. DSivtsov

    DSivtsov

    Joined:
    Feb 20, 2019
    Posts:
    151
    In my case URP 10.5.1
    It solved by changing setting the
    UniversalRP-HighQuality

    I added to render list the Element[1]=PlaneReflection, which was exist in "Assets\Settings" with other URP setting files.
    (I didn't deep dive in URP yet, but warning disappeared)
    upload_2021-11-8_5-58-10.png
     
    WillDoyle likes this.
  10. rogodoy

    rogodoy

    Joined:
    Jan 24, 2013
    Posts:
    21
    Perfect answer! Work!
     
  11. WillDoyle

    WillDoyle

    Joined:
    May 7, 2020
    Posts:
    1
    Thanks for your answer. This worked for me.
     
  12. FranRodri

    FranRodri

    Joined:
    Dec 16, 2019
    Posts:
    1
    That worked! Thanks
     
  13. logic-cpp

    logic-cpp

    Joined:
    Mar 11, 2013
    Posts:
    24
    Trying to use this but can't seem to get it to work on a water plane object I'm trying to shadergraph... feel like i'm missing something or lacking some obvious steps how to put it together..

    Might the script be a bit outdated and needs adjustment for recent updates to URP?

    Related: [Question] URP Planar Reflections guide/example/tutorial

    Any help would be greatly appreciated