Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

SC Post Effects Pack [Built-in/URP] - 34 additional effects

Discussion in 'Assets and Asset Store' started by StaggartCreations, Jan 18, 2018.

  1. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    Submitted version 2.3.5! Note that this is the last version to support Unity 2020.

    Some notable changes were made to the Fog effect. The vertical height can now be limited, allowing the skybox to come through above the horizon. Additionally, the directional light scattering effect can be scaled in size.
    upload_2023-8-5_12-15-55.png

    All the Refraction sample textures were reauthored for improved quality and resolution:
    upload_2023-8-5_12-18-45.png

    The effect now has a color tint parameter, making things like water drops more visible:
    upload_2023-8-5_12-25-55.png

    Changelog:

    Added:
    - Color Split, "Luminance threshold" parameter, making it possible to limit the effect to emissive surfaces.
    - Transition, color parameter (default was black) and invert option.
    - Refraction, color tint parameter.
    - Fog, directional light exponent parameter
    - Fog, now supports height fading into the skybox

    Changed:
    - Refraction, re-authored all sample textures for improved quality.
    - Reduced number of texture samplers in Fog shader library, to avoid reaching the maximum of 16 samplers when incorporated into a surface shader.
    - Color Split, "Edge Masking" parameter now scales down the offset, rather than decreasing the opacity.
    - (URP) Fog shading function (for transparent materials) is now tied to a boolean. If the volume component isn't present the fog shading will be skipped.
    - (URP) Edge Detection now uses the GBuffer information when deferred rendering is used

    Fixed:
    - (URP) Shader errors in Unity 2023.2+ due to now clashing parameter names
    - (URP) Effects causing scene to be flooded with shadows when using Deferred rendering in Unity 2022.2+
     
    adamgolden and hopeful like this.
  2. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    776
    I'm having an issue where fog seems to be incompatible with kuwahara? Having both on makes the whole screen white.

    Using Unity 2022.3.9 in DX12 mode.
     
    Last edited: Sep 15, 2023
  3. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    Curious, white is a very specific color to be shown. There is no real relationship between the two effects, other than them both being separate, I'd expect the same bug to appear when swapping out Kuwahara with something else.

    I'm not able to reproduce anything of the sorts in the same version/graphics API. So pinpointing the cause would require some debugging in your project.
    upload_2023-9-15_9-52-9.png
     
  4. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    776
    upload_2023-9-15_4-55-47.png

    I think i figured out what's happening? Seems like it's related to the "Skip Transparents" setting? This causes the whole scene to render gray and depending on the scene causes kuwahara to do weird things if set before unity post processing.

    I also see that part of the issue is Stylizes Water 2 Underwater? That specifically causes the whole screen to explode into white particularly if underwater even partially.

    Both go away if skip transparent is disabled.
     
  5. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    Ah yes, gray makes more sense, that's the color of a default/uninitialized texture in Unity.

    This is actually a known issue, that's been reported twice so far, and is indeed specific to rendering an effect before transparent geometry. Since in this case it's required to make a copy of the screen contents and apply the effect to that.

    Problem seems to be that this process receives an empty input. This input would be empty:
    upload_2023-9-15_13-45-55.png

    But not always? I don't know if my implementation is wrong (for a good part it is hacked/self-fabricated out of necessity) or its a URP bug (it occured since 2022.2). So far I've been left and right trying to reproduce it, across different setups and projects, but without any success. Which unfortunately means I can't determine a fix either.
     
  6. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    776
    Maybe it relates to the water asset since that supports the fog?
     
  7. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    Hi there, i decide to use this asset on an empty project, so far some of the effect works fine for me but the speedline throw me some error and unity got stuck, am i the only with this issue?

    here the error log

    AssertionException: Assertion failure. Values are not equal.
    Expected: 512 == 1024
    UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) (at <d0f92ebb771e4783b0ea9f13bfbe129b>:0)
    UnityEngine.Assertions.Assert.AreEqual[T] (T expected, T actual, System.String message, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <d0f92ebb771e4783b0ea9f13bfbe129b>:0)
    UnityEngine.Assertions.Assert.AreEqual[T] (T expected, T actual, System.String message) (at <d0f92ebb771e4783b0ea9f13bfbe129b>:0)
    UnityEngine.Assertions.Assert.AreEqual (System.Int32 expected, System.Int32 actual) (at <d0f92ebb771e4783b0ea9f13bfbe129b>:0)
    UnityEngine.Rendering.PostProcessing.TextureLerper.Lerp (UnityEngine.Texture from, UnityEngine.Texture to, System.Single t) (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/Utils/TextureLerper.cs:103)
    UnityEngine.Rendering.PostProcessing.TextureParameter.Interp (UnityEngine.Texture from, UnityEngine.Texture to, System.Single t) (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/ParameterOverride.cs:568)
    UnityEngine.Rendering.PostProcessing.ParameterOverride`1[T].Interp (UnityEngine.Rendering.PostProcessing.ParameterOverride from, UnityEngine.Rendering.PostProcessing.ParameterOverride to, System.Single t) (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/ParameterOverride.cs:121)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.OverrideSettings (System.Collections.Generic.List`1[T] baseSettings, System.Single interpFactor) (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/PostProcessLayer.cs:801)
    UnityEngine.Rendering.PostProcessing.PostProcessManager.UpdateSettings (UnityEngine.Rendering.PostProcessing.PostProcessLayer postProcessLayer, UnityEngine.Camera camera) (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/PostProcessManager.cs:394)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.UpdateVolumeSystem (UnityEngine.Camera cam, UnityEngine.Rendering.CommandBuffer cmd) (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/PostProcessLayer.cs:933)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/PostProcessLayer.cs:562)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () (at ./Library/PackageCache/com.unity.postprocessing@3.3.0/PostProcessing/Runtime/PostProcessLayer.cs:487)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  8. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    This particular error is due to a long standing bug in Unity's volume blending framework I'm afraid. It occurs when a texture parameter is overridden on an effect, but no texture is assigned. You'll see an error message in the UI to warn against this.

    It can be avoided by assigning a texture, rather than leaving the field empty.
     
  9. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,268
    Greetings! I've updated to the latest version (and also to unity 2022) and have run into a few issues.

    The first is what was already mentioned - fog making everything grey when transparents are enabled. I just disabled it affecting transparents for now, so that's fine!

    The first is that the blur effect seems to become grey.

    I tried disabling all other effects, fiddled with all the universal settings / blur effect settings, but I haven't been able to find a way to fix this.

    The second is that now the directional light effect seems to become black when the light is dark. This is quite different to how it used to be. How can I make it work like it did previously (ie always additive, and a black light adds 0, not subtracting)


    Thanks a bunch!
     
  10. wechat_os_Qy09VpiDaSiV8EETWQqNeGZuk

    wechat_os_Qy09VpiDaSiV8EETWQqNeGZuk

    Joined:
    Oct 11, 2021
    Posts:
    22
    I got around 1.3kb gc per frame when using sun shaft, where does it come from?
     
  11. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    Thanks for the details. If you are able to share a repo-project, that'd be most helpful. I am unable to reproduce this gray screen issue in any context I've tried it in.

    Unity's volume blending system has some GC overhead in every render pipeline (192kb) out of the box. It'll only shown using deep profiling.

    There may be other causes for unintentional GC. But bear with me, the first priority is survive the obstacle course that Unity laid out by changing the rendering API every version. The same code needs to work from Unity 2019 through 2023, which may give room to unwanted overhead.
     
    joshcamas likes this.
  12. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    776
    The gray might be related to DX12, I believe i also experienced this but forgot to post.
     
    StaggartCreations likes this.
  13. Garien

    Garien

    Joined:
    Oct 11, 2018
    Posts:
    32
    Hey @StaggartCreations , super clean asset! Been using it on a project, it worked well for the most part. However, stumbled upon some issues:

    When I tested with a 3D URP renderer, most effects worked fine, except for blur, which resulted in a black screen.

    I then changed to a new scene with new post process volumes, as well as changing the scriptable render pipeline settings (under project settings -> graphics) to a 2D URP renderer - my project will transition from 3D to 2D on some scenes.

    After switching, I could not make the post process effects from the package work with the 2D URP renderer. Whenever I try to add any effect (in this case, scanlines), a black screen appeared and the following error pops up on console:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Rendering.CoreUtils.FixupDepthSlice (System.Int32 depthSlice, UnityEngine.Rendering.RTHandle buffer) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.8/Runtime/Utilities/CoreUtils.cs:249)
    UnityEngine.Rendering.CoreUtils.SetRenderTarget (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle buffer, UnityEngine.Rendering.ClearFlag clearFlag, UnityEngine.Color clearColor, System.Int32 miplevel, UnityEngine.CubemapFace cubemapFace, System.Int32 depthSlice) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.8/Runtime/Utilities/CoreUtils.cs:583)
    UnityEngine.Rendering.CoreUtils.SetRenderTarget (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle buffer, UnityEngine.Rendering.ClearFlag clearFlag, System.Int32 miplevel, UnityEngine.CubemapFace cubemapFace, System.Int32 depthSlice) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.8/Runtime/Utilities/CoreUtils.cs:598)
    UnityEngine.Rendering.Blitter.BlitCameraTexture (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle source, UnityEngine.Rendering.RTHandle destination, UnityEngine.Material material, System.Int32 pass) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.8/Runtime/Utilities/Blitter.cs:376)
    UnityEngine.Rendering.Universal.ScriptableRenderPass.Blit (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle source, UnityEngine.Rendering.RTHandle destination, UnityEngine.Material material, System.Int32 passIndex) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/Passes/ScriptableRenderPass.cs:718)
    UnityEngine.Rendering.Universal.ScriptableRenderPass.Blit (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.Universal.RenderingData& data, UnityEngine.Material material, System.Int32 passIndex) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/Passes/ScriptableRenderPass.cs:732)
    SCPE.PostEffectRenderer`1[T].FinalBlit (UnityEngine.Rendering.Universal.ScriptableRenderPass pass, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.Universal.RenderingData renderingData, System.Int32 passIndex) (at Assets/SC Post Effects/Runtime/PostEffectRenderer.cs:541)
    SCPE.ScanlinesRenderer+ScanlinesRenderPass.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Assets/SC Post Effects/Runtime/Scanlines/ScanlinesRenderer.cs:45)
    UnityEngine.Rendering.Universal.ScriptableRenderer.ExecuteRenderPass (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.ScriptableRenderPass renderPass, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/ScriptableRenderer.cs:1490)
    UnityEngine.Rendering.Universal.ScriptableRenderer.ExecuteBlock (System.Int32 blockIndex, UnityEngine.Rendering.Universal.ScriptableRenderer+RenderBlocks& renderBlocks, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData, System.Boolean submit) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/ScriptableRenderer.cs:1446)
    UnityEngine.Rendering.Universal.ScriptableRenderer.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/ScriptableRenderer.cs:1229)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.CameraData& cameraData, System.Boolean anyPostProcessingEnabled) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/UniversalRenderPipeline.cs:658)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/UniversalRenderPipeline.cs:824)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.8/Runtime/UniversalRenderPipeline.cs:369)
    UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <3b24cc7fa9794ed8ab04312c53e6dedd>:0)
    UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, UnityEngine.Object renderRequest, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <3b24cc7fa9794ed8ab04312c53e6dedd>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    After this error, if I close and reopen the project, and go back in the 2D scene, and try to add the same effect (scanlines), a grey screen appears and the console is clear. If I switch the render pipeline to 3D and go back to the 3D scene, the scanline (and any other newly added effect) now results in a grey screen.


    I thought at first that this might be related to me switching render pipelines, but then I created a new project from scratch, using 2D URP and imported the package, trying to narrow down the issue. The grey screen happened on the clean project as well, I could not get any effect to work on 2D URP.


    Since this might be too much, I recorded a video of me replicating all issues mentioned with some text explaining it, repro rate is 100%. Hope the video is helpful to troubleshoot it :)

    Video detailing issues:



    On the print, the SC Post Process effect window on both projects:
    upload_2023-10-20_2-21-2.png


    Summing up, issues are:
    #1. Blur results in a black screen on 3D URP
    #2. Getting grey screen when trying to apply effects on 2D URP (even on a fresh project)
    #3. Changing the pipeline from 2D to 3D and trying to apply a new effect results in a black screen + console error.

    All using Unity 2022.3.10f1

    Any help would be much appreciated. Thank you !
     
    Last edited: Oct 21, 2023
  14. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    I never expected anyone to switch between a 2D and 3D renderer from frame to frame :p That is in fact not supported. There's a check for which type of renderer is being used once per domain reload, because it involves reflection to access internal information about the renderer, prohibitively expensive to do every frame.

    I can easily reproduce the same error when switching to a 2D renderer. When 2D is used, the post processing rendering pass needs to take this into account. If you were to close and reopen the project, everything would appear to be in order.

    I've had a look at the code, and managed to take a changing renderer into account efficiently. So moving forward that will be supported. I can verify the error is no longer present after these changes.

    About the gray screen, it's maddening but I'm not seeing this occur anywhere. Even in a brand new project using the 2D renderer template.

    Makes me wonder if its somehow related to something more technical like GPU vendors or drivers. Surely it can't be because I always install the asset as a package?

    As a sanity check, I imported the asset from the asset store. Besides some harmless meta file differences I spot this difference:
    upload_2023-10-24_11-8-23.png

    And that is EXACTLY why effects are receiving a blank input texture (gray) :rolleyes:

    I don't know how that particular change ended up in the published version, it appears to be a version of the file from v2.3.0 (12 months ago).

    By all means an embarrassing oversight :p I'll be able to submit an update shortly to correct this.
     
    Garien likes this.
  15. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,133
    Submitted version 2.3.6

    This is the last version supporting Unity 2020.3

    Added:
    - (URP) Support for switching between a 3D and 2D renderer, or switching rendering paths.

    Fixed:
    - Effects appearing as a gray screen in Unity 2022.2+ when using the 2D renderer or having the "Skip Transparents" option enabled on a render feature.
    - Sketch, canceling out Bloom or other HDR-based effects.
    - Fog, if Directional Light shading was disabled, a darker tint was present where the sun would be in the sky.
     
    Last edited: Oct 24, 2023
    Garien likes this.
  16. Garien

    Garien

    Joined:
    Oct 11, 2018
    Posts:
    32
    Mad respect, your professionalism is something else. I've been keeping an eye on your other assets as well, and will definitely buy them in the future.

    On a side note: I won't change from 2D to 3D frame by frame, but per scene basis. Some scenes will be 2D and other 3D, but when the scene is loaded, the pipeline will be changed through code :)

    I was about to offer uploading the 2D project with the issue somewhere so you could repro the grey screen issue, but seems I won't need to - I'm glad you managed to find the issue ! Thanks a lot!
     
    StaggartCreations likes this.