Search Unity

[RELEASED] Standard RP Mirror Shaders

Discussion in 'Assets and Asset Store' started by AkilliMum, Nov 3, 2019.

  1. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Please see the package HERE with some other packages included
    or
    Only mirror shaders HERE


    Based on standard 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
  2. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I purchased these and it seems quite amazing but could you recheck the demo scenes I am getting this error and lots of flickering in the scene that uses I am currently using the Waves scene but the entire mirror folder is giving this error so it's likely just a fix it one time and the rest fix error.

    Invalid antiAliasing value (must be at least 1)
    UnityEngine.RenderTexture:set_antiAliasing(Int32)
    AkilliMum.Standard.Mirror.CameraShade:CreateMirrorObjects(Camera, Camera&) (at Assets/AkilliMum/Standard/Mirror/CameraShade.cs:1359)
    AkilliMum.Standard.Mirror.CameraShade:RenderMe() (at Assets/

    Let me know if you need additional details.
     
  3. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Yeap i suppose it throws that on deferred rendering cause of no MSAA is supported but i try to add to settings if (MSAA) is checked :) Will correct it on next release :)
     
  4. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Thanks I will wait for the next release, until then I can't do much with it since every demo scene needs edit for me lol.
     
  5. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Please set the qualitysettings AA to at least 2 to not to get error until i fix it :)
     
  6. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Hello I have a few questions; how are you achieving light bounce on the walls they look very realistic:


    Also under the Car it looks like AO is that in your package?


    Lastly I wanted to know what you meant by the masking and edge blending because I didn't see example anywhere.
    I wonder if it's possible to blend a rock into the sand using you post effects?
     
  7. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    They are lightmaps. I am using some area lights to bake the lighting :) Nothing special there. Just some static objects and light baking. Even the car is static too. So it is baked light under it.

    Masking and edge blending? Do you mean the masked reflections as here, you can put an alpha masked transparency to the floor to get this effect:
     
  8. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Hi, just a question, does your plugin include AO too?
     
  9. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Do you mean ambient occlusion effect? If so, no :)
     
  10. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Yes, I mean Ambient Occlusion.
    Ok, thank you for the info, despite the lack of AO your plugin seems quite impressive, think i'll have a go with it.
     
  11. Baronze

    Baronze

    Joined:
    Jun 15, 2017
    Posts:
    1
    Hi, I can't open sample scenes.
    And this is what happens when I open it.
    upload_2020-4-16_18-23-4.png
    Can you tell me how to fix the problem.
    (I use unity 2019.3.0f5)

    I want to work with VR(Vive and Rift). If there is a setting method or plug-in required, please tell me.
     
  12. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi, 2019.3 has a bug but it is been solved after 2019.3.8.f1 (you can look to my documentation). Please use the latest version. It is not compatible with vive right now but does not require anything special for rift.
     
  13. Nikodemus

    Nikodemus

    Joined:
    Nov 28, 2014
    Posts:
    32
    Hi want to buy this asset but need Vive/Steam support, when will it come?
     
  14. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    I have to buy a vive device. But this corona think broke my schedules (i can not get it from abroad, and here in my country prices are very very much; that i can not afford right now). I can not give a certain time. Sorry about that :(
     
  15. Volkerku

    Volkerku

    Joined:
    Nov 23, 2016
    Posts:
    113
    Frame rate on Quest
    Asset works great, however I think it has a significant impact on the frame rate.
    I'm using a relatively large mirror on a wall, reflecting a room back. Needed to go really high rez with the camera shade settings, it just did not look good otherwise (blurry and jaggy). So I went the 2048.
    There are no other effects, only this mirror at it's very basic setting.
    What inspector parameter adjustment could help lift the frame back up with the mirror? What is most expensive to render?

    Another issue I'm having, I got a screenshot/photo capture function (using a temporary camera and render texture saved as Jpeg). But the mirror is not correctly captured, as you can see in the image below. The mirror image fills the whole wall, but looks oddly distorted in the screenshot?
    EmbodiMap_17-06-2020-12-39-52.JPG
     
  16. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    As you know it is a planar reflection and draws the scene again (if you want perfect reflection) and expensive as it should. You can make some optimizations via changing some values which are described on documentation on:
    https://docs.google.com/document/d/...SHlA0TTA3qsLBSiHM/edit#heading=h.34g88nuou4m5
    Please try those values as described in "Optimization “Camera Shade”" section.

    My suggestion would to use LOD levels to draw smaller LODs on mirror. And you can put your dynamic objects in a different layer and reflect only them (like user avatar etc.). Room can be reflected with standard probes. Please see the "Mix Black Color with reflection Probes" sample to see how to make it possible. That would save you :)

    I am not sure what can be the problem with your temp camera. But reflection uses the camera which it is attached to (calculates the reflection angle etc. according to it). So if you use another camera to get screenshot etc. you may get that distorted reflection.
    If it is a camera created via scripting, before taking screenshot you can move your real(main) camera to this temp cam's position and rotation (so reflection will draw from that point). Then you can move the real camera to it's original position after that. Hope that solves your problem.
     
  17. Volkerku

    Volkerku

    Joined:
    Nov 23, 2016
    Posts:
    113
    Thnaks, I try that

     
  18. xkingjohnx

    xkingjohnx

    Joined:
    Feb 22, 2016
    Posts:
    67
    Hey I just came across this asset.. and it looks pretty interesting..
    Can anyone tell me if it´s possible to use multiple mirrors at runtime with a correct reflection of the scene?

    e.g. placing a mirror at one wall and another mirror on a 90° wall causes issues with some other mirror shaders I tried so far.. does that work with this one?
     
  19. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi, multiple mirror is supported of course. You can put as many mirror in your scene (with different angles too). But mirrors can not reflect each other (mirror in mirror supported but only for 2 mirrors and it may kill the fps :) So i do not recommend to open (use) it if you do not have a very powerfull system).
     
  20. xkingjohnx

    xkingjohnx

    Joined:
    Feb 22, 2016
    Posts:
    67
    hi thx for your reply..
    would it work with this asset
    I used the ciconia shader so far, but it looks like there is an issue with RenderToCubemap ..

    Does your asset support that?
     
  21. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Sorry but it does not work. RenderToCubemap seems to disable camera events so both Standard and URP shaders seems to not work there.
     
  22. xkingjohnx

    xkingjohnx

    Joined:
    Feb 22, 2016
    Posts:
    67
    do you know if there is any workaround for that?
     
  23. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    I looked into the code of that asset but it simply calls rendertocubemap, and as i searched it there seems to be no workaround (i tried a few thinks but not worked) sorry.
     
  24. AaronAteo

    AaronAteo

    Joined:
    Sep 11, 2019
    Posts:
    7
    Hi :) Is it possible to have a mirror with a larger field of view (like a convex mirror)?
     
  25. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Sorry but it is just a planar :) i have not tried convex or concave etc. Have to look into that.
     
  26. AaronAteo

    AaronAteo

    Joined:
    Sep 11, 2019
    Posts:
    7
    Ok, thanks!
    So far I managed to get a higher fov in the mirrors by manipulating the projection matrix (like described here) in the CameraShade script. But it behaves weirdly as the vanishing point in the mirror moves when I rotate the camera.
    I'll leave it be for now and see if you manage to implement it in the future :)
     
  27. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hmm, you can set the fov of reflection camera manually but i am not sure if that gives you the desired result
     
  28. trueh

    trueh

    Joined:
    Nov 14, 2013
    Posts:
    74
    Hi there!

    I'm having an issue with this asset. I don't know why, but the mirror is reflecting something weird. It's like at some point it is becoming transparent or reflecting the wall at the back. When I move the character near the mirror, the wrong effect disappears.

    I have recorded this video:


    I have tried about everything and I don't get to make it work: deactivating all post-processing, moving the mirror to different positions, activating and deactivating all options in the Mirror Manager, tested different configurations in the shader, ...

    This is in Unity 2021.3 LTS (latest version) with the most recent version of your asset. It is the built-in pipeline.

    Any clue on what might be happening?

    Best regards.
     
  29. trueh

    trueh

    Joined:
    Nov 14, 2013
    Posts:
    74
    I have just tried to remove the wall at the back of the mirror and the effect is not showing. I have tried to replace the plane I was using by a cube, but the back walls are still being shown in the reflection. Increasing the Clip Plane Offset is not helping.

    What it seems to help is changing the rendering mode in the shader to Transparent or Fade. Why? I don't know, but it seems that there is some kind of bug with Rendering Mode = Opaque.

    Regards.
     
  30. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Hi, the problem can be anything. Setup or bug as you said. Can you please connect me via skype as "hayletbisi" or discord "Akilli Mum#6862" so we can look into it together :) or try the tick (open) the "Turn Off Occlusion" option. It may not be occluded by mirrror cam on certain angles :)
     
  31. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Hello, I'm looking for a mirror for use in VR. I see the asset store page says that VR is supported, but is this a true 3D (stereo) reflection? Or is it simply putting a flat renderTexture onto a plane (which I could easily do myself)?
     
  32. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    You can not put just a rendertexture into a plane. It needs matrix transformations, eye seperation calculations and many more :) You can test it by yourself, as you say; just rendering texture and putting it on a plane is not hard :)
     
  33. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Yes, I realize all that. That's why I'm looking for an asset to do this properly. Does this asset do it (stereo reflections) or not?
     
  34. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    Yes it does, but for certain passes. Please see the docs or explanation on asset page. I am not writing it here cause it may change (I will try to add more passes if I find the solutions :) )