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

Official [VFX Graph] Introducing six-way lighting for smoke, dust, and clouds VFX

Discussion in 'Visual Effect Graph' started by Matjio, Jan 19, 2023.

  1. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    105
    upload_2023-1-19_12-6-5.gif

    Welcome to the six way ligting discussion thread. You can use this thread to ask for help, share feedback, and have discussions about the new six-way lighting feature in VFX Graph.

    Introduction
    Rendering smoke in games is most often done with textured sprites because computing fully volumetric lighting is too expensive for a real-time budget. Six-way lighting is an alternative approach to this problem that uses a set of lightmaps that contain the lighting response of the smoke for light coming from six different directions. These lightmaps are baked into a set of two textures, along with an alpha channel and an optional emissive mask. The 2022.2 Tech Stream introduces a complete end-to-end workflow (from DCC to Unity) that allows you to realistically render smoke under any lighting conditions from baked simulations, using VFX Graph. It is currently only available for the High Definition Render Pipeline.

    Resources
    For more information, please have a look at our dedicated blog post and the new Output Lit option documentation.
    To get you up to speed, we’ve created a library of ready-to-use maps. We provide both high-fidelity assets that you can process and pack as you want – for example, using the VFX Toolbox – and more compact versions that are lightweight and ready for your game.

    Requirements

    • The minimum required Unity version is 2022.2
    • VFX Graph + HDRP
    Getting started
    1. Download Unity 2022.2 or newer through the Hub.
    2. Download the ready-to-use maps or generate your own ones in Houdini or Blender with the plugins we provide in the VFX Toolbox
    3. Drag and drop the maps in Unity’s Asset folder.
    4. Create and open a new VFX Graph asset.
    5. Create a new Particle Lit Output and select it.
    6. In the Inspector, select Six Way Smoke Lit in the Material Type dropdown.
    Current state
    This feature is fully supported and ready for production. Since it is a new feature, please don't hesitate to share feedback and report any bug you may find.

    What's next

    For the next iterations on six-way lighting, we will be focusing on Shader Graph integration and Universal Render Pipeline (URP) support. We also have ideas to lift up some inherent limitations of the technique (flatness revealed upon receiving shadows, lightmaps local to a particle and not taking occluding neighbors into account, and more).
    We are also working on adding Volumetric Fog output to VFX Graph, allowing visual effects to generate volumetric fog. Combining this with six-way lighting will allow pushing smoke effects even further. If you want to give it a spin, it is already available in Alpha as of 2023.1.a25.
    And, of course, we are looking toward actual volumetric fluid simulation, playback, and rendering. All these will give you a full palette of techniques to render beautiful and realistic smoke effects based on your target platforms and budget.

    Feedback
    In terms of feedback, we're especially looking for:
    • Can you think of any use cases that are not covered yet?
    • Are there any workflows that are unclear or missing?
    • Is there anything that is unclear or that you don’t understand?
    Please share your feedback in this thread.

    How to report bugs
    Ideally, we'd like any bugs reported through the built-in bug reporter tool, as that will automatically provide us with some relevant context. When reporting bugs, please:
    • Attach a (stripped) project when there are issues with X.
    • Attach X files when there are issues with X.
    Have a look at this page for more information and best practices around bug reporting.

    Once you have submitted a bug report through the bug reporter, please feel free to start a discussion about it in this thread.

    Thank you for your interest, we're looking forward to your feedback!
    The VFX Graph team
     
  2. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    687
    Looking forward to seeing this in URP
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Thanks for doing this.

    Should there be a TX_Pyro_Clouds_A_2x4_P.tga in the ready to use library? It seems to be missing for me.
     
  4. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    At this point, they might be better off adding simplified lighting paths to HDRP to make it more 'universal' (more performant on lesser hardware), and deprecate URP.

    URP just seems to be getting left further behind. Still waiting for TAA.
     
  5. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    Behind what? in what category?
     
  6. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    687
    TAA is now in URP, but I get your point. It wasn't a good idea to make two render pipelines, as now the developers have to either choose which pipeline make something like this on (and risk upsetting some people) or spend extra time to port it so it works on both.

    Six-way particle lighting for example. Let's hope that changes soon.
     
  7. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    So we shall scrap whole pipeline, because there is no six-way lighting.

    I get the point, and it's not like I am fan of what unity higherups doing, but HDRP is one to be scraped in favor of URP :D
     
  8. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    You're right , will update the folder ASAP. Thanks for letting me know.
     
    elbows likes this.
  9. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    Done
     
    PutridEx and elbows like this.
  10. Slaktarkuno

    Slaktarkuno

    Joined:
    Dec 3, 2021
    Posts:
    10
    Great stuff.
    Here's some feedback to inform of some common VFX workflows that cannot be done right now. If ShaderGraph support is in the works the following feedback might be moot, but until then:
    • Separate UVs for emissive textures - I usually use way shorter flipbook textures (fewer frames) for emissive, this cannot be done as there's just one UV channel available.
    • Emissive Texture per channel multiplier - A common workflow is to use multiple channels in an emissive texture. For example, in an explosion it's useful to be able to have soft scattered emissive in one channel and sharper flames in another for more beauty and more control. The content of these channels are then of course gradient mapped, which right now we can't do for separate emissive textures.
     
  11. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    Morning, and thanks a lot for your detailed feedback.
    Some of your recommendation were considered, but it became obvious in the end that we won't be able to cover all the VFX needs.
    VFX needs can be very different from one project to another, so the ShaderGraph integration seems to be the most effective way to find a right balance between ease of use and flexibility for the users.
    While waiting for ShaderGraph integration, you must have seen it, but a lot of options are available in the inspectors.
    upload_2023-1-27_10-2-55.png

    upload_2023-1-27_10-3-54.png

    On my end, I'm also missing some UVs Distortion and Alpha Erosion that could help a lot for looping Smoke Dissipation.
    Thanks again for taking the time for your feedback, and don't hesitate to share what you do with this feature, as we're always eager to see what the community is creating.
     
  12. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    881
    This looks extremely useful, but only relevant for us once urp is supported.

    I hate the fractured pipelines*so* much.
     
    jRocket likes this.
  13. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
  14. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    There are some advantages of this, they implement various features in HDRP in messy way, then they do it again in URP, but better.
     
  15. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Thanks for including some tips about generating content for this using Embergen in the blog post. I was able to get it working with minimal effort. Though I do need to do much more testing to make sure I actually got completely expected results, its a promising start.
     
  16. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    235
    Hi there,
    I’m noticing a significant drop in performance when this is viewed close to the camera. We created some smoke effects for bullet hits. Look and perform e great when viewing from a distance even with multiple instances of the effect. But when it starts to take up the whole screen we drop like 50 frames. Any idea what is going on?
     
  17. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    Morning. What you are describing seems to be caused by overdraw. Overdraw can happen when pixel on screen are drawn multiples time. Usually VFX can cause overdraw issue as we often use transparent shaders. It's especially true when you have a lot of Transparent Particles Quads that are stacks on top of each others. This is pretty common and not specific to the 6-way smoke lit Shader.
    What I can suggest to you is to go into :
    Window> Analysis> Rendering Debugger.
    In the Rendering Tab, change the Fullscreen Debug Mode to "Transparency Overdraw"

    This will allow you To Visualize Overdraw and adjust the Number of particles to reduce to overdraw.
    As you can see in this screen, the Overdraw is Pretty Correct. As I only have a maximum of two transparent quads that overlap.
    upload_2023-6-23_9-56-32.png

    But on this screen I've increased a lot the number of particles, so there's a lot of quad overlapping, asking the pixels affected to be drawn a lot of time. And the closer my camera is from the particles, the more each quad will fill the screen, meaning more pixel to be affected.
    upload_2023-6-23_9-59-24.png

    So, use this view to control the number of Particles and reduce overdraw.
    Another thing that you can do to reduce overdraw is to use Octagon instead of Quad.
    This can help you reduce wasted space that don't need to be rendered (Fully transparent areas):
    upload_2023-6-23_10-7-55.png upload_2023-6-23_10-9-26.png

    To do this, select your Output Context.
    From here, in the inspector, change the Primitive Type to Octagon.
    You can now use the Crop Factor to avoid fully transparent areas and reduce overdraw.
    upload_2023-6-23_10-12-45.png

    Hope that this will help you.
     
    borgstation likes this.
  18. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    235
    Hi, Orson, good to see you again.
    Yes I too suspected that overdraw was the culprit here, so I switched to octagons as you said and made a distance to camera cull in the graph that kills the particles. Fps drops are fixed now :) .
     
    ludovic-theobald and OrsonFavrel like this.
  19. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    Glad to know that you resolve your FPS drop. Have a great weekend.
     
  20. gattusoarthur

    gattusoarthur

    Joined:
    Apr 29, 2020
    Posts:
    4
    Thank you very much for sharing. I am not using VFX Graph so I implemented myself based on your ideas, and it works like a charm.
     
  21. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,105
    What's the license on the library textures? Can we use it in commercial projects?
     
    gattusoarthur likes this.
  22. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    306
    The license is Creative Commons. They are provided as is, in public domain. So yes you can use/modify them for commercial projects.
     
  23. RamType0

    RamType0

    Joined:
    Sep 11, 2018
    Posts:
    67
    How can we suppress far clip artifacts for cloud VFX?
    We need very large far clip distance only for cloud VFX.

    I want disabling far clip (by saturating depth) option for cloud VFX.
     
  24. cubrman

    cubrman

    Joined:
    Jun 18, 2016
    Posts:
    403
    The smoke is awesome indeed. It's really sad you still did not add semitransparent shadows for it, even though it's supereasy to do using dithering effect.
     
  25. shikhrr

    shikhrr

    Joined:
    Nov 19, 2013
    Posts:
    68
    Any update for URP?
     
  26. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    Yes :) . 6-Way lighting has been exposed in ShaderGraph as a shader for both URP and HDRP in Unity 2023.2.0a19 and above.
    You can keep track of the different features on this board.
    Have a great day.
     
    Slaktarkuno, jRocket and shikhrr like this.
  27. Slaktarkuno

    Slaktarkuno

    Joined:
    Dec 3, 2021
    Posts:
    10
    Awesome progress. Any chance it might end up in any 2022 lts version?
     
  28. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    It is not currently planned.