Search Unity

Stylized Water 2 [URP] ☑️ Desktop/Mobile/Consoles/VR

Discussion in 'Assets and Asset Store' started by StaggartCreations, Nov 3, 2020.

  1. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Ah that would get some of the way. Though it is highly unconventional to pass around material properties from one to other material instances, that's what global properties are for. Actually getting this to work will not be straightforward, until there is an API in COZY that's something best to implement and maintain locally.
     
  2. avivoren

    avivoren

    Joined:
    Sep 21, 2014
    Posts:
    42
    Hey I am using SW2 with the underwater plugin(it doesn't really matter for this case)
    I am trying to remove water from an area in my map, via the mask - I have no 3d waves
    - I currently have huge plane that covers the entire world for the water
    1) if I put a mask plane at the same height exactly on the water I get this artifact
    upload_2023-12-7_0-42-19.png
    2) if I put the mask on water Y position + 0.001, when the camera gets closer to the water line, you can see the water
    upload_2023-12-7_0-43-50.png

    What is the correct way to fix it for my open world?
     
  3. avivoren

    avivoren

    Joined:
    Sep 21, 2014
    Posts:
    42
    I would also like to know if there is a plan to add underwater support for rivers/water objects that are on a slope?
    - for example water going down a hill.
    - Currently from what I see, you can only set a Y level for the water with no support for angled water.
    Thanks!
     
  4. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Placing the TransparencyMask at the exact same height as the water surface will induce Z-fighting, it must either be slightly above or below it.

    When it is hovering above it, you may indeed be able to see under it, revealing the water.

    Instead, place it underneath the water slightly.

    What you'll notice is that it then no longer hide the water. To correct this, lower the rendering queue on the TransparencyMask material (so that it renders on top of the water). And disable the Depth Writing option on the water material (under the Rendering tab). After which, the transparency mask will render on top of the water, despite behind behind the water geometry.

    No dice I'm afraid. This can work up to a certain point with modifications and added features, but a completely watertight (literally) implementation will be quite the development timesink.
     
  5. Garien

    Garien

    Joined:
    Oct 11, 2018
    Posts:
    36
    @StaggartCreations Hello!

    I've been struggling with setting up the Floating Transform to work on my player boat object.

    Currently, when I move my player, it becomes out of sync with the floating transform, up to the point where the boat starts going very high (leaving the waves and flying) and then very low (even beneath the ocean terrain).

    My hierarchy setup is the same as you instructed in the documentation and the same as the buyoance demo scene.

    Is it possible to set up the floating transform to work on moving objects with rigidbodies?

    If so, some information that might help spot the issue:

    - I've noticed that transform.positions values are being fed to my PlayerBoatMesh in runtime, which does not happen to your BoatMesh example.

    - I'm using RigidBody.AddForce for movement.

    - Hierarchy and components attached on the screenshots
    upload_2023-12-7_22-45-9.png upload_2023-12-7_22-45-18.png

    Thanks in advance!
     
  6. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    If you're looking to achieve physics-based buoyancy, for things such as boats, you'd have to forgo using the Floating Transform component. This is because it will alter the position of the transform directly, whilst your script is also applying physics forces to the object. This creates a constant push/pull scenario and typically results in a RigidBody jittering back and forth.
     
  7. SOL3BREAKER

    SOL3BREAKER

    Joined:
    Oct 11, 2021
    Posts:
    42
    Cozy has released their version 3, and they seems to support Global shader variable and your underwater rendering. Is that the properties you need?

    And do you know how to deal with underwater renderer and camera clipping planes. The camera just not renders that far, and I put a very large plane under the terrain, but the fog at distance area will still all become transparent.
     
    Last edited: Dec 11, 2023
  8. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    Make Object floting in the water for mobile support Without impact Fps drop
     
  9. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Thanks for the heads up! I'll be verifying compatibility for next update, if necessary add a v3 integration.

    Still, in order for any shader to read out COZY's skybox color, a generalized shader function needs to be accessible. This is comparable to having a public static C# function available to call. COZY's shaders are authored using Amplify Shader Editor, which makes various aspects a sort of "closed source".

    Come again? :confused:
     
  10. SOL3BREAKER

    SOL3BREAKER

    Joined:
    Oct 11, 2021
    Posts:
    42
    What about the underwater problem, I can't fix it with adding boundary.
     
  11. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Ah right, sorry! In 3D rendering anything beyond the camera's far clipping plane is considered "void" and has an infinite depth. Because the underwater fog is depth/distance based the fog will appear as 100% dense and at its maximum darkness outside the camera's clipping planes.

    Because of this, the camera's far clipping plane should at least be as far as the visible range (the cutoff point where fog is so dense, nothing would be visible)
     
  12. avivoren

    avivoren

    Joined:
    Sep 21, 2014
    Posts:
    42
    About the first question.
    I need the depth writing option on, because it causes transparent objects rendering problems for me.
    Will cutting a hole in the geometry of the plane in a software like blender will solve this?
    - From what I understand I need the plane to be high res to allow waves
    - So I can make high poly plane, cut a section of it, import to unity, the water is not there but I'll still have waves?

    Thanks!
     
  13. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    I want to Float objects Scripts Work without follow the water Wave and also work in mobile
     
  14. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    Floating transfor Script is safe for use in mobile devices I mean Can I use Multiple floting transform script For multiple game objects
     

    Attached Files:

  15. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Absolutely, that would be the ideal set up really.

    It is like the notification says, the water material has the Waves feature disabled. Without it, the Floating Transform component is quite pointless.

    The component is used for a single Transform, so for multiple GameObjects, each one of them uses its own component.

    To clarify, the component does not actually make an object float, in terms of physics. It snaps a Transform to the water surface, making it appear to move with the waves.
     
  16. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Version 1.6.0 is now available!

    This is a substantial update, and will be the last for a while, as its time to shift focus on the release of several new assets. This includes, foremost, a river spline tool that can generate AAA-level river geometry.


    The new screen-space reflections feature, toggled on/off


    Newly included lava flow material


    Changelog:
    Dynamic Effects v1.1.0 (now requires v1.6.0!)

     
  17. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    The Stylized Water 2 asset was initially released in November 2020. It has been a joy to work on, and its been regularly updated and extended through free updates. Though, development is purely funded by the purchased of new licenses, rather than upgrades, whilst the opposite should be the case. Unfortunately the asset store ecosystem does not facilitate anything otherwise.

    In 2024, with the release of Unity 6, future development will branch off into a separate asset, so that users who contributed in 2020-2023 can choose to receive updates onwards in 2024-20xx. There will be a grace period available, for users to upgrade at a discount. That is to avoid posing an upgrade cost to anyone who purchased a license mere months or weeks before its release.
     
    laja likes this.
  18. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,523
    Stylized Water 3 ?
    I will buy it no worries there.
     
    adamgolden likes this.
  19. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    Hii You are great Shader artist Can you make a Wind shader for my blender trees because I created a lot of trees in blender But my trees are not Affected with Unity Wind Zone Or make a new Wind shader asset for Third party 3d modelling software support unity wind zone I will buy it and This Wind shader support mobile platform because I am making mobile platform games
     
  20. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    I am using Enviro in my game
    When Fogg season is on Stylized water 2 Color totally going to White problem.
    How to fix it

    When fog is off
    And when fog is on
     

    Attached Files:

  21. Fabraz

    Fabraz

    Joined:
    Sep 15, 2014
    Posts:
    66
    Hey ya!~ Really excited about the screenspace reflection feature! However, we noticed a rendering order issue when applying it to our URP project. (Unity 2021.3 LTS, URP 12.1.12, Forward, Gamma)

    Once we enable it a bunch of our layers get messed up. Like the Player (Which is set as a Render Object) appears under the "Atmospheric Height Fog" and Post Processing DoF Blur. Unity's Toon Shader outlines are similarly affected (which don't use Render Object).

    Any idea what might be happening?
     
  22. laja

    laja

    Joined:
    Sep 29, 2022
    Posts:
    15
    Do you have any tips on how to implement simple interactions with the water? In a standard 3d game if my character walks/runs (knee-deep) in the water, there should be some effects. Or if I throw an object into the water, that should also cause some ripples and a splash.

    Edit: I have found the example scenes, ParticleShowcase and the rest. Great :)
     
    Last edited: Dec 15, 2023
  23. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Appreciate the vote of confidence!

    I have no designs set on a completely new water asset though. But a separate "new" asset will target future Unity versions (namely Unity 6). And will eventually also mean porting things to the new Shader Blocks framework, which in practical terms means a separate asset since this is in no way backwards compatible.

    Thank you for your kind words :) The Wind Zone component is unfortunately a black box, 3D models outside of SpeedTree cannot make use of it. I hear The Vegetation Engine is a popular alternative asset that can approach this.

    I believe given the environment context that's actually correct, the ship in the distance is also completely fogged out. It looks off because the sky remains quite clear. The water simply calls on Enviro's fog code, so it should do what its supposed to.

    When SSR is enabled, it merely flips a switch in the water shader so that it calculates the effect. This means it has no bearing on the overal rendering state of the pipeline.

    Though, because the effect relies on URP rendering both the Opaque and Depth texture, I've made it so that the render pipeline is instructed to render these.

    The latter may be causing the issue you're describing. You can try to disable SSR, then go into your pipeline asset and enable both the Opaque and Depth texture options, that should amount to the same effect.

    From there on, you can attempt to debug why these Render Objects passes are breaking with this enabled. May need to enable the "Write Depth" option on the render feature, since it sounds like a depth-sorting issue.

    This is typically handles through physics triggers. Water is relatively flat, so a Box Collider usually suffices and makes it easy to determine when something enters the water.

    There's no silver bullet in terms of an approach, since it pretty much always involves project-specific details. But I've outlined an example in this post:

    https://forum.unity.com/threads/sty...obile-consoles-vr.999132/page-14#post-9418286
     
    Lars-Steenhoff likes this.
  24. StanK_

    StanK_

    Joined:
    Dec 5, 2017
    Posts:
    13
    Hello! Thank you for the 1.6 update. Can I get more info on where to find the river tool?
     
  25. StanK_

    StanK_

    Joined:
    Dec 5, 2017
    Posts:
    13
    upload_2023-12-19_12-21-48.png
    Also have this in my RiverMesh
     
  26. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Such a tool was used to create the river geometry in the demo scenes, it is however proprietary and not part of this asset (hence the name of the GameObject).

    There's a section in the documentation regarding rivers worth checking out.
     
  27. avivoren

    avivoren

    Joined:
    Sep 21, 2014
    Posts:
    42
    Looks amazing!!
    1) Isn't it cheaper to just run a baked reflection probe in mostly static scenes instead of screen-space reflections?
    2) Can you use the screen-space reflections for other objects as well? so it will computed 1 time, then be used for multiple objects in the scene and not only water
    3) I very happy that you'll working on a river spline tool, if its possible, it would be awesome if it could work with Microverse, but its ok if not.
     
  28. PlayIgames

    PlayIgames

    Joined:
    Oct 26, 2021
    Posts:
    40
    Enviro fog is working fine with Stylized water 2 but when Night is Come In Enviro then Stylized water 2 is still brighter not looking like night I don't know why Can you solved this issue thank you
     

    Attached Files:

  29. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    1. It certainly is!
    2. There's a lot to be said about this really. But it comes down to a simple no :p
    3. I fully intent to defer any sort of terrain modifications to Microverse, I have already integrated it to ensure that things like a river's (variable) width is also propagated onto MV's spline path.

    What's most likely is that the global reflection probe isn't updated, so you get a reflection in the water that resembles noon (whichever time of day it was in edit-mode). Not uncommon with day/night systems. AFAIK Enviro ships with a module for realtime reflection probe updating.

    You can use Unity's Rendering Debugger to inspect the reflections fed into all the shading in a scene.
     
  30. Mirath

    Mirath

    Joined:
    Aug 5, 2012
    Posts:
    14
    Hi there! We recently updated to the latest version to try out the new reflections! Fabraz posted earlier with some issues, which we now have working. This was done by enabling SSR and commenting out adding ScriptableRenderPassInput.Depth in the Configure method of SetupConstants.

    The reflections themselves look great, but we did encounter some issues popping up with how certain objects are now rendering. Many of these are actually separate from Reflections and are now present after the update even after disabling or removing the RenderFeatures. We've encountered three main issues we're trying to resolve:

    - Strange dead pixels that react especially badly with post processing bloom to cause flashing and other artifacting. Seems like it might be related to certain kinds of mesh geometry? Does get fixed by enabling StopNaN on the Main Camera at least.


    - Reflection picks up and amplifies missing faces on models and seems to break down following that.


    - Transparency seems to be acting very strangely, with odd flickering and layering issues. We're primarily using the Unity Toon Shader which has this problem, but doesn't seem to happen with the standard Lit shader.
     
  31. avivoren

    avivoren

    Joined:
    Sep 21, 2014
    Posts:
    42
    Thanks for the response. Looking to buy any future assets :)
     
  32. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Thank you for the feedback! I believe the case with "ScriptableRenderPassInput" may be attributed to a URP bug. If the depth texture option is enabled anyway, so using this particular function is moot, but its more of a safeguard. I don't see how it can have such a detrimental effect.

    One thing to note is that this setting should never be set to "After Transparents" in the main renderer, as this conflicts with transparent material using the depth texture (water in particular)
    upload_2023-12-22_14-17-20.png
    It otherwise induces flickering and flashing

    Documentation regarding SSR and its limitations and expected artifacts is a point I still need to address. One such point is that backfaces can't be reflected, which may be what you're seeing on the chainlink fence.

    The black splotches are most likely NaNs indeed, I'll need to figure out how to induce them to track down where exactly they're being caused.
     
  33. Fabraz

    Fabraz

    Joined:
    Sep 15, 2014
    Posts:
    66
    Thanks for the detailed response as always!

    We do have one update regarding those black splotches: They mostly happened on meshes with messier UVs. Specifically faces that weren't properly UV mapped and were only one pixel wide or tall. Fixing those UVs does remove the issue in the SSR.
     
  34. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    Curious! I can track that to some reasonable explanation, but I wouldn't have guessed that was the cause! In any event, it shouldn't be occurring, so I'll be sure to correct this in due time :)
     
  35. StanK_

    StanK_

    Joined:
    Dec 5, 2017
    Posts:
    13
    @StaggartCreations is it possible to set up an underwater renderer when you're entering in river that is shaped? So that if player jumps into river falling from mountain he'll be able to swim underwater through its path
     
  36. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    anyone getting good performance on the quest 2? mines really choppy/low framrate and thats using the most basic water with no underwater rendering or anything fancy.

    Also when i turn my head, the interaction foam and shadows move with my headset movement for some odd reason

    I tried using the mobile shader as well and same thing happens.
    the object (airplane) above the water have a "ghosts" that moves with the head movement aswell. i remove the depth buffer, it still happens.
     
    Last edited: Dec 23, 2023
  37. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    The underwater rendering isn't volumetric in nature, so rivers or spheres would not work I'm afraid.

    Typically, with the Oculus SDK, you'd have to disable "Shared Depth Buffer". I found this was responsible for depth-based effects lagging behind the headset movement.

    Performance is a highly contextual matter. If you haven't seen it already, there's a performance guidline section in the documentation.
     
  38. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    I'm out of office until January 8th, for the holidays and some free time. I'll able to get back to any posts after this time. Happy holidays! :)

    Both the Stylized Water 2 and its Underwater Rendering extension are currently 50% off during the new years sale. Several other assets are also on sale and can be viewed on my publisher page.
     
  39. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    i disabled it in the pc settings but the android settings doesn't give me the option to disable the shared buffer option.

     
    Last edited: Dec 23, 2023
  40. benjamin_flashbulb

    benjamin_flashbulb

    Joined:
    Aug 4, 2020
    Posts:
    25
    Hello again.
    We're using Shiny SSRR 2 plugin. Any chance to integrate with (replacing) the planar reflections feature?
     
  41. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    Can this asset create a wake effect if I drag a gameobject into the water? With foam in the wake.
     
  42. Mackerel_Sky

    Mackerel_Sky

    Joined:
    Jul 24, 2018
    Posts:
    26
    Hey guys,

    I have a bit of a problem with the transparency setting of deep water. I've currently got some terrains which form my landscape, with water above them to represent the sea.

    upload_2024-1-6_17-30-49.png

    As you can see, even though I have Opacity at 100% in the shader, you can still clearly see where the terrain ends. I'd just like the water to be 100% opaque in so that it looks like the darker water in the distance. Is there something I'm not doing correctly?

    Thanks!
     
  43. ml785

    ml785

    Joined:
    Dec 20, 2018
    Posts:
    119
    Is there an alternate way (like with AsyncGPUReadback maybe?) to GetWaterHeight at a certain position?

    I ask this because I want to deform the water plane mesh (with outside tools) and still ideally have buoyancy respond to said deformations. Right now if I deform the water plane mesh, the buoyancy does not realize that a mesh deformation occurred.
     
  44. OffgridChris

    OffgridChris

    Joined:
    May 20, 2021
    Posts:
    18
    Hi,

    I just recently updated to Stylized Water 2 v1.6.0 and I now get a shader error on iOS:

    Code (CSharp):
    1. Shader error in 'Stylized Water 2/Standard': undeclared identifier '_FOVEATED_RENDERING_NON_UNIFORM_RASTER' at Battles_Mac/Library/PackageCache/com.unity.render-pipelines.universal@14.0.9/ShaderLibrary/Clustering.hlsl(30) (on metal)
    2.  
    3. Compiling Subshader: 0, Pass: ForwardLit, Vertex program with _FORWARD_PLUS _MAIN_LIGHT_SHADOWS _NORMALMAP _RECEIVE_SHADOWS_OFF
    4. Platform defines: SHADER_API_MOBILE UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_LIGHTMAP_DLDR_ENCODING UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2
    5. Disabled keywords: DOTS_INSTANCING_ON DYNAMICLIGHTMAP_ON EVALUATE_SH_MIXED EVALUATE_SH_VERTEX FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADER_API_GLES30 SHADOWS_SHADOWMASK UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_FULL_STANDARD_SHADER UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHTS_VERTEX _CLUSTERED_RENDERING _FLAT_SHADING _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN _RIVER _WAVES
    6.  
    I also updated the editor to 2022.3.16f1 and URP to 14.0.9 if that helps.

    Any help would be appreciated :)
     
  45. proxstudios

    proxstudios

    Joined:
    Jun 29, 2018
    Posts:
    14
    Hi @StaggartCreations we want to use depth of texture post process effect urp volume override. However when underwater distortion setting is set, the depth of field is not correctly catching the distortion movement and therefore blur incorrectly. What do you suggest to fix it? Thanks in advance.
     
  46. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    That may have been a PC-specific setting then. For mobile VR, I highly recommend using solely the Vulkan graphics API if you aren't already. I found OpenGL prone to inexplicable artefacts more often than not.

    I'm afraid not. Transparent materials (such as water) do not write into the depth texture, which the SSR technique relies on.

    The Dynamic Effects extension can be used to create rudimentary boat wakes. You can see an example of the included wake effect in the demo video.

    On the pixels where the water sits in front of the skybox (so beyond the terrain geometry) the under water fog will appear to abruptly appear to cut off as well. This is because it is simply based on geometry information as well.

    A viable solution is to use low-poly terrain meshes/mountains to dress the boundaries of the world, or to create "walls" to sort of box in the water. These walls could be as simple as untextured cubes or planes.

    This is indeed possible, but this is an advanced use case.

    You can enable the "Displacement Prepass" option on the render feature (which must be added to the renderer, if not present)
    upload_2024-1-12_17-6-48.png

    You can then use a compute shader to sample the water geometry's height at given positions, and read back the results asyncronously. For example:
    Code (CSharp):
    1. #include "../Libraries/Displacement.hlsl"
    2.  
    3. //Input
    4. StructuredBuffer<float3> positions;
    5.  
    6. //Output
    7. RWStructuredBuffer<float> offsets;
    8.  
    9. [numthreads(THREAD_GROUPS,1,1)]
    10. void GetWaterHeights(uint3 id : SV_DispatchThreadID)
    11. {
    12.     const uint index = (uint)(id.x);
    13.  
    14.     //Input positions to sample at
    15.     const float3 positionWS = positions[index];
    16.  
    17.     //Position, relative to rendering bounds (normalized 0-1)
    18.     const float2 uv = WorldToDisplacementUV(positionWS);
    19.  
    20.     //Texel value at coordinates
    21.     const float displacement = SampleDisplacementBuffer(uv);
    22.  
    23.     //Output buffer
    24.     offsets[index] = displacement;
    25. }
    What's curious is that the error regards foveated rendering, which is a VR-specific feature. Something that's impossible to use of Mac/iOS. This seems like a bug in URP since the error originates for a URP shader library.

    I'm unable to verify this unfortunately, since my Mac is being serviced at the moment (dead motherboard).

    With how custom post processing works in URP, Unity's native effects such as DoF also render before any custom effects. This means that something like a distortion effects renders after DoF has already been applied to the screen.
     

    Attached Files:

    ml785 likes this.
  47. proxstudios

    proxstudios

    Joined:
    Jun 29, 2018
    Posts:
    14
    @StaggartCreations I see, do you suggest any fix for that to achieve this kind of feature?
     
  48. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    I think, given how things work, there's no viable solution. Depth of Field relies on the depth texture information, which is not distorted, so it will always be based on the scene information as it appears before underwater effects are applied.
     
  49. Scalisco

    Scalisco

    Joined:
    Feb 2, 2014
    Posts:
    20
    Is there a reason StylizedWaterDataProvider.GetWaterHeightSingle doesn't set m_waterLevel like
    GetWaterHeights does? I have a bug where the m_waterLevel is still 0 when this function is called so my object teleports down to 0.
     
  50. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,254
    This appears to be a blatant oversight on my part, good catch! The m_waterLevel value is only assigned in the GetWaterHeights function. You can replace the existing function:
    Code (CSharp):
    1.         public override float GetWaterHeightSingle(NWH.DWP2.WaterObjects.WaterObject waterObject, Vector3 point)
    2.         {
    3.             return Buoyancy.SampleWaves(point, waterMat, m_waterLevel, 0f, dynamicMaterial, out _);
    4.         }
    with
    Code (CSharp):
    1.         public override float GetWaterHeightSingle(NWH.DWP2.WaterObjects.WaterObject waterObject, Vector3 point)
    2.         {
    3.             m_waterLevel = waterPlane && waterLevelSource == WaterLevelSource.Mesh ? waterPlane.transform.position.y : waterLevel;
    4.          
    5.             return Buoyancy.SampleWaves(point, waterMat, m_waterLevel, 0f, dynamicMaterial, out _);
    6.         }
    I'll make a note to include this correcting in an update
     
    Scalisco likes this.