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

Question Disable fog on VFX graph mesh output

Discussion in 'Visual Effect Graph' started by jtheis85, Jul 23, 2023.

  1. jtheis85

    jtheis85

    Joined:
    Oct 13, 2021
    Posts:
    19
    Is there any way to disable fog on VFX graph? I want to use it for some stylized clouds, but they don't look right in the distance. It's far too uniform.

    upload_2023-7-23_13-16-33.png

    With shuriken and standard materials, I found I was able to manually edit the shader code to remove fog from that material (copying the standard lit shader and deleting "#pragma multi_compile_fog"). Hacky, but it worked. But I don't see any way to do that with VFX graph, because there's no material (that I can see), only an input for a VFX shader graph. There seem to be some ways to output the generated shader, but it's just a temporary file so editing it has no effect.

    Surely there's some simple way to do this?
     
  2. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    The majority of VFX Graph Shader settings are living in the Inspector Tab when you select the "Output Context".
    upload_2023-7-24_13-34-38.png

    I wasn't able to any related options in regard to fog, but I will ask the team.

    In the meantime, if you're familiar with Shader Graph and need translucent particles, what you can to use Shader Graph.
    Create a Shader Graph, an in the Graph Inspector, make sure that "Support VFX Graph" is turn on.
    upload_2023-7-24_13-42-4.png

    In VFX Graph, assign the Shader Graph in the Output Context.
    upload_2023-7-24_13-45-12.png

    From Here, set the Material Type to "Translucent" and you should see the option "Receive Fog" that appears.
    Turn it off so that the Fog don't affect your Particles.
    upload_2023-7-24_13-45-36.png

    Unity_bNi4calxj5.gif

    The Particles with or without the "Receive Fog" options.

    Note that the rest of your scene will by default affected by the fog. It might be hard to properly blend your particles with the world if they're the only one not affected by the Fog. Will come back to this post if I got more information regarding Fog and the VFX Graph Output Context.

    Have a great day
     
  3. jtheis85

    jtheis85

    Joined:
    Oct 13, 2021
    Posts:
    19
    I don't see a "receive fog" checkbox in URP, only HDRP. Is this checkbox only available in HDRP?

    upload_2023-7-24_22-22-57.png
     
  4. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    Sorry, I thought this option was also exposed in URP. If not, I guess that you could try to go on the "Full Screen Pass Renderer Feature" route and or customize your URP Renderer.
    You might be able to create some Custom Fog that will blend the way you want with your VFX Graph.
    You can take a look at this What's New page that describe the "Full Screen Pass Renderer Feature" or this page with basic information on how to create a Fullscreen Shader Graph. Unity_sF605s1dCm.gif

    Here, I'm rendering this "Full Screen pass" before rendering Transparent, which means that this pass would not affect any Transparent or anything that is rendered after. Again, this is not ideal as you might have blending issues with other elements. So the best might be to work on a Custom Full screen Fog that suits well with your needs that you 'll render After Post Processing.
    upload_2023-7-25_11-29-18.png
     
  5. jtheis85

    jtheis85

    Joined:
    Oct 13, 2021
    Posts:
    19
    It seems like it would be tricky to use a full screen effect for fog while omitting the VFX. I'm far from an expert in this area. I assume I would need to access the depth buffer to do fog properly, but that would also include the VFX, if I'm not mistaken. What approach would I take to recreate fog on everything but the VFX using this approach?

    Also, ideally I'd want to be able to decide on a per-VFX basis whether it gets included in the fog or not. The clouds VFX I'm planning shouldn't have fog, but probably most other VFX should.