Search Unity

Soft Particles with Orthographic Camera

Discussion in 'Shaders' started by OtreS, Dec 20, 2019.

  1. OtreS

    OtreS

    Joined:
    May 6, 2015
    Posts:
    8
    Hello!
    I've been trying to wrap my head around getting Soft Particles to work with my Orthographic Camera.
    I have some mist near the ground and when my camera is orthographic there is sharp edges where the particles intersect the ground.

    I'm on unity 2017 free. As far as I understand Soft Particles did not work on Unity free until 17?
    Because now they seem to work if my Camera is Perspective and look good when looking in editor.

    Things I have tried
    - Set the Camera to deferred, but since it's ortographic it will switch back to forward.
    - Make my Camera render depth with - cam.depthTextureMode = DepthTextureMode.Depth;
    - Have particles cast and recieve shadows.
    - Have particles use a material with (Soft) shader.

    - I have found this thread where I think I should render the Depth to a RenderTexture but i don't understand how to use it for my purpose:
    https://forum.unity.com/threads/ortographic-camera-depth.77558/

    - This thread have some rows of code that returns a float with "CorrectDepth" and a shader. But I don't understand how to use this for my purpose either
    https://forum.unity.com/threads/get...-the-orthographic-camera.601825/#post-4966334

    What I can figure out:
    It seems like I need the particle shader(?) to read the Depth somehow, either by passing it the RenderTexture or a float value.

    So my questions is:
    Am I on the right track? Is there a correct sollution to this? How do you get Soft particles to work with the Orthographic camera?
    Is it a custom Shader for the particles I need or is it a setting somewhere?

    What should I search for to find the answer?

    Any help is appriciated!

    Best
    /O
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Hi,

    Unfortunately Soft Particles don't work with Orthographic cameras due to differences in how depth is stored between the 2 camera modes.

    We had a bug for it here, but it was deprioritised: https://issuetracker.unity3d.com/is...-in-orthographic-mode-compared-to-perspective

    This issue won't be fixed for the Built-in Renderer now, because we are focussing on our new Render Pipelines, but I would expect it to work (or be fixed, if broken) in the Universal and High Definition Render Pipelines.

    EDIT: you may be able to do it yourself with a custom shader. If you are comfortable writing your own shaders, you could download the Built-in shader pack and try to copy/modify what you need from it.
     
    Last edited: Dec 20, 2019
  3. OtreS

    OtreS

    Joined:
    May 6, 2015
    Posts:
    8
    Thank you for the answer!
    That's unfortunate, and yeah i'm not very skilled at writing shaders. So unless someone have solved it and want to share how, I get skilled at writing shaders and solve it.... or work around it :)
     
  4. DGENR8S

    DGENR8S

    Joined:
    Dec 8, 2018
    Posts:
    3
    hi this still seems to be an issue with unity 2021.2.15f1 URP. i have these dreamy particle systems all set up and when i switch camera to orthographic bam they be gone, big frowny face please lemme know if a fix mucho thankies! ~g
     
    Immu likes this.
  5. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    121
    Just to mention that soft particles work for Unity 2022 Universal Render Pipeline/Particles/Unlit
     
    richardkettlewell likes this.