Search Unity

Light shaft system

Discussion in 'Assets and Asset Store' started by MarkD, Dec 3, 2013.

  1. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    I found some extra time today and recompiled the shader for shadermodel 2,3 and 4. Since your card only supports up to 4 I made sure to compile to the lower models too just in case. Keep in mind that the color and float values differ per models so the system's settings might look different depending on the model you are using.

    You can download the support package HERE.

    Simply import this package and it will auto-unpack itself to the proper folder structure.

    You can find the default material in the sourcefolder and change it's shader, or create your own material and override it in the inspector of the system. The proper way to spawn a system is shown below through the light menu and then clicking on LightShafts_2.


    The shaders themselves are now listed under a subcategory LightShafts-> Legacy.
    change this material's shader.PNG Shaderselection.PNG create system.PNG


    I tested it in the same unity build as you and on my machine it ran out of the box with every shadermodel. So you will have to tell me whether the new shaders work or not, as I do not own an older card to test the shaders on.

    This support package works both in the commercial and non-commercial build of the package.

    I hope everything works out.
    Cheers.
     
    Nocilli likes this.
  2. Nocilli

    Nocilli

    Joined:
    Nov 12, 2022
    Posts:
    12
    Thank you so much MarkD!!!
    Now the beams are working properly!!! :D:D:D:D:D
    And they work all three - I've switched each option - 2, 3 and 4 - and they all work!
    AS-work-fine.jpg
    I opened a new blank scene, and just added a generator.
    This new scene has real-time global illumination enabled by default, which is different from the scene settings of my little project.
    And that's why I wanted to ask: - do the beams work without real-time light sources?
    (Because in my project scene all the lighting is static, for speed)
    Are these beams baked into statics?

    Thank you, respectfully!
    Cheers! :rolleyes:
     
  3. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Good to hear that the new shaders are working out.

    The shafts are not related to any light-source, they are merely an effect, completely fake. In order to create an optimized mesh simply press the big BAKE button and the system will collapse every dynamic shaft into a single mesh wish can be set on Static. By baking you can increase the shaft count to create denser volumes, as keeping them realtime would slow your system down. If you want to edit the shafts again, simply press GENERATE again to spawn dynamic shafts, use the pivot tool to align them and then press BAKE again.

    If you want the light to match real-time light-sources simply reference their transform in the system's inspector and override the pivot tool, they will rotate towards your light-source instantly, press BAKE and voila matching shafts.

    All shaders to an additive color blending, so normally they should fit well within most lighting scenarios, if the ambience is real-time, they will simply add their own value to the existing pixels.

    Have fun playing around.
     
    Nocilli likes this.
  4. Nocilli

    Nocilli

    Joined:
    Nov 12, 2022
    Posts:
    12
    Hi MarkD !!!
    Everything works exactly the way you did, perfect!
    Shader_RP lies in unsupported, and the 2-3-4 versions work fine in my Unity! ;)
    But I checked, and there's a "but":
    - rays in my Unity are displayed only when there is at least one real-time Direct-light source!
    No other light source allows you to see these beams.
    And if Direct-light is set to bake mode, the beams disappear too.
    That is, they now only work with a real-time directional light source.

    MarkD, please please make a patch so that the rays exist at all sources, and their baked versions!
     
  5. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Hi,

    I have to look in to that. It might be because the shader is searching for lighting data of later unity versions.
    It is rather busy this week, so searching for another solution might take a while. Or, I could simply unhook the lighting and simply output the color as is, might be able to fix that in a couple of days then.
     
    Nocilli likes this.
  6. Nocilli

    Nocilli

    Joined:
    Nov 12, 2022
    Posts:
    12
    Hi MarkD!!! Please do it without the light and with the light! I love these rays! ;););) Cheers!
     
  7. Nocilli

    Nocilli

    Joined:
    Nov 12, 2022
    Posts:
    12
    MarkD, where are you? Please turn off the lights at the beams to bake them!
    Without a bake they slow down terribly, you can't get through them without huge delays! :mad:
     
  8. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    That is why there is a giant bake button. The intended use is to bake the mesh down to a single mesh.
    Real-time updates during runtime should only be done with a very low shaft count as it has an overhead.

    The proper workflow would be Baked=medium to high shaft count possible with a smaller width and real-time = lower shaft count but greater shaft width.
    Same logic as whether to use Baked or real-time lighting, you can have way more baked lights than real-time lights.

    As where i was, busy with work. The only update i am going to do to the shaders is unhooking the lighting (probably in the following week). I am not going to create a new solution or more variants for outdated version support as it has no benefit to the current and newer version of the package.
     
    Nocilli likes this.
  9. Nocilli

    Nocilli

    Joined:
    Nov 12, 2022
    Posts:
    12
    MarkD, please do! Turn off that devil's light. :confused::confused::confused:
    Let the rays be unaffected by the lighting! Because now the merged beams in one grid (the 'bake' button) are only displayed from the 'sun' (direct-light) and only in real time. Other light sources and all baked light sources do not ignite these beams! I don't want to and won't put new versions of Unity because they're stupid, and I won't go beyond the 2018 version. Despite the novelties, the best versions were in the past - Unity-5 and Unity-2017! :( Low bow to you for your help and those beams!
     
  10. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Finally got some time to unhook the lighting. sm2,3 and 4 should work now. You do have to crank up the intensity value of the generator as it no longer sources its values from light-sources. Simply pick a main color and your good to go.

    I updated the legacy pack on mega: https://mega.nz/file/vOx0yJpY#oEV8_JYlN5Rz7GsqBopNZlQsqrGz3NvVHwYPuk4VFK8
     
    Nocilli likes this.
  11. yuvsv47

    yuvsv47

    Joined:
    Nov 2, 2022
    Posts:
    16
    Can you please tell me which render mode should be used for your beam system?
    Deffered render path or Forward?
     
  12. Nocilli

    Nocilli

    Joined:
    Nov 12, 2022
    Posts:
    12
    Hi MarkD! Thank you so much, now the beams are shining! :D;)
    True there is still noticeable braking in the scene when moving, where the beams are located! Probably have to change the graphics card. o_O
     
  13. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Kudos for the support there!
     
    MarkD likes this.
  14. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Can't optimize it any more. Try lowering the shaft count and increasing the shaft width. That way you can render "kinda" the same visuals but with a lower count. But It might as well be that the transparency pass is simply to much for your gpu.
     
    Nocilli likes this.
  15. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    For the legacy shaders(deprecated Unity versions)? Should work on both, since lighting is no longer taken into account on those shaders.
     
    yuvsv47 likes this.