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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

True Volumetric Lights (Now Open Source)

Discussion in 'Shaders' started by Michal_, Mar 10, 2016.

  1. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    But, only in HDRP, not in default renderer.
     
  2. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Hey no problem. You should be proud that your work became widely used and accepted. Just shows how great the contribution is :)

    I managed to get it to work, thanks to a comment few pages above.
    Thanks again for the amazing asset. You should try to monetize it though.. even if its for a very less price :)
     
    Dreamaster likes this.
  3. belamessex

    belamessex

    Joined:
    May 12, 2015
    Posts:
    12
    hi michal! I love your asset a lot and used it heavily in my upcoming game Little Bug https://store.steampowered.com/app/822190/Little_Bug/
    I saw that you have a copyright line that needs to be reproduced, and I'm happy to include that in the credits. Would that work for you?

    Thanks!
     
    pcg and Whippets like this.
  4. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Hey your game looks beautiful! :eek:
    Love the artstyle.
    I am working on a 2.5D game too.. and I must say this is a great looking game I have seem in long time. :)
     
  5. belamessex

    belamessex

    Joined:
    May 12, 2015
    Posts:
    12
    <333 thanks so much, I'm really proud of it.
     
  6. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    You are welcome! Do you have a team or you worked Solo!
    Would love to have a team member like you :D
     
  7. Michal_

    Michal_

    Joined:
    Jan 14, 2015
    Posts:
    365
    Hi, your game looks really nice. Thanks for sharing.
    You're only required to keep the copyright in the source code. There's no need to put it in credits or anywhere else.
    But feel free to mention it in credits if you think it deserves a mention. That is up to you ;)

    Best of luck with your game
     
  8. o-san

    o-san

    Joined:
    Jun 23, 2018
    Posts:
    32
    First I'd like to say that this is an awesome asset, great job!

    However, I am struggling to get spotlights to work. I am using the default settings on my volumetric light but for some reason the fog flickers back and forth.

    A clip showing the problem:


    I can get the spotlight fog to always show if I lower the Shadow Distance in the quality settings panel but that also removes the volumetric properties of the fog - it passes through everything. I am using no cascades atm but I have tried both two cascades and up to four cascades with the same results.



    Any help appreciated.
     
  9. o-san

    o-san

    Joined:
    Jun 23, 2018
    Posts:
    32
    I've managed to fix some of the problems I have with the flickering fog. I found a few posts up mentioning that shadows won't render if there is no shadow caster visible (unity limitation)... So I made a large bounding box with its sides pointing inwards surrounding my scene. I set the color mask to zero and z-writing to off to prevent it from rendering the cube. I also set the mesh renderer component to cast shadows (important). Now the fog effect is visible all of the time :)

    However there is still a problem with the shadow volume flickering, not the whole spotlight fog.



    You can see the dark/shadowy areas sometimes flickers brightly. I tried maxing the Volumetric Light Sample Count and Volumetric Light Renderer Resolution to Full but the problem prevails. Is this expected behavior, can I work around it somehow?
     
    id0 and konsic like this.
  10. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    606
    I'm not really familiar with how this asset works, but I ran into a thing similar to this in my own game - unity wouldn't execute an AfterLighting commandbuffer if there is no unity default lighting. But that's where my custom lights were being rendered :/
     
  11. belamessex

    belamessex

    Joined:
    May 12, 2015
    Posts:
    12
    Thanks! and thanks for the great Asset, it really brought together the look of the game.
     
  12. belamessex

    belamessex

    Joined:
    May 12, 2015
    Posts:
    12
    I directed the game, did programming, lighting, level design, some 3D and 2D art and some sound. I had a team of friends and contractors that helped out with lots of parts here and there (mostly with writing and music) and I put it all together in Unity. I really need to get my "roll" on the team better defined lol.
     
    SamRock likes this.
  13. 747423517

    747423517

    Joined:
    Jan 29, 2015
    Posts:
    8
    Ohhh, I got it, because I didn't build the quoted Shader into EXE
     
  14. l21zxib8tr0f33v3

    l21zxib8tr0f33v3

    Joined:
    Sep 25, 2014
    Posts:
    28
    Just wanted to thank you for making such a good asset.
    I made the mistake of purchasing multiple lighting solutions (which I doubt I'll get a refund for.)
    Some didn't work with Linux: Aura & Aura 2
    Some didn't do everything I wanted: "Volumetric Light Beams"
    Some were too simple, causing them to be unusable: Funly's SunRays (Has a "Color Threshhold" which causes it to be unusable with scene that have lots of color/light variations.)
    Should've looked up an open-source alternative first, because this works perfectly and is exactly what I want.
    Thank you very much for making such an amazing asset and thank you for keeping it opensource so people can update it if you ever can't do it anymore.

    Seriously Thank You.
     
  15. sebakujawski

    sebakujawski

    Joined:
    Sep 16, 2017
    Posts:
    4
    Im joining into thanking you for open sourcing this asset. It's super performant on Linux and OSX compared to Aura2.
    I've been battling with Aura2 for last year waiting for updates / fixes / better performance. I should have just straight on download and test this.

    Thank you so much!
     
  16. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,192
    Hey @Michal_, thanks for this incredible asset, the perfomance is amazing, it is easy to use and it looks stunning.

    I'd like to know if there is a way to control the draw order of it, I'm using Crest ocean renderer and Tekoku sky and could make it draw over the Tenkoku fog by simple adding the VolumetricLightRenderer after the tenkoku fog component on camera, but it is still drawing before the tenkoku clouds and the ocean... is there anything I could do on the volumetric light shaders to achieve this?

    Again, thanks a lot for this asset!

    Edit.: also, it would be cool to have a FAQ :p
     
  17. Michal_

    Michal_

    Joined:
    Jan 14, 2015
    Posts:
    365
    Hey. You can try to delete [ImageEffectOpaque] in VolumetricLightRenderer:322. The line above OnRenderImage method. That will apply the effect after transparent geometry (which is not ideal but maybe you don't have transparent geometry?) I'm afraid that's the only easy change you can make.

    You can rewrite OnRenderImage method with CommandBuffer. That would give you more options when to render it (https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.html and https://docs.unity3d.com/ScriptReference/Rendering.CameraEvent.html)

    I agree about the FAQ but this isn't really a proper asset. It is just an experiment I dumped to GitHub. I honestly didn't expect people will actually use it.
     
  18. belamessex

    belamessex

    Joined:
    May 12, 2015
    Posts:
    12
    Hey Michal, I was able to build my game for Mac, PC and Linux using your incredible asset and I'm very grateful. I'm now building for Switch, but the build stalls when compiling your shader. I know switch isn't supported, so if there is no fix I was wondering if there is a paid or free volumetric lighting solution for Unity 2018 LTS that you would recommend? My game relies on your asset heavily for its atmosphere, so if you know of something that is similar to your system in look and function, I'd appreciate it a lot. Thanks for your hard work!
     
  19. Michal_

    Michal_

    Joined:
    Jan 14, 2015
    Posts:
    365
    Sorry, I never used any third party assets. I don't know what's out there.

    Are there any errors on Switch? Something to tell us why it doesn't work? Or is there any list of shader features that don't work on Switch? I'd consider fixing it but I have no idea what is wrong with it and I don't have Switch.
     
    Baldinoboy likes this.
  20. Fulanogamer

    Fulanogamer

    Joined:
    Jan 26, 2021
    Posts:
    1
    Helloou im pretty new here, i wonder if there is a way to make this asset work with UPR, because there is no option in there and the ones that have are really expansive, the dolar is on sky rigth now
     
  21. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,584
    I realise this is a necro but you technically don't need this asset anymore @Fulanogamer as you can switch to HDPR and enable volumetric lighting through there instead. I recommend getting into it as fast as possible instead of limiting yourself graphics wise with the default engine and getting frustrated.
     
  22. roundyyy

    roundyyy

    Joined:
    Dec 23, 2019
    Posts:
    100
    Hi there :) any chance for single pass stereo version for VR? I've tried to modify your shaders, but have no luck with it. Maybe someone else figured this out?
     
  23. babbeli

    babbeli

    Joined:
    Mar 6, 2022
    Posts:
    1
    Hey can someone tell me how Volumetric lightning works in unity!?
    I am very interested!

    Greetings from Germany ;)

    In URP template!