Search Unity

Volumetric Lighting Help

Discussion in 'Image Effects' started by Littlenorwegian, Feb 17, 2016.

  1. Littlenorwegian

    Littlenorwegian

    Joined:
    Oct 19, 2012
    Posts:
    143
    Hello. So, I want to create visible beams of light. Like so


    Problem is, I cannot get this to work. I've been trying to use the sun shaft image effect on my camera and assigning the light, but no luck. So, I must be doing something wrong.
     
  2. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    The sun shafts image effect is normally just a cheap effect designed to work with a single directional light that acts as the sun in your scene. And it mostly shows up when the camera is pointing somewhere in the direction of the sun but there are other objects partially obscuring the space between the camera and the sun.

    Traditionally in games the sort of effect you are looking to achieve was done using 'fake it' techniques such as using billboard-like meshes and textures to draw the 'cone of light'. There are some asset store packages that use these kinds of techniques in Unity, or it can be setup manually in the scene with the right art assets and understanding of the technique. This is not an area I have experience with, so thats all I can say about that sort of solution. There are also some asset store packages that offer some more genuine volumetric solutions, but they tend to only support a single directional light and will likely impact on game performance notably if you aren't careful.

    True volumetric lighting is still in its infancy in most game engines, in part because it is not a cheap effect and various other parts of the lighting and shadow systems of the engine need to be done in a certain way to make such effects work properly and not too expensively.

    I know that Robert Cupisz from Unity gave a small personal blog preview quite a while ago of a system he'd been working on that he was hoping to bring to Unity at some point, but I've not heard any further updates on that. In the meantime he did make available an effect called 'light shafts' which if you are lucky will do what you need - its certainly more likely to than the 'sun shafts' effect you tried.

    https://github.com/robertcupisz/LightShafts

    I don't know if it still works with latest versions of Unity.
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
  4. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    And since I mentioned it, here is his teaser post from last May that demonstrates something more genuinely volumetric and interesting. But note that these kinds of things are often called 'volumetric fog' because we aren't really just talking about light here, but the presence and control over some substance in the air which causes the light beam to be visible. And if the dust, fog, smoke or whatever it is in the atmosphere isn't actually moving, light shaft effects can start to look a bit fake. Systems tend to overcome this by introducing some noise to the stuff thats pretending to be fog etc.

    http://robert.cupisz.eu/post/119949491421/volumetricfog