Search Unity

[LEGACY] PIDI - Planar Reflections 2. Real-time reflections with Lightweight SRP+Mobile support

Discussion in 'Assets and Asset Store' started by IrrSoft, Jun 29, 2017.

  1. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    Hi, @IrrSoft !

    I've been on a quest for perfect mirrors in Unity for the past couple of days. So far, I've tried a couple of naive implementations of my own (with RenderTexture), and some of the assets from the Store, including Magic Mirror.

    My main concern is that in all cases the mirror reflection does not look exactly right in VR. I will try to illustrate what I mean. Here's a screenshot from Oculus Avatar customization demo (part of Oculus Home):
    oculus_mirror.png

    When I "touch" the mirror with my virtual hands the reflection is precisely what it should be. At the moment of touch, the tip of the finger is at the same point on the screen as it's reflection. This gives an awesome sense of presence.

    Here's what I get in Unity with Magic Mirror Asset: https://www.assetstore.unity3d.com/en/#!/content/34824

    unity_mirror.png

    Here my fingers are very close to the mirror too (my left finger, in fact, even clipped through the mirror plane). Yet their reflection is rendered shifted, this mismatch is very apparent when in VR, and it ruins the sense of presence.

    I suppose the problem is related to separate cameras for left-right eyes and how I should handle them. The solution does not seem obvious.

    @IrrSoft , I would gladly purchase your asset if it indeed solves the problem demonstrated above. So far, I am only targeting Oculus Rift, so that's a #1 priority. Please advise! :)

    EDIT: BTW, so far the only really good "mirror" that I got was achieved by rendering another copy of the user avatar model in a position mirrored with respect to the plane. It looks really good, just like Oculus's, but this is hardly scalable. I am wondering if Oculus uses this hack or a real mirror implementation)
     
  2. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528

    Hi there!

    Thank you for your interest in our tool :)

    We don't have an OculusRift device with us but we have been able to give support and make our tool work well in Oculus projects before, so we will indeed check this issue. From my own experience while developing the tool, the issue in those pics looks more like a wrong reflection offset (too big) rather than a problem with the different cameras. The distance between eyes is not really big enough to produce that big of a shift, but the fact that one finger is clipping makes me think that MagicMirror is indeed messing up a bit the clipping planes and the offset.

    I will be honest with you, we haven't tested this particular behavior with our tool since our own game is not a VR project, so I cannot give you an answer right away, but be sure that I will set up a demo scene today to test if our tool gives this same issue and how to solve it, and will get back to you later with the results so you can know for sure if our tool will work for your project.

    Thanks for your interest and for asking, we will get back to you with an answer ASAP! :)
     
    sun_stealer likes this.
  3. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    Awesome support, thank you for such a quick reply!

    Just in case, I used Oculus Avatar SDK for Unity. There's a sample scene called "local avatars", so it should be rather easy to reproduce this (just drag-n-drop Oculus SDK, open LocalAvatars scene, enable 3rd person avatar checkbox and drop your mirror into the scene).

    Thank you again for replying so swiftly, I look forward to hearing from you!
     
    IrrSoft likes this.
  4. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there,

    We have made several tests across different scenes (not very easy since we do not have an Oculus and had to set up and move around all the controllers by hand to get them in the right positions).

    Here are our results :

    Test #1 :
    Single camera, output to both eyes, single pass.




    However, this is inside the Unity Editor and rendering through Stereo Display, so the actual rendering in the Oculus Device may be wildly different. This is mostly a way to show how the mirror doesn't have any offset under normal circumstances.

    Test #2

    Single camera, output to both eyes, single and multi pass using the Stereo Split renderer in Unity.
    It is blurry but it does show that there is a perspective caused difference in the reflections from both eyes.



    When both images get combined in the final project it could go either way (both fingers touching, both fingers with a slight shift)

    Test #3
    2 cameras setup (one for each eye) and multipass rendering.




    Both fingers display the right position, there is no shift, no offset, nor any visible errors. The stereoscopic projections are correct and it works out of the box.

    A few notices though :

    In our Unity version (5.6) when using the 2 camera setup, 1 of the cameras spammed the console with "IsValidMatrix" errors. Unity issued a patch and a fix for this in Unity 2017.1, 2017.2 and we believe that for Unity 5.6 as well. This is not an error from our tool nor from the VR utilities but rather a bug in Unity itself.

    It is not a game breaking bug nor does any actual harm, it is just annoying as it spams the console. It seems it has been fixed in the most recent Unity versions, so we would recommend you using one of those.

    Our tool generates one reflection for every camera in the scene that requires it. In a VR setup, even more in this scenario where absolute precision from both eyes is required, it is recommended to use 1 camera for each eye so the reflections are as accurate as possible.

    We will research and try to push an update later this year to automatically detect cameras that output their render to both eyes and generate the reflection for them twice (and combine them in a single texture in the case of single pass setups), but this update will be a major change to the functionality of the tool and included shaders so it will take a while.

    For now, it seems that you can avoid the issue you described by rendering your project with a 2 cameras system and using preferably the multi-pass set up with our tool.

    We hope this helps, and if you decide to buy our tool and need further help, make sure to send an email with details to support@irreverent-software.com with your receipt number and we will keep helping you to integrate it to your project in the best possible way :)
     
  5. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    When I wrote the question in my previous post, it finally clicked (you know how it happens). I realized that I didn't use the 2-camera setup with Oculus SDK, instead, I used a single-camera setup. Therefore I got "incorrect" positions for the cameras and this shift in reflection.

    After I changed to two-camera setup, I was able to create two mirrors on two different layers (mirror-left and mirror-right), the first one used left eye cam as a player cam, and the second used right eye cam. Of course, I disable rendering of the right mirror for the left camera and vice versa. After that, it worked brilliantly even with Magic Mirror shader!

    Still, I was not very happy with the performance. For VR you need to render mirror texture at about 2048 pixels to get a crisp reflection, and with my approach, I need two mirrors. I purchased your asset to see what performance optimizations it can offer.

    IrrSoft thank you very much for the input! So far, I am investigating the capabilities of your plugin, and it looks promising. I like the multitude of shaders provided for the mirrors.
    First feedback: there's a checkbox in the mirror script settings: Reflect only from explicit cameras. When I click on it I would expect the input field where I can drag-n-drop my "specific camera". Now when I enable this checkbox it always renders black texture. Please advise what I should do about it :)
    Also, update at fixed step does not seem to work in VR. Even with very high values, it shutters constantly. But without this option, it works fine, I see no major issues. The reflection is accurate as far as I can tell (with disabled "Explicit cameras" and disabled fixed update). How does it work this well without two mirrors (one for each eye)?
     
    IrrSoft likes this.
  6. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Thank you for your purchase!
    We are glad to see that you are having good results so far with our tool :)

    The explicit cameras are mostly a workaround that requires a bit of additional setup (mainly to create a clone of each camera you want to render from with the name "ExplicitCamera", make it a child of their original counterpart, adjust a couple of settings and disable its camera component) which is much better explained in the documentation.



    upload_2018-1-23_11-44-45.png upload_2018-1-23_11-45-40.png

    Original Camera (Left) and ExplicitCamera as a child object (Right)​

    Again, this is explained more clearly in the documentation. It is a quite complex approach but it also keeps most of the optimizations in the plugin in place.

    If you want to avoid this hassle and go for a more explicit and easier approach without so many issues, the best solution is the following one :

    Add the HoloLens_ForcedUpdate component to both the Left Eye and Right Eye cameras. Then add your mirror (or mirrors) to their list of "Reflections"




    This will force the reflections to update every time the cameras render the scene. This will disable most optimizations in the plugin (since the left/right eye cameras are forcing it to update) but it will also ensure that most issues, troubles, stuttering etc. are solved :)

    Less work on your part, more control overall and less troubles, only sacrificing a bit of the performance :)

    There are multiple reflections, at least one for each camera. However, all this is handled internally and behind the scenes and set up for each eye automatically, so you don't have to worry with layers and complex setups :)

    PS. Fixed update is not a perfect solution, but it was designed mostly for situations with TONS of reflections on scene (and in unimportant surfaces such as some floors) and for mobile devices. For desktop and mirrors in general, it is advised to disable it :)
     
  7. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    There is a small update on its way for the tool regarding dynamic scaling for the reflections (reflections far from the camera adjust their resolution dynamically) as well as some optimizations on memory usage and some basic pooling. Our plugin is already quite fast (it has been used in several VR projects for Android and mobiles) but be sure we are still finding ways to improve it even more :)
     
  8. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    @IrrSoft Awesome! I was able to use the Hololens script solution, and I have to say, at the moment it is working quite nicely indeed. Thank you for the awesome support!
     
    IrrSoft likes this.
  9. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    No worries, I'm glad to know the answers and the tool helped you :)

    And also, thank you for your review!
     
  10. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Upcoming improvements for this tool in the next update :
    • Dynamic resolution for reflections
    • Small performance boost for the HoloLens_ForcedUpdate component
    • Small performance improvements in pooling and memory management
    Also coming soon :
    • Android-compatible demo
    • Standalone demo package for desktop
    • [In Progress, may take longer since we have no VR device of our own] Small VR demo. Mirror's scene.

    In progress for future updates (later in the year) :

    • Automatic handling of VR cameras that render to both eyes
    • Shader variants for the "Lightweight" pipeline
     
    Lex4art and sun_stealer like this.
  11. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    @IrrSoft Very cool to see the upcoming improvements!

    Here's some more feedback from a couple of days using the tool.
    1) Rendering with mirrors is very expensive in VR. In a mostly empty scene there's no problem getting stable 90FPS on Oculus Rift, but with anything more complicated the mirror causes a significant drop in performance. Oculus's single pass rendering for Windows gives a significant boost in speed, but mirror reflection is incorrect in this case. If there was a way to use single-pass rendering with correct mirror reflections, that would be very helpful.

    2) Dynamic resolution sounds awesome! Indeed, there's no need to render the fullres texture when the mirror is far away. Of course, there should be a "max resolution" cap in parameters.
    BTW, in the current version in the rendering option you can only choose between power-of-2 resolutions for the mirror texture, am I correct? For my current scene 1024 is too low, but 2048 is probably overkill, I'd like to use something around 1600px. Is it possible to use non-power-of-2 resolution?
     
  12. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there, thanks for your feedback!

    Planar reflections, by their own nature, render the whole scene again for each reflection. For VR, this means the whole scene is rendered at least 3 times (one in the main view, one more for each eye's reflection). If you are using multipass, this goes up to 4 times. Right now our work is slightly slow since my teammate had a surgery just yesterday, but I will try to look into improvements for Single pass in these days.

    About the second point :
    The tool does indeed support abstract resolutions without any issues. This feature was disabled to make it easier for new users. I cannot send right now the version that has this feature enabled again since I am on my way to the hospital but if you, for example, create a custom Render Texture anywhere in your project (with any size) and assign it to the Planar reflections component in your mirror, the resolution from this texture will be used. This texture, since it is created by hand in your project, can have any abstract resolution (even, for example, 1366x768). This method (a render texture created as an asset in your project with any abstract resolution and assigned by hand) works without issues in all versions of the tool, including the one you have :)

    upload_2018-2-2_8-1-10.png

    upload_2018-2-2_8-3-14.png

    I believe the water in the demo scene is using a explicit texture assigned this way.

    Have a great day and again, thanks for your feedback!
     
    sun_stealer likes this.
  13. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    @IrrSoft Thank you, this is very helpful!
    Hope your friend gets well soon! No rush at all. You're doing great work.

    BTW, any tips on selecting the correct aspect ratio for the texture of my mirror? E.g. if it's a tall 1:2 mirror should I use something like 1024x2048 pixels for my custom render target?
    Also, if I use 2048x2048 texture for a tall 1:2 mirror, does it mean that half of the calculated pixels are wasted (rendered into texture, but not seen anywhere on the screen?)
     
    IrrSoft likes this.
  14. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Thanks for the good wishes!

    The reflection renders a whole new camera that watches the scene. Imagine as if someone else was looking at your scene from the mirror. Their camera will render to a "screen" that, ideally, should have the same size as the width of your own screen so the mirror reflection is rendered at the same quality as the rest of the game. The reflection is projected on screen coordinates, so for the best looking reflections you should try to render them on the same resolution as the screen. The mirror acts more as a "window" to their "screen", and this means that by design the smaller the mirror is, the more pixels get wasted. We're trying to improve a bit more the projection matrix used in the camera so we can optimize this even further, but the problem is that this solution would break the shadows reflections in older Unity versions (an old Unity bug). But we are looking for a fix at least for newer Unity versions, don't worry :)

    Our upcoming dynamic resolution addition works based on this. Full resolution makes the reflections render at exactly the same resolution as the screen (if your screen is 1902x1080, the reflection will be 1920x1080), Half resolution makes them half the screen size and Quarter resolution makes them go to a quarter of the screen resolution. These values can change dynamically according to the distance between the mirror and the camera that renders it, to ensure that the reflections have a good balance between quality and performance.

    A Reflection resolution multiplier value will also be provided in case you need higher/lower resolution reflections, by multiplying the previous resolutions by 1, 2, 3, 4 or fractions such as 0.5.

    My recommendation is that you use a custom render texture with a resolution equal to the resolution of your monitor, which I am guessing is a 1920x1080 screen, so a texture of 1920x1080 should be enough. This will reduce the amount of pixels the reflection renders to around 50% for each reflection (compared to a 2048x2048 texture) and should give you a good performance boost :)

    Again, the aspect ratio of the reflection should match the aspect ratio of the screen for a better result, not the aspect ratio of the mirror, since the reflection is wrapped according to screen UVs and not the mirror's UVs.

    Hope this helps ! :)
     
    Last edited: Feb 2, 2018
  15. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    @IrrSoft Thank you! Makes sense. BTW, what resolution should I use for VR then? In the specs, it says Oculus Rift CV1 has the resolution of 2160 x 1200, so I guess this is the recommended value?
     
    IrrSoft likes this.
  16. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    @sun_stealer Yes, that would be the best option and is still smaller than 2048x2048 so it should run better. But I suggest you experiment a bit with lower resolutions as well, because maybe a 1920x1080 texture will be crisp enough :)
     
  17. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528


    A small test of the new dynamic resolution feature
     
    Lex4art likes this.
  18. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Another improvement we are looking into is more accurate reflections, which means a more accurate surface contact model. Here is a small preview from what I am talking about :

     
    Lex4art likes this.
  19. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Upcoming improvements for version 1.5 (UPDATED)
    • New screen-based resolution for the reflections, bringing very high quality rendering with a lower performance cost
    • Dynamic resolution based on distance to automatically simplify far away reflections
    • New settings for resolution / optimization control
    • New demo scenes and standalone demos
    • Depth tested reflections for a more physically accurate result (reflections are sharper for objects closer to the surface)
    • Performance boost for VR projects using the HoloLens_ForcedUpdate component





     
    sun_stealer likes this.
  20. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    @IrrSoft Sorry for flooding this thread, but I have a quick question. Does occlusion culling work for mirror reflection cameras?

    I've noticed that there's no explicit camera object in the scene, therefore it must be omitted from the occlusion baking, am I correct? Occlusion culling would be a nice feature for mirrors to have.
     
  21. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there,

    Indeed, occlusion culling is not used in out tool, but this is unfortunately a requirement for the reflections to work as intended (at least until we find a good enough workaround). The reflections, when being rendered, manipulate the geometry and also the projection matrix rendered by the camera. In an earlier version of our tool (which had occlusion culling enabled) this produced a very annoying flickering since the reflection process was conflicting with the occlusion calculations that Unity does. We keep, however, trying to find a workaround for this :)

    And don't worry, you are not flooding this thread. Its very purpose is for us to answer question, announce features and receive feedback and suggestions :)
     
    sun_stealer likes this.
  22. sun_stealer

    sun_stealer

    Joined:
    Oct 4, 2016
    Posts:
    24
    @IrrSoft thank you for the quick reply.
    BTW, I have another thing that I am a bit stuck with at the moment. My skybox reflections seem to be incorrect. Here's a short video demonstration: https://drive.google.com/file/d/1Lc05nEAVZkiDjfQlQSwwAE4jc57Ef-1U/view?usp=sharing

    Notice how mountain and the avatar head reflect perfectly, but clouds (skybox) is shifted and skewed all over the place. I don't seem to be able to reproduce this in an empty project, but I don't know what's so special about my current scene that causes this. Do you have any clue?
    I also was able to reproduce this with the default Unity skybox, so the skybox material isn't the culprit.

    EDIT: it must be something in a scene! I tried to create an emtpy scene in the same project and it seems to be working okay with the skybox.

    EDIT: okay, I think this was just a bug in Unity. I restarted Unity and it fixed itself. I wonder what it might have been.
     
    Last edited: Feb 5, 2018
    IrrSoft likes this.
  23. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528

    Hi there,

    We were trying to replicate it, but we are glad to see that it was just a Unity bug and that you managed to solve the situation :)

    Thanks for contacting us!
     
  24. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Update has been sent to the store and should be available later this week. It was a big one! :)

    This is now a major update (version 1.5) and it includes :

    • Revamped documentation. Clearer, more organized and far more in-depth
    • New screen based resolution control for the reflections. Better performance, better quality
    • Downscaled reflections
    • Dynamic resolution based on distance
    • Improved multi-camera support
    • Brand new PIDI_ForcedUpdate component for a much easier VR workflow, making both the ExplicitCamera and the HoloLens_ForcedUpdate methods obsolete. These methods are still supported but the new PIDI_ForcedUpdate component has better features and performance all around.
    • Brand new shaders and support for depth-based blurred reflections
    • 3 new demo scenes

    We also have a tiny demo for android and Windows so you can see for yourself if this plugin is compatible with your device. A bigger demo for Windows will be available soon.

    Android Demo
    Windows Demo
     
    Lex4art likes this.
  25. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    New version is now live on the asset store.

    Updates and improvements in version 1.5
    • Revamped documentation. Clearer, more organized and far more in-depth
    • New screen based resolution control for the reflections. Better performance, better quality
    • Downscaled reflections
    • Dynamic resolution based on distance
    • Improved multi-camera support
    • Brand new PIDI_ForcedUpdate component for a much easier VR workflow, making both the ExplicitCamera and the HoloLens_ForcedUpdate methods obsolete. These methods are still supported but the new PIDI_ForcedUpdate component has better features and performance all around.
    • Brand new shaders and support for depth-based blurred reflections
    • 3 new demo scenes
     
  26. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    A little talked about feature of our tool is that it is fully compatible with different kinds of perspectives, including orthographic projections, useful for Isometric games that require water and other reflective surfaces :

    upload_2018-2-10_12-44-1.png
     
  27. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    After a few tests, we can now tell you that our tool has support for WebGL as well! :)
     
  28. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi.

    Is this asset support standard Unity specular PBR work flow? Does the shader comes with the asset has specular workflow variants?
     
    IrrSoft likes this.
  29. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Does this work in 2017.3.0p4 single pass rendering in VR while using 1 baked reflection probe for the reflections?

    I find in Vr using realtime reflections not only never looks good but costs way to much to render to for bigger type scenes.
     
  30. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there,

    Yes, the package comes with several shaders based on the Specular Workflow and there are a few new variants that will be available in the new update that follow the Specular, Metallic and Roughness setups even more closely (if you buy the asset, they can be sent to you directly without having to wait for the update just by sending us your receipt number and the request to our support email)

    The asset has already been integrated with several different and complex projects, most of them PBR based :)
     
  31. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there,

    Our asset has been used in several VR projects, most of them ArchViz projects, with great results. However, to achieve high quality reflections that are at the same time physically accurate you should use a 2 camera rig and multi-pass rendering. Single pass and a single camera is supported in some devices (mostly in some Oculus devices) but for most of them (and to be completely sure) multi-pass and a 2 camera rig is recommended when working with planar reflections.

    Yes, rendering real-time reflections is expensive because they have to basically re-draw the scene for each reflection and each eye. However, our tool comes with many optimization settings including dynamic resolution, reflected layers control, shaders that can mix static cubemaps with real-time reflections etc. to improve the performance.

    We hope this information is useful :)
     
  32. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Upcoming improvements in version 1.55 :
    • New package of shaders for better integration with Roughness workflow (Unity 2017 and above)
    • New shaders with a closer integration to the Specular and Metallic workflows
    • Big improvements to compatibility with VR headsets when used along the new Post-processing stack (v2) and custom effects. VIVE is still not officially supported, but we are trying our best to make progress on that end and have already made some.
    • Performance improvements across several scripts.
    • New function PIDI_PlanarReflection.IsObjectReflectionVisible( GameObject object, Camera fromCamera ) that allows detecting (in an approximated way) if an object's reflection in a given surface is visible to a given camera. This function is currently in a preview state and may not be fully ready on version 1.55
     
  33. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    If I wanted to can I use your water shader with only a baked reflection probe as the reflection source and not use real-time reflections? Reason I ask is there's not many waters on the store that work in single pass VR so I would buy your shader just for that fact alone. The realtime reflections are just icing on the cake.
     
    Last edited: Mar 3, 2018
  34. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Well, the water shader was not really designed for static reflections but it is very probable that it will work in Single pass with a cubemap rendered by a reflection probe. Though since, like I said, we haven't tested this behavior because that wasn't the purpose of the shader, I just ask you to give me a chance to test it on my own setup to get back to you ASAP with a definitive answer so you can decide if you want to buy our asset.

    In short, I am fairly sure it should work with just some small adjustments, but let me test it first on my own setup to make sure before giving you a final answer :)

    Thanks for commenting, we'll get back to you soon :)
     
  35. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there,

    I did some work yesterday to fix our standard water shader to support static reflections and see how it looked. In short, yes, our water can be used now with static reflections instead of the real-time ones without issues, by using the custom shader I made yesterday. If you decide to buy, you would just need to contact me afterwards and I send you the modified shader.

    Here are some screenshots of how it looks :


    Low refraction index, low quality cubemap, no waves distortion


    Same cubemap, same refraction index, wave distortion at medium strength (the distortion on the cubemap is fully adjustable just like with the normal water shader)


    Same parameters as above, higher refraction index (water becomes more transparent)


    With a different cubemap from another reflection probe in a different scene



    And finally, the water running in single pass VR inside the editor using the new Mock VIVE VR plugin from Unity to simulate the perspective, projection and texture setup of a Steam VIVE in single pass.

    Again, for real-time reflections a multi-pass setup and 2 cameras is recommended. For the water shader with static reflections it seems that everything just works as intended in both single pass and multipass, with either 1 or 2 cameras.

    I tested everything in Unity 2018.1 but it also should work in Unity 5.6 and above.

    I do not own any VR headsets so using the Mock VIVE and the Split Stereo setups inside the editor with a Single Pass rendering mode is the only way I could test it, but in all the tests I made everything was working allright :)
     
  36. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    The update to v.1.55 has just been sent for approval to the asset store. It includes :
    • Improved support for cameras using PostProcessing stack v1 and v2.
    • Improved support for VR
    • 6 new shaders designed for PBR workflow (Metallic, Metallic+Depth, Roughness,Roughness+Depth, Specular and Specular+Depth) that mimic very closely the Unity standard shader, supporting emission, detail diffuse and normals, depth blurred reflections, occlusion, smoothness, metallic and roughness maps, etc.
    • IN PREVIEW : IsObjectReflectionVisible function that allows you to detect if an object is visible in the reflection from a given camera. It is a basic approximation that is currently under fine-tuning and optimization, but it is already usable in a limited fashion :)
     
    purejenix likes this.
  37. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    A few new updates included in this new version :
    • Fixed a few bugs in the depth calculations for newer Unity versions
    • Added a new depth algorithm for Unity 5.5+ which is more accurate
    • IsObjectReflectionVisible is now fairly efficient and accurate. It still has room for improvement, thus it is still in Preview and undocumented, but it will be fully documented and ready to use in 1-2 weeks.
     
    purejenix likes this.
  38. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    A few improvements were made for the last update (v. 1.6, still under review). Here is a little tease of how the new depth-based shaders work, showcasing the improved algorithm with depth transparency support :







    And the new Depth based fade out, coming next week :
    Reflection fade = 1


    Value of 0.5



    value of 0.33...


    And 0



    Next week's update also brings support for custom depth shaders on a per-reflection basis.

    It is a very big update, so stay tuned for more features! :)
     
  39. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Small patch for the latest update will be sent to the store in a moment. It should be approved in a few days.
    It does the following :
    • Improvements on the handling of complex VR projections (tested with Mock VIVE in Unity 2018) and performance improvement across all supported VR devices.
    • New depth algorithm is now compatible with all Unity versions.
    • New sliders to further adjust the depth based blur ramp and depth based fade out of the reflection
    • Improved water shader now works faster in newer Unity versions and has better compatibility with VR
    • Updated documentation
    Also a new and updated product video is being finished since the current one is from the initial version and doesn't showcase any of the many many updates and improvements the tool has been receiving in the last months.
     
  40. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    New video for the tool is available. Documentation is almost ready and it will be sent to the store for approval tomorrow. We hope you will like this new update and the many features it adds :)

     
  41. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    New version 1.6 and its patches have just been approved and now include :



      • Revamped documentation. Clearer, more organized and far more in-depth
      • New depth rendering and algorithms that add depth based blur and depth based faded reflections for a more accurate result. Depth supports transparent objects in all unity versions from 5.2 to 2018.1!
      • 9 new shader variants designed for a full PBR based workflow, mimicking as closely as possible the Standard shader in Metallic, Specular and Roughness setups.
      • Fixed a few glitches with the water shader in Unity 5.6+
      • Improved workflow when using the new Post Processing stack v2
      • Improved workflow when using VR devices that modify the projection matrices

    We hope you will like it :)
     
  42. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    The version just uploaded to the store has a small glitch in some newer Unity versions. If the depth algorithm is not working for you, change this section in the PD_InternalDepth.shader file :

    upload_2018-3-15_9-34-12.png

    To this :

    upload_2018-3-15_9-34-26.png

    And it should work without issues. A fixed package specifically made for the affected Unity versions has just been sent to the store and will be available in a couple of days. Meanwhile, this small change should fix the issue :)
     
  43. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    The new patch for the tool with the fixes for newer Unity versions and the depth shader has just been approved, so the glitch should now be solved :)
     
  44. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Quick bug fix for the annoying and troublesome issue of failed asserted matrices has just been sent. It is compatible with all different Unity versions and will go live next week. In the meantime, if you are experiencing any assertion related issues simply add a 0.000001 offset to the rotation of your camera on the X axis :)
     
  45. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Patch 1.6 has just been approved on the store, fixing the matrix assertion errors in some camera rotations/positions :)
     
  46. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Upcoming patch version of this tool :
    • Small improvements to PBR based shaders
    • Small improvements over rendering control
    • Explicit normal directions can be now locally defined so they can be used with moving reflective surfaces (rotating floors/mirrors, glass shards etc)
    • Optimization improvements and general fixes
     
  47. GaDeMy

    GaDeMy

    Joined:
    Mar 22, 2016
    Posts:
    9
    Hi there. Im struggling with a small little thing that is driving me mad. It happens me every single time and I cant find a work around.

    Reflections have this clipping thing that does not look good. Check this first image.



    Setting the "Near Clip Distance Modifier" to 0 or lower solves de issue, like you see in this picture:



    However, like you would expect, this setting presents another problem:



    That is instantly solved when setting the "Near Clip Distance Modifier" above 0:



    I'm missing something or this is an expected behaviour?
     
  48. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there!

    From your screenshots, the first idea I have to try to solve this issue is the following :

    Set the near clip plane to a value lower than 0 but raise the far clip plane to a value higher than 150. It seems that either the reflection or the scene is too big to be reflected as a whole.

    Does this issue appear in the game view or only in the scene view? The reflections currently derive their near and far clip planes in part from the camera that is looking at them, and the scene camera can have some unusual clip values. Please tell me if this is happening in the game view as well to track the issue more easily.

    If it IS happening in the game view as well, pics of the camera component will help me a lot to solve the issue faster :)

    This does not seem like the intended behavior but it depends on the way your scene is set up. I will try to recreate a similar setup on my own to see if I can see when the bug happens. You can PM me if you want so we can keep track of this issue and solve it more easily as well :)

    I hope the small tip above helps but if it doesn't I will be here waiting for more information to give you a solution ASAP!


    EDIT : I recommend you to send me a PM or contact me to support@irreverent-software.com to make it easier to contact you in case I need to send a custom patch for your specific needs :)
     
    Last edited: Apr 21, 2018
  49. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Hi there,
    I opened a conversation between both of us and sent you a preliminary fix for the issue. I hope it helps. Simply replace the script on your project with the one I sent, and adjust the far clip plane to a high value and the near clip plane to the needed value for your scene (make sure none of these values is 0 )

    Hope it helps! :)
     
  50. IrrSoft

    IrrSoft

    Joined:
    Jul 6, 2012
    Posts:
    1,528
    Version 1.7 has been sent to the store :
    • Reflections can now be rendered using Forward, Vertex lit or Deferred modes. Rendering a reflection in deferred mode greatly reduces the draw calls count giving a performance boost to compatible devices.
    • Small improvements to PBR based shaders. Detail mask can now be tiled independently
    • Explicit normal directions can be now locally defined so they can be used with moving reflective surfaces (rotating floors/mirrors, glass shards etc)
    • Clipping and projection bugs (such as the described a few posts above) have been fixed.
    • Optimization improvements and general fixes
     
    Lars-Steenhoff likes this.