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

[RELEASED] URP & LWRP Mirror Shaders

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

  1. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Please see the package HERE

    Based on SRP lit shader; mirror, glass, reflectivity, simple ripple and waves, advanced depth, blur, transparency and much more...

    VR Ready
    Oculus Rift -> SinglePass and Instanced modes are tested.
    Oculus Quest -> Multiview-LWRP and SinglePass-URP tested only.




    You can adjust the intensity of the reflection:



    Advanced depth and blur calculations:



    Alpha mask and ripple simulations:



    Depth based cuttoff:



    Full mirror:




    Simple wave simulations:



    Transparent glass reflections:



    And much more :)
     
    Last edited: Apr 21, 2020
    shacharoz, fherbst, User340 and 2 others like this.
  2. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Asset is released...
     
  3. castana1962

    castana1962

    Joined:
    Apr 10, 2013
    Posts:
    400
    Hi. Sorry for my ignorance but Is it working to optimize 3D models for VR projects?
     
  4. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Edit: Now supports VR (tested with Rift and Quest only).

    I will try to implement vr later, but as it now; it DOES NOT WORK with VR! Please stay in touch :)
     
    Last edited: Jul 15, 2020
  5. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    337
    On the asset store page you say I could buy the standard pipeline shaders and then upgrade to get the Lwrp package too?

    IMPORTANT: If you want standart pipeline reflective shaders please first buy STANDART package. Than you can upgrade to this one.
    I am working on a small AR app with Vuforia and LWRP is broken for their shaders in the current version, hence I will switch to LWRP as soon as they release an update but for now I would like to use the standard shaders. How would the upgrade process work?
     
  6. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    The packages are different packages right now, so there will be no upgrade here after.
     
    Last edited: Jul 14, 2019
  7. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    337
    okay I see the discount is applied automatically if you have bought the first asset already. nice, you just got a new customer ;)
     
    AkilliMum likes this.
  8. beelyho_unity

    beelyho_unity

    Joined:
    Feb 7, 2019
    Posts:
    17
    Would you mind to provide some sample images to specifically to explain the detail of the feature "Alpha masked reflections"? Thank you for your attention.
     
  9. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi, i gave a small example here:

    It just draws the reflection according to your alpha value (of your texture). So anything is possible. For example a road with rain puddles, or an icy road with blurred reflections, or a damaged reflective surface etc.

    If you want to achieve something similar, please share a screenshot (or video) of your example, and i can tell you (or make a similar scene for you to simulate that) if my shaders can create that.
     
  10. beelyho_unity

    beelyho_unity

    Joined:
    Feb 7, 2019
    Posts:
    17
    Hi AkilliMum

    Actually, this is what I was looking for... the reflection pass.

    Thx.
     

    Attached Files:

  11. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi, my shaders are just for flat surfaces. I do not calculate the reflection according to normals (but it is a good idea, i will consider that :))

    As i see from your scene a static reflection probe can solve your problem. Do you have an active (with a lot of moving objects) on your scene? So you want a dynamic reflection on item?
     
    P_Jong likes this.
  12. P_Jong

    P_Jong

    Joined:
    Jun 14, 2017
    Posts:
    58
    He helped work with me to get it to work in VR with the Oculus Rift. He will be pushing out an update to it soon to the asset store (currently v 1.31). I highly recommend you getting it and trying it with the HTC Vive after its updated. I'll be adding it to my main Oculus Start project. The developer AkilliMum was extremely patient and helpful in getting it to work with the Oculus Rift. While I don't think there will be any major issues with the HTC Vive, I'm sure if you do encounter any problems, he will be very helpful. So if you are still wanting some cool planer reflections in VR, I highly recommend this asset.
     
  13. thubina

    thubina

    Joined:
    Sep 26, 2019
    Posts:
    1
    We're trying to use this in a scene with multiple reflective surfaces. They're all the same normal (it's the ground) but there are different elevations. The only elevation that looks correct is the one that is the same as the first object in Shades. The reflection in all other elevations is offset. Is there a way to fix this?
     
  14. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi, to use multiple objects for same reflection, they must be exactly on same plane, like a bathroom mirrors (separate multiple small mirrors) on the same wall! Your mirrors maybe on same direction and have same normals but if they are not on same plane, they will act differently because of the reflection will be calculated according to the origin (first object position). Hope it helpes you!
     
  15. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    Hi @AkilliMum,

    Just got your plugin to use on Oculus Quest, Unity 2019.1, LWRP, VR, single pass to show a simple flat planar mirror.

    - It works fine in the Editor.
    - When having "Force Single Pass VR" unchecked: it renders the reflection perfectly for the Left eye only, but black for the Right eye.
    - When having "Force Single Pass VR" checked: reflection does not work at all.

    Do you have any advice? Is there any specific LWRP setting I need to have checked or maybe something else I may be missing?
     
  16. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi there, i have tested the shaders only for Rift! But i ordered a Quest a few days ago :) I hope it will be in my hands in a few weeks (i am a little far away from ireland :) ) and i will make the shaders work on Quest too. Please be patient and focus on your other developments, i will make it run on Quest for sure :)
     
  17. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    Hey @AkilliMum, thanks for the quick response.

    I tried again today, using your own Mirror_ sample scene and planar reflections indeed work in VR on the Quest.

    So it is something I am probably doing wrong in my scene. I will dig deeper. It will be useful if you can update your documentation with the absolutely required steps one must take to add reflections in VR (maybe there is a check box I am missing somewhere), for those who can not start from samples and must add this to existing scenes.

    Thank you.
     
  18. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hmm interesting. I really do not about the development steps on Quest. Script usage is very simple just add to camera, and set the effected object slots with mirror objects and materials :) Maybe there are several cameras on your scene and you are putting it on wrong cam. Please compare the camera settings on samples with yours.
    And after the device arrival, i may ask a sample (with wrong reflection) project from you :) So i can investigate it.
     
  19. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    @AkilliMum some more debugging for you.

    I can make it work when my "plane" is on the "floor" and the axis is set to "Green Y".
    When I rotate my plane, it stops working, it's just gray.
    When I then change the axis to "Blue Z_negative" I can not even compile, I get this useless error:

    ```
    UnityEditor.BuildPlayerWindow+BuildMethodException: 5 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:190
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    ```

    Just switch your platform to Android and try it out, that's what Oculus Quest is.

    Overall I would say this is at a "prototype" level now and requires a lot of fiddling to get it work. You may want to improve it to avoid getting bad reviews on the store.
     
  20. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Do not worry i will fix that :) Maybe i should change the desc to "tested only with rift, may not work on other VR devices" and add others one by one after tests.
     
  21. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    I think it's not just that... overall it's too "fiddly". I can have it working fine as I need it to work. Then I add a separate "cube" object behind it and it stops working. I think overall you may need to test it in different scenarios, different scenes, different angles, different parent transforms at different rotations. These are the things that seem to break it for me.

    Overall when it works it looks good, so I think it's just about making it more "fool proof" :)
     
  22. lizhao0000

    lizhao0000

    Joined:
    Jun 26, 2017
    Posts:
    2
    HI @AkilliMum found a bug ?for you.

    runtime environment:
    UNITY PRO 2019.1.12f1
    post processing version 2.1.7

    I commented the code related to the post process, temp fixed.


    BUG:
    when camera add post process layer and playgame mode , disable the CameraShade and report more error:


    Invalid type
    Assertion failure. Value was False
    Expected: True

    KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <7d97106330684add86d080ecf65bfe69>:0)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.GetBundle (System.Type settingsType) (at Library/PackageCache/com.unity.postprocessing@2.1.4/PostProcessing/Runtime/PostProcessLayer.cs:631)
    UnityEngine.Rendering.PostProcessing.PostProcessManager.ReplaceData (UnityEngine.Rendering.PostProcessing.PostProcessLayer postProcessLayer) (at Library/PackageCache/com.unity.postprocessing@2.1.4/PostProcessing/Runtime/PostProcessManager.cs:308)
    UnityEngine.Rendering.PostProcessing.PostProcessManager.UpdateSettings (UnityEngine.Rendering.PostProcessing.PostProcessLayer postProcessLayer, UnityEngine.Camera camera) (at Library/PackageCache/com.unity.postprocessing@2.1.4/PostProcessing/Runtime/PostProcessManager.cs:319)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.UpdateVolumeSystem (UnityEngine.Camera cam, UnityEngine.Rendering.CommandBuffer cmd) (at Library/PackageCache/com.unity.postprocessing@2.1.4/PostProcessing/Runtime/PostProcessLayer.cs:803)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Library/PackageCache/com.unity.postprocessing@2.1.4/PostProcessing/Runtime/PostProcessLayer.cs:852)
    UnityEngine.Rendering.LWRP.RenderingUtils.RenderPostProcessing (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.LWRP.CameraData& cameraData, UnityEngine.RenderTextureDescriptor sourceDescriptor, UnityEngine.Rendering.RenderTargetIdentifier source, UnityEngine.Rendering.RenderTargetIdentifier destination, System.Boolean opaqueOnly, System.Boolean flip) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/RenderingUtils.cs:130)
    UnityEngine.Rendering.LWRP.ScriptableRenderPass.RenderPostProcessing (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.LWRP.CameraData& cameraData, UnityEngine.RenderTextureDescriptor sourceDescriptor, UnityEngine.Rendering.RenderTargetIdentifier source, UnityEngine.Rendering.RenderTargetIdentifier destination, System.Boolean opaqueOnly, System.Boolean flip) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/Passes/ScriptableRenderPass.cs:141)
    UnityEngine.Rendering.LWRP.PostProcessPass.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/Passes/PostProcessPass.cs:53)
    UnityEngine.Rendering.LWRP.ScriptableRenderer.ExecuteRenderPass (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.ScriptableRenderPass renderPass, UnityEngine.Rendering.LWRP.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/ScriptableRenderer.cs:314)
    UnityEngine.Rendering.LWRP.ScriptableRenderer.ExecuteBlock (UnityEngine.Rendering.LWRP.RenderPassEvent startEvent, UnityEngine.Rendering.LWRP.RenderPassEvent endEvent, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.RenderingData& renderingData, System.Boolean submit) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/ScriptableRenderer.cs:263)
    UnityEngine.Rendering.LWRP.ScriptableRenderer.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.LWRP.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/ScriptableRenderer.cs:157)
    UnityEngine.Rendering.LWRP.LightweightRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/LightweightRenderPipeline.cs:163)
    UnityEngine.Rendering.LWRP.LightweightRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Camera[] cameras) (at Library/PackageCache/com.unity.render-pipelines.lightweight@5.7.2/Runtime/LightweightRenderPipeline.cs:116)
    UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera[] cameras) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipeline.cs:72)
    UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, UnityEngine.Camera[] cameras, System.IntPtr loopPtr, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineManager.cs:67)
     
    Last edited: Oct 11, 2019
  23. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    I solved the bug. Will be enabled by version 1.42 in a few days. Thank you:)
     
    Last edited: Oct 12, 2019
  24. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Yes of course, but i can not think of all scenarios. There are infinite of them :) I will solve the bugs with your help. Like @lizhao0000 , lizhao0000 found a bug and notified me like you and i solved it. Thanks to lizhao0000 and you for notifying me.
     
  25. BananaStem

    BananaStem

    Joined:
    Sep 21, 2017
    Posts:
    41
    Hi, the asset works well, although when I seem to reflect a custom glass shader by LUX it doesn;t handle it too well. In the scene view it reflects the glass beautifully, but when I enter game mode it makes it almost opaque. Any help would be incredible :)
     
  26. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi there, not sure what would be the problem. Can you send a very simple project to me with the problem exists in it?
     
  27. BananaStem

    BananaStem

    Joined:
    Sep 21, 2017
    Posts:
    41
    Turns out it had to do with the refraction setting on the shader. I've unfortunately disabled refraction now, but it's a worthwhile trade off :)

    I have noticed another thing. When I use Unity's occlusion culling, the reflections will of course not show anything that isn't in my direct view because of this method. Would there ever be a work around this?
     
  28. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Can you send a small video which shows the behaviour? (Maybe i should put an option to not to reverse the culling, but not sure until see your problem :) )
     
  29. BananaStem

    BananaStem

    Joined:
    Sep 21, 2017
    Posts:
    41
    Here you go :)
     
  30. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hmm, seems CameraShade script is rendering the mirror too :) Sometimes if the mirror object is not flat (or not a plane and created with another software) it may render the object too. The answer is very easy:
    Please put your mirror object (i suppose table-top here) to some layer like "Mirror". And exclude it from the CamareShade script's "Reflect Layers" property. :)
     
  31. BananaStem

    BananaStem

    Joined:
    Sep 21, 2017
    Posts:
    41
    Thanks for getting back to me :) Unfortunately I did try this and the issue still persists.
     
  32. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    May i get a simple project from you with the problem in it? :)
     
  33. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    @BananaStem it is a culling problem i suppose because of baked occlusion, I put an option to disable it on new version which will be available in a few days. But if you do not want to wait, you can put this line
    dest.useOcclusionCulling = false;
    in CameraShade script in UpdateCameraModes function. For example just after
    dest.allowHDR = HDR;
    line
    In new version there will be a "Turn Off Ocullusion Culling" option in the script :)
     
  34. VRising

    VRising

    Joined:
    Apr 15, 2016
    Posts:
    29
    I am trying to test out the sample scenes but Unity keeps crashing on me. Anyone else? I'm using Unity 2019.3.0f5.
     
  35. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Last edited: Jan 18, 2020
  36. VRising

    VRising

    Joined:
    Apr 15, 2016
    Posts:
    29
  37. avandenberg

    avandenberg

    Joined:
    Nov 22, 2018
    Posts:
    23
    Does this work with Unity XR plugin?
     
  38. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Yes please see the youtube channel and the documentation.
     
  39. tomszirtes

    tomszirtes

    Joined:
    Apr 25, 2013
    Posts:
    20
    Hi,

    I think I found a problem with the package with Unity 2019.2.21 + Oculus VR (Rift). It occurs in all the sample scenes and my own example.

    The problem appear to be with the Skybox which moves around strangely when you rotate your head. More strangely it actually occlude the geometry in the scene - effectively looking like its clipping the scene. At first I thought it was something to do with far clipping plane, but actually its linked to the camera viewing angle.

    Sample scene 1


    Clipping example


    Any help would be appreciated!
     
    P_Jong likes this.
  40. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
  41. tomszirtes

    tomszirtes

    Joined:
    Apr 25, 2013
    Posts:
    20
    Thanks for your prompt reply. Sorry I didn't see that - I understand.

    However I still have a question - the Mirror package I purchased doesn't include that Skybox shader.
    So looking at the link in the video it requires me purchasing this asset? (https://assetstore.unity.com/packag...r-invisible-light-and-shadow-receivers-117639)

    However that asset says it working in Standard RP only but I'm using LWRP.

    What are my options?

    Thanks
     
  42. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi, there must be shaders in
    AkilliMum\Standard\Invisible
    folder, please see the samples for skyboxes in
    AkilliMum\Samples\Standard\Invisible
    too.
     
  43. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi I'm using Unity 2013.3.8f and URP & LWRP Mirror Shaders 3.0, I imported Universal RP but I'm not able to make it work:



    Any suggestions? Thx
     
  44. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Please create an empty project by selecting URP on startup. That will make all necessary settings for URP. Than you can install my package!
    Or if you have an existing project with standard RP, please see this video for setup:
     
    RoyalCoder likes this.
  45. yusefkerr

    yusefkerr

    Joined:
    Apr 5, 2011
    Posts:
    179
    Hello, will this work with URP / WebGL?
     
  46. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Yes, but depth does not work on webgl. So depth based effects will not work.
     
  47. yusefkerr

    yusefkerr

    Joined:
    Apr 5, 2011
    Posts:
    179
    Thanks for the reply. Can you explain what this will affect? The main thing I can think of is depth of field, but I'm not sure how that would affect the effects in the scene.
     
  48. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    They are the affects like in the "furniture" or "black car" scene (on the screenshots). So it uses the depth to cut the reflection on a certain level. Hope that explains it. And i embedded a video to the top of the thread. You can look into furniture video there, it shows how "Depth Blur" (and the simple depth also works nearly same) is working. So that kind of effect will not work on webgl. But others are ok :)
     
  49. Sheynes

    Sheynes

    Joined:
    Mar 27, 2017
    Posts:
    66
    Hello, I plan to purchass this asset and move my project to HDRP as soon as a full VR support is here.

    Why doesn't it works for Vive and when do you expect to have this working for every headsets ?
     
  50. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    It is not HDRP compatible right now. And i do not know if i will import it to it!
    I do not a vive headset. So i can not test-work on it. I do plan to have, but it is hard to get those headsets here (in my country).
     
    Sheynes likes this.