Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

[RELEASED] URP & LWRP Mirror Shaders

Discussion in 'Assets and Asset Store' started by AkilliMum, Dec 11, 2018.

  1. liujuan2019

    liujuan2019

    Joined:
    Mar 5, 2021
    Posts:
    4
    HI, I'm very interesting with your urp mirror shaders.
    I want to use in an AR scene with Android device, ARFoundation+OpenGLES3.4
    Using device camera to load real scene frames, and put a virtual object, and with your shaders to render reflection on different material plane,such as water, mirror, tile floor..

    Can your shader run well?

    Cause we tried an open github reflection : https://github.com/ColinLeung-NiloCat/UnityURP-MobileScreenSpacePlanarReflection
    It only supports Vulkan. But google AR core didn't support Vulkan, so we only can use opengles,
    so check with you if your shaders support such configuration : AR scene with Android device, ARFoundation+OpenGLES3.4.
     
  2. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi, can not understand what you wan to achieve. Do you want to make something like this:

    You can reflect your unity objects to a unvisible floor like this.

    And your github link, it is just a screen space reflection (not a real planar reflection). It just draws the what drawn on that frame (so if there is a object like behind a table, it does (can) not reflect that object- it is SSPR). And it requires compute shader support etc (and as you said needs vulkan etc.).

    My solution just draws the whole scene with a virtual camera again and creates a perfect reflection, please understand the difference. And it does not require vulkan etc. Works fine with opengl.
     
    Last edited: Mar 5, 2021
  3. zhuxiaol

    zhuxiaol

    Joined:
    Jan 5, 2021
    Posts:
    6
    Hi @AkilliMum,

    I am confused with SSR(Screen Space Reflection), SSPR(Screen Space Planar Reflection) and Planar Reflection. Could you tell me the difference between the three method? Definition? Principle? Or some reference of each other?

    Thanks a lot!
     
  4. liujuan2019

    liujuan2019

    Joined:
    Mar 5, 2021
    Posts:
    4
  5. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    SSR-SSPR-SSLR which are ScreenSpaceReflection or ScreenSpacePlanarReflection or ScreenSpacePixelReflection or ScreenSpaceLocalReflection are can be said as same which each other. They tries to reflects which main camera draws to scene (the opaque camera image with depth and normal information) to create as possible as good result on scene :) I am not a guru but as i said they limited what is visible on screen. For example i wrote a SSPR package too, you can find it here:
    http://u3d.as/2ijQ and the docs HERE
    It draws (reflects) only what is visible on screen on pixel basis. If you look into the docs of that, you can see for example; it can not reflect the under car, or under crate. (cause they are not visible-drawn to the scene).

    But Planar reflection creates another camera according to real cam position and reflective object's postion, then redraws the scene (so it is slower than SSPR). but it is perfect, draws everything- behind other objects, not visible items etc :)

    Please google a litlle for much more detailed explanation.
     
  6. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
  7. zhuxiaol

    zhuxiaol

    Joined:
    Jan 5, 2021
    Posts:
    6
    Well, I see.
    By the way, I have some other questions.
    1. "URP Screen Space Pixel Reflection Shader" says it does not support VR. Why?
    2. For "Legacy Mirror Shaders and Post Effects", Does the package include the models shown in the videos? I mean the planes, such as floor, ground, water, mirror and so on.
    3. "Legacy Mirror Shaders and Post Effects" vs "URP & LWRP Mirror Shaders", which one has better performance? And the FPS is?
     
    Last edited: Mar 9, 2021
  8. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    1. Because VR needs other setups (custom code, custom shader instructions etc). I could not investigate them yet :) It is not related to my other shaders (cause they use another aproach).
    2. Not made a performance test (probably latest URP should be faster). And it depends on your mirror settings. If you open everything (Full reflection, full MSAA, HDR etc.) it takes the same time as the main render (main camera). Cause as i said it draws the scene again with another camera.
     
  9. morphtekstreaming

    morphtekstreaming

    Joined:
    Sep 2, 2020
    Posts:
    7
    Do your car shaders have that fake but fast to render reflections on car material ,like in csr ?
     
  10. barcode802

    barcode802

    Joined:
    Apr 6, 2014
    Posts:
    35
    It says in the asset description that this is supported in VR for Oculus Quest - does anyone know if it can run at 72 FPS on the Quest 1? Tested out several other shaders on the store claiming to run on Quest but then can barely run 30 fps which is not at all usable for VR. I am looking for a good solution that can be used for water surfaces (like in a lake or pond). Thanks ahead of time for anyone with info!
     
  11. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Sorry but no. As i know they just creates very big cubemap for whole environment and then they rotate them in shader according to car position etc.
    My rotatable probe shader does a similar job but i am not sure if that can give similar results. If you provide me similar environment, i can test it :) (But it is not a car shader but based on URP's lit shader, please consider that).
     
  12. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    It depends on what you want to reflect, your assets, draw calls etc. But it is quite difficult to say that should work. usualy very good mirror (perfect reflection) takes nearly same time as the main render (so not a good choise if you have heavy assets).
     
  13. liujuan2019

    liujuan2019

    Joined:
    Mar 5, 2021
    Posts:
    4
    HI,
    For the package you used built-in render pipeline,
    1. Does it contain all the codes in the package, such as those shaders, or some cs code files?
    the contents are same as you list in https://assetstore.unity.com/packag...mirror-shaders-and-post-effects-81728#content

    2. I installed your android demo apk, and found there're some wave/ripple effect, will these shader codes also contain in the purchased package($35) ?

    3. In the $35 package, will it contain some tile floor/wooden floor model?
     
  14. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi,
    1. Yes it is all code (no dll etc.)
    2. Yes but ripple may not work on low end mobile devices.
    3. I do not provide models or textures in the package. Just some simple items to visualize the samples.
     
  15. liujuan2019

    liujuan2019

    Joined:
    Mar 5, 2021
    Posts:
    4
    Check with you again, and I will purchase the package using standard render pipeline.
    All upper yes, is for the the package using standard render pipeline?
     
  16. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    No :) as i said i do not provide textures or models. only 1 and 2 is yes :)
     
  17. SaiKiranKotha

    SaiKiranKotha

    Joined:
    Jul 11, 2020
    Posts:
    4
    Does this support Quest 2 ?
     
  18. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi, i do not have quest2 but buyers using it on quest2. Only problem is (they say); if you use "widest" IPD
    ( you can check the IPD explanation here: https://support.oculus.com/351344152731317/ )
    it creates a distracted textures (not sync). But the "narrowest" and "middle" IPD works great. Please consider that.
     
  19. SaiKiranKotha

    SaiKiranKotha

    Joined:
    Jul 11, 2020
    Posts:
    4
    Thank you for fast reply!
    Is there anything you could do to fix it in the future ?
     
  20. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    I am not sure what can be the problem. VR is very hard to test and correct for me and it is a little difficult to get those high end devices in my country :) But when i receive a one of course i will try my best to correct it. But please be aware of that problem and the resolve date is unknown :)
     
    SaiKiranKotha likes this.
  21. zhuxiaol

    zhuxiaol

    Joined:
    Jan 5, 2021
    Posts:
    6
    Hi, @AkilliMum
    Does your reflection shader work on the Camera or on the plane which is used to reflect the objects?
     
  22. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Shader is attached to material on the mirror object (floor plane for this example). But mirror script runs on camera (attached to it). Script creates the reflection (render textures) and sends it to material (to object) :)
     
  23. zhuxiaol

    zhuxiaol

    Joined:
    Jan 5, 2021
    Posts:
    6
    Follow your reference "https://docs.google.com/document/d/...SHlA0TTA3qsLBSiHM/edit#heading=h.6i9vkp3yswfd", there is no reflection in my AR Project. How do you set in your AR project?
    P.S. I use the untiy arcore package. What package do you use? ARCore or ARFoundation?
     
  24. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
  25. zhuxiaol

    zhuxiaol

    Joined:
    Jan 5, 2021
    Posts:
    6
  26. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    I will try to create a sample as sson as possible. I will use the latest version of unity and ar foundation. But if you follow the doc and create a scene within unity (as normal game play and create transparent floor etc) then publishing to AR should work just fine. But of course there may be some tricks and settings etc.
    Do you have a special case for your game? For example my sample uses a reflective floor as a sample (as seen on the previos videos)!
     
  27. zhuxiaol

    zhuxiaol

    Joined:
    Jan 5, 2021
    Posts:
    6
    Well, now I am trying to show the effects as your demo video. The reflect effect will be changed by the plane type(maybe it will be mirror / floor/ water and so on...).
    ----------------------------------------------------------------------------------------------
    Reflection effect works on my Unity AR Project now! Thanks a lot!
    BTW, in your demo video the reflection effect changes from light to dark when you drag the "Reflection Transparency" slider during 1'13" to 1'15". Are there any parameters to adjust?
    Q1: The reflection disappears from top to bottom. How to adjust?
    Q2: The reflection strength which makes the effect change from light to dark can be adjust by Intensity in Camera Shade. Am I right?
    Q3: And in 1'42", it seems that you do nothing. But the reflection is suddenly full dark, then the reflection effect can only change from light to dark but can not disappear from top to bottom, why?
     
    Last edited: Mar 31, 2021
  28. Tom-Goethals

    Tom-Goethals

    Joined:
    Mar 6, 2015
    Posts:
    102
    Hi There,

    I'm using Unity 2020.3.2 URP 10.4.0, Building to Quest2 on Vulcan, Oculus XR plugin on Multiview and package 3.32 of the mirror shaders.

    Both in editor with Link and on device I'm experiencing the same issue in the mirror reflection where the mirrored image lags behind. Feels like Asynchronous Spacewarp is not used on the reflection or like the rendering of the reflection camera is just a tad to late (lateUpdate vs Update type of thing).
    Edit: If I hold my head still, and only move my hands or objects in the scene, everything looks synced. It's when rotating my head everything seems to follow along for a frame. Indicating that it's related to XR tracking.

    Anyone else experiencing a similar issue?

    Thanks!
    Tom
     
    Last edited: Apr 9, 2021
  29. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi, did you read the bugs section? There is a Unity bug for XR in Unity after 2020.2.
    https://issuetracker.unity3d.com/is...ender-method-is-lagging-behind-when-using-urp
    And it is a dark hole if they will solve it :(
    I will try to move the script into a custom pass, but i am not sure if that will solve the issue cause it is again runs after or before the render events!
     
  30. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi, sorry for the delay. I have created an AR sample for the AR Foundation with standard shaders. Please email me for details.
     
  31. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    752
    Has this been updated to be compatible with SteamVR devices yet?
     
  32. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Users says it works fine on steam too. But i do not have steam devices to test. So please consider that.
     
  33. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    752
    The last responses from users I am seeing says it does not work with Vive. Are you saying that has been fixed?
     
  34. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Will look into the mails again. People write me via email rather than here. So please let me check.
     
  35. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    386
    For VR, I see SP instanced is supported, but does the mirror camera actually render in single-pass instanced or render the scene two more times for each eye (so multipass rendering) and then recomposited in the shader for use in SP instanced mode?
     
    Last edited: Jun 20, 2021
  36. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Yes it draws the scene for each eye whatever is the pass mode. So using more than one mirror may affect the play in a bad way. Must be used very careful.
     
    kenamis likes this.
  37. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    @AkilliMum
    I'm having a problem setting up mirrors in my scene. The demos, running in the same project, work absolutely fine -- so presumably the issue is something to do with my scene. I'm working in VR, testing from the editor. Here's a screenshot of what I see:

    MirrorMadness.jpg

    From this angle, the mirror in that medicine chest should just be reflecting the wall beside it. I am using the
    Shader Graphs/AMMirrorTwoEyes
    shader. I even copied the settings from the Mirror Manager in the
    VR/Mirror Shader Graph
    demo scene -- except that the "Up Vector" is set to "Blue Z_Negative" to match this quad's orientation.

    Is there some bit of setup that I'm missing?

    This project is on Unity 2020.3.19 with URP 10.6.0
    I'm using a Quest 2, connected via Oculus Link.
     
  38. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi @Barliesque , it shows the reflection so the script is working. But there must be something wrong with the "Up Vector" or the "Culling". Please try it on game view as "Standalone" mode (as you do with single eye shaders) just to verfiy the UpVector and "culling" is not on the way :) After that switch to "TwoEyes" and "VR" mode. That would be easy to see the if any error happens before switching to VR :) If they do not work, please write me via "akillimum@gmail.com". We will solve it together for sure :)
     
  39. AmirBarak51

    AmirBarak51

    Joined:
    Jul 14, 2020
    Posts:
    9
    Working in Unity3D 2020.3 with URP, the depth cutoff stops working if the camera's near plane is not 0.3, trying to figure out what I'm doing wrong..?

    Also, I'm getting a crazy amount of messages "camera manager create mirror camera called..." in the editor.

    (Forgot to mention, I'm using the ARFoundation).
     
    Last edited: Nov 1, 2021
  40. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi, If you change the near plane, the cutoff on the shader side (material) should be modifed too, cause it uses near plane internally :) Please try that.
    And second error should disappear with version 4.04 please download that (should be online in a couple of hours).
     
  41. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    592
    Hi AkilliMum

    Does this asset work on consoles? Xbox One, Xbox Series, Ps4, Ps5, Nintendo Switch?
    Thank you
     
  42. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi, it is based on URP so it should. But i have no console to test it :)
     
  43. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    592
    Darn.... ok. Hard to make a purchase decision :oops:
     
  44. dariuou

    dariuou

    Joined:
    Nov 27, 2015
    Posts:
    3
    Hello, I'm seeing a bug when I use overlay cameras. It works perfectly without the overlay, but when I add one or more overlay cameras to the stack on the main camera it starts acting up. It shows the scene like the camera is in the wrong position, it looks like if might be rendering from a camera that is behind the mirror looking towards the mirror.
     
  45. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Hi just someone said the same thing and we have solved that a couple of days ago. But i must be honest i forget to update. I will send the update right away. Sorry for the trouble.

    EDIT: Just released 4.06 which solves the problem :)
     
    Last edited: Apr 5, 2022
  46. dariuou

    dariuou

    Joined:
    Nov 27, 2015
    Posts:
    3
    Working perfectly now! Thanks so much!
     
  47. dreamerz_lab

    dreamerz_lab

    Joined:
    Jun 9, 2017
    Posts:
    3
    Hi @AkilliMum,
    Nice job u have done. Thank you
    Does ( Depth Blur ) feather working in ( MAC OR IOS ) ? in my case not working.
    Using : Unity- 2021.2.17f1
    and URP & LWRP Mirror Shaders v4.06
     

    Attached Files:

  48. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    Thanks @dreamerz_lab but new 4.06 above 2021.2 does not implement yet depth blur. But old shader is there too. Is not "Scenes_OldCameraShade -> DepthBlur" scene working? Did you tried that parameters? Because params can be changed according to the scene. If the scene objects big-small etc.
    Edit: also you should not use it on mobile. It is very heavy :)
     
    Last edited: May 10, 2022
  49. dreamerz_lab

    dreamerz_lab

    Joined:
    Jun 9, 2017
    Posts:
    3
    @AkilliMum,Thank you so much for quick reply and confirmation. Yes everything is working fine in windows, but we need to support for MAC and IOS.
    I hope we will get updates soon...........
     
  50. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    107
    @dreamerz_lab Actually i prepared that package on mac first, than moved to windows. Will look into mac again, i broke something maybe on windows for mac :) But as i said IOS could not run depth-blur. Please use simple-depth instead.