Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Light shaft system

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

  1. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193

    2.1 is a minor bug fix regarding the example scene and does not effect the system.

    The generators do not need to be replaced, the existing shafts should automatically pick up the fix.

    v2.2 should be up this week, having some improvements and the ability to select collision layers.
    With this update you will need to select the layers on each generators as by default it will collide with nothing.
     
  2. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Just in case you are wondering... I managed to integrate the Light Shaft into my scene ... making it look pretty nice.

     
  3. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Glad it worked out for you!
     
  4. lemib

    lemib

    Joined:
    Feb 23, 2015
    Posts:
    1
    Hello! This asset looks great. Before I buy, I want to make sure this will work for my project.

    I'm working on an AR game for Android, using the Vuforia package in Unity 5. The player looks around with an android phone, and is shown the real environment on the screen (using the back-facing camera). When the player looks at a photograph, I want the photograph to look like it's glowing or emitting light, similar to the way the window looks in your computer room demo. 2 caveats:

    1. The effect cannot include anything that sits BEHIND the photo, because any augmented elements will show up on TOP of the real world, no matter what their position is in relation to the real object. For example, if I have a photograph at (0,0,0), and I put a light source at (0,0,-10), the player will still see the light source.

    2. The effect needs to work without dramatically reducing the frame rate of the game.

    Do you think this asset will work for me? Thanks!
     
  5. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Augmented reality will be a bit tricky. However if you use simple square shaped windows and do not require special shapes (created with colliders or meshes), you can create a simple square cast based on x shafts for the X axis and x shafts for the Y axis.

    I would not recommend this system for AR use itself, as you can only rotate the parent (generator) of the shafts in realtime, wich means all shafts rotate along that axis. Since the parent is located in a corner, rotation does not revolve around center point (it is only used normally when placing the generator in the scene). This can create a couple of problems when implementing positional tracking, rotational adjustments, etc.

    The performance should be good, if you select mobile (this will create a shared material for all generators globally) and reduces your draw-calls significantly.

    However, if as you mentioned, only used within a static photograph, it would be very easy to setup. You can use satic lightshafts (this way collision is only detected in the first frame) and set an invisible collider as a floor to collide with. That would basically give you the same result as in the demo.

    You can then play with performance: - less shafts per row, but a wider distance in between and wider shafts give visually the same results as "more" shafts per row with a smaller distance in between. But will reduce the shaft count and thus saving performance.


    So in recap: Using in Realtime AR, not recommended.
    Use with a static photograph can be done exactly the same as within a regular 3D unity scene.

    I hope this information is of any help. Feel free to contact the support e-mail in the AssetStore if you have further questions/problems.

    greetings
    Mark Duisters
     
  6. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    Hello,
    I was wondering if installing the new version of the LightShafts Asset (2.3) will affect existing lightshaft generators in the scene?
    Currently I have lightshafts generators in scene created from v2.1
    Thank you
     
  7. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    You can update your system without a problem, your current generators will still work. However 2.3 contains a few calculation fixes, including the Falloff value of the shafts, so you will need to tweak the current generators their falloff a bit to match your original result.

    You will also have to select to which layers the generator can collide (if ray collision is on). A current bug in 2.3 de-selects every layer at start, resulting in the shafts passing through every object.


    Here is the total update log:

    Alzheimer Lightshafts 2.3:
    -Changed default variable values.
    -Mobile support now uses the same falloff calculation.
    -Fixed gizmo bug (folder not creating on runtime).
    -Optimized editor preview code (now runs exactly the same as the realtime generation during update).
    -Fixed falloff bug in editor (editor falloff did not match ingame falloff).
    -Updated example scene graphics.
    -Change inspector layout a tiny bit.
    -Fixed bug in Progressbar (would not show actual % of max).
    -Added MathG script to calculate percentage correctly. Users can also call upon these functions.
     
  8. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    Can you make a APK please?
    Thank you
     
  9. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    APK for/from what?

    Please post more info.
     
  10. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    I would like to see your system in action, in a house for example when I can walk.
     
  11. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    What I meant was, what platform the apk should be. Mac (already available) and Android both use .apk.

    At the moment there are only windows mac and linux builds available through the download link.

    edit: It seems that something went wrong during the upload of the files. It will be fixed soon.
     
  12. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    I want a demo scene for Android, a demo.apk file to download to test your scene on my android device.
     
  13. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    I will need your android version + cpu type of your device (ARM or other).

    The reason that there is no mobile build online is because of the many different versions users have. It is to big a mess. But I won't mind making a specific build for your device.

    It can take a while before it will be online. Send me an e-mail and I will keep you posted.
     
  14. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    MarkD,

    Your asset looks like what I have been looking for a long time. I need something like this for underwater scene, is this animatable? like for this kind of scene? Does it work in Forward Rendering path?

    Regards,
    Carlos
     
  15. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    It should work without a problem in forward rendering. The shafts have build in animation (you can set rotation speed for x,y,z axis) or you can set this speed through script.

    I do not know for sure what you mean by "this kind of scene". However an underwater effect is very achievable, as I myself have build several scenes similar to that.

    Perhaps with some more info, I can build a quick example demo for you. Given I receive the correct assets to build such a scene.

    greetings
     
  16. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello Mark,

    My game is about diving, so what I need is to have lightshafts as realistic as possible(your asset seems to achieve this very well based on the examples I have seen with the windows), the problem could come from the fact that I would need lightshafts all over the surface, starting at the surface and going down in an angle, and they need to look like they are constantly changing due to the movement of the water. I wonder if your system accepts a sort of cookie or something like that to dictate the variation of the lightshaft... I saw your example video with the chair going at from of the lightshaft coming out of the window, and it look great, but since I will have a big "window"(water surface), it would be probably more economic to use some kind of mask, or texture functioning like a light cookie or something like it.

    Please let me know what you think.

    Regards,
    Carlos
     
  17. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    What you wish (masking) is very much possible using the "mesh" casting feature. Simply feed a mesh into the required slot and every vertex will cast a shaft. This way you can create shapes or clusters based on vertices to depict density over surfaces or shapes. The Angle will be set up through the rest of the settings. I will make an example demo for you to see how it looks visually. And should you buy the system (if the demo suits your needs of course) I can send you my settings with the new preset system that got released yesterday.

    However, vertex animation or other kinds of animation is not supported (except from the build in rotation). The cast happens on the first state of the vertices.

    I will try to have a demo for you before the holidays, if not it will probably after new year. I hope you understand.

    greetings
    Mark Duisters
     
  18. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    LightshaftsSituation.jpg Mark,

    Thanks for your prompt response. No problem, I understand. I hope you got the idea. Here is an image from my game so you can have a good idea of the setting. By the way the game is for Xbox One, just in case that it is important to you to know the platform.

    Regards,
    Carlos
     
  19. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Platform does not matter for the demo. Building it to Xbox One is you job haha.
     
  20. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    I have updated the Tech demo with an underwater scene. You can download it now with the same link on the top of the page.

    Below is a preview screenshot to give you an idea. But try out the demo, it gives you a better insight.
    In the demo you will see that the shafts are non uniform placed with the use of a mesh cast (vertex based). Naamloos.png
     
  21. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Thank you Mark, that looks awesome, but for what I understood, you said that the use of a mesh cast(vertex based) animation is not possible right? and you know that the lightshafts have to be moving randomly to simulate the water movement... Let me check the demo you are talking about.

    I appreciate a lot your input and effort Mark.

    Regards,
    Carlos
     
  22. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    An older version of the system did use a form of vertex animation. The only way it is currently possible in unity, is by taking a snapshot of the current 'mesh state'. Which is very very slow, especially when the sample mesh has a high vertex count and has to be done on a per frame basis. I went to rotation based animation because the 80% frame drop was not worth the result. However research is still going on that part and is on the list for future updates.

    One approach would be to place multiple LightShaft generators in your scene and animate the generator's position. So that that 'group' of shafts are animated. This comes again with the downside of animating in clusters rather than on a per shaft basis.

    Of-course you should never buy something on promised planned updates.

    I hope everything is clear.
     
  23. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    I am sure I am going to buy your asset, I am just trying to get a feel about it, mainly relate to animating methods for the lightshafts, since this will be a must in my use of the asset. I saw your demo underwater and I noticed that the shafts in the demo move, slowly but they are moving, how did you achieve that animation? Is it there by any chance a place where I can see the documentation for your system?

    Regards,
    Carlos
     
  24. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Here are 3 screenshots showing the complete interface of a single generator.

    Basically the system is split in 3 steps (to follow for setup).

    In step 1 you can see at the botem the check box for animation. X Y and Z axis represent the speed the shafts will rotate at , at that given axis. In the case of the underwater scene, I used the default settings (animation is on by default).

    Keep in mind that the shafts are not actual light, but are flat planes with a dynamically adjusted UV-map. Instead of setting up 50-100 shafts yourself, the system does it for you.

    Below Mesh cast you can see the mesh called 'default' which is used to place the shafts on a per vertex basis. The mesh itself is not used inside the scene, so it does not use any resources or draw-calls. It is simply a reference for the system.

    3a5d0393a43c19f0ded093c46b2d1883.png 98e7e99ef3afccf5647e5770320b7888.png eddb6d66cfff8c4db4d0c4b9883ae9ad.png
     
  25. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    I donwnload v2.7. I don't see any lightshaft prefab in LightShafts folder.
    Is there supposed to be a prefab to create a lightShaftGenerator?
    Thanks/
     
  26. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Nope no prefab, but a menu button. Go to GameObject->Light->LightShafts.
    Untitled-1.jpg
     
  27. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    Ok thanks.


    The other issue is that the shafts arent being destroyed after exiting playmode.
    The shafts are generated in playmode, but after exiting the playmode the shafts remain in the scene. The following error is displayed in the console for every shaft when exiting playmode:

    exitplaymode.jpg

    Ive attached the genertor preset in a zip file.

    Using Unity 5.2.3

    Thank you for the assistance.
    j
     

    Attached Files:

    Last edited: Mar 5, 2016
  28. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193

    If you read the manual you will find that this is a false positive error. The generator indeed generates shafts during runtime, so that you can tweak it outside of playmode. If you turn on mobile support, that generator will use a shared material and the error in edit mode will be gone.

    The reason shared-material/mobile is off, is that if you want to use features such as color sampling, the system needs to create multiple materials.

    As for your shaft intensity issue, the latest version of Unity 5.3 has this fixed. The build you get below 5.3 is a build for Unity 4 which has different color offsets. If however you can't upgrade to unity 5.3. If you email me your invoice number, I will happily send you a manual build of the latest asset version.

    greetings
    Mark

    ps. I'll have a look at the zip.
     
    Last edited: Mar 5, 2016
  29. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    Ok, thanks for explanation. Due to issues with Unity 5.3, I am unable to dowload unity 5.3 and am stuck with Unity 5.2.3 for now.
    I was able to get the light shafts to look correct by greatly lowering the intensity of the tint color. So with theese settings the lightshafts now look good.

    newLss.png

    material.png

    I do not require any further assistance. Thank YOu.

    j
     
  30. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Glad you could figure it out so fast! Yes over intense intensities can be countered with colors that have a low brightness value. Is there a reason you changed the color inside the material rather than inside the generator?

    good luck
    Mark
     
  31. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,760
    Because the light shafts are moving in the game (they rotate around a point), my workflow is to use a single generator to generate the shafts for only one system. I then use a mesh combine tool to combine all shafts to a single mesh. Once I am satisfied with one generator system, The process of creating additional systems is easy: just copy the combined mesh to a different gameObject, then copy the material to a different materal and change the color and assign the new material to duplicated mesh. I manually created the materials to make the process very quick.
    Basically, 5,000 lightshafts are combined to just 5 meshes using 5 materials.

    COMBINING MESHES IS A CRUTIAL STEP IN OPTIMIZATION, IF NOT THE MOST IMPORTANT STEP
     
  32. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    That is a very smart take on the system. However keep in mind that you will lose the dynamic collisions and color sampeling for generators that will be combined to a single mesh. However for optimization, this is a very good solution.

    Good luck with your project!
     
  33. Tsuole

    Tsuole

    Joined:
    Feb 5, 2016
    Posts:
    12
    Hi, I have just downloaded this asset, however I got this error right off the bat :

    Assets/LightShafts/Source/code/LightShaftGenerator.js(792,21): BCE0019: 'GetFiles' is not a member of 'System.IO.DirectoryInfo'.

    I don't quite understand what this is, could somebody help me?
     
  34. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Yes, this is the most common error that pops up. It only happens when in WebPlayer mode, so check your build settings.
    This should fix everything.

    greetings.
     
  35. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    431
    Hi !
    First of all, this asset looks great !

    A question though : in 2D game standpoint, I guess we could benefit of it using planes right ?
    Let me develop : I have a configuration like a huge wall and holes in it, I make it with a plane and a material (the wall png texture, so the holes are alpha), if I'm placing your generator behind the wall, will I get some of the rays blocked by the wall and some of the rays coming through the window ?

    I have a really bad time using lights in this configuration :/
     
  36. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Hi there,

    The system can approach this in two ways:

    The first method is using colliders for that kind of trick. So if your wall mesh has a custom collider with holes at that spot, the shafts will be blocked in the closed spaces.

    The second method is that you can set up multiple generators with lowered amount of shafts casting for each hole specifically.

    If you send me an example scene, I will happily make you a demo. This way you have a better judgement whether or not your want to buy the Asset.

    The best way of contacting me is through here http://markduisters.com/contact-2/

    I hope this was of any help.
    greetings
     
    RemDust likes this.
  37. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    431
    Thank you for the quick reply, happy to know that your system works with colliders (does this include specific colliders selection ? by tags maybe ?)
     
  38. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    You can select which layers should be taken into account and which should be ignored. Any collider on an ignored layer will not be hit and thus the ray will pass through.

    example.jpg
     
    RemDust likes this.
  39. twiggyash

    twiggyash

    Joined:
    Nov 7, 2013
    Posts:
    45
    Hi, does this asset work with Unity Free 4.7? Thank you!
     
  40. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    The latest version will always be Unity 5.x and up, however there will always be a direct port available of that version if you are a Unity 4.x user. There is no difference between the Unity 5 and Unity 4 versions, except that Unity 5 has an example scene and Unity 4 does not.
     
  41. twiggyash

    twiggyash

    Joined:
    Nov 7, 2013
    Posts:
    45
    So I do not need a Unity Pro license to use it, right? Or some features need it?
    Thanks a lot!
     
  42. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Nope, no unity pro needed.
     
  43. twiggyash

    twiggyash

    Joined:
    Nov 7, 2013
    Posts:
    45
    Perfect :) Thank you!
    One more question, do you think can be used for a sunset background with rays coming from horizon?
     
  44. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Although with the proper setup it might be possible, an image effect would do a better job at that particular job.

    This system is more of an indoor/local solution. For instance light casting through trees from top-down, hallway Windows, under water scenery, etc...
     
  45. twiggyash

    twiggyash

    Joined:
    Nov 7, 2013
    Posts:
    45
    Thanks for reply but at the moment with Unity 4 free I cannot choose any image effect to achieve this result and can't upgrate my project to Unity 5. I think I'll give a try anyway :) Thank you!
     
  46. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    I wish you the best of luck, if you have any problems or questions feel free to contact me through the support mail. http://markduisters.com/contact/
     
  47. jammer42777

    jammer42777

    Joined:
    Apr 21, 2014
    Posts:
    116
    Hello, i am wondering...
    I recently purchased alloy.
    I am wondering if I can use your shaders along side alloy
    (also using the proper project settings for alloy, the custom lighting etc)

    Thank you!
    --Joshua
     
  48. MarkD

    MarkD

    Joined:
    Sep 18, 2013
    Posts:
    193
    Hi Joshua,

    Sorry but I have no idea. I myself do not own alloy.

    Alzheimer LightShafts only has 1 shader that is used for every plane (the system casts planes to create the shafts, or a custom mesh).

    The shader used for the lightshafts is based on Unity5's particle additive shader.
    So the shaders will "load" alongside Alloy just like any other Unity shader, but probably will not interact with the Alloy system in any way. Unless you modify the shader yourself. (Again, I do not own Alloy so this is an educated guess).
    But there is no official support for Alloy in Alzheimer LightShafts.

    If however Alloy supports Unity 5's additive shaders and unlit shaders by default, then Alloy should pick up the unlit features of the shader (Again, I do not own Alloy so this is an educated guess and I cannot promise this).

    I hope this answer is clear enough.

    greetings
    Mark Duisters
     
  49. jammer42777

    jammer42777

    Joined:
    Apr 21, 2014
    Posts:
    116
    That's perfect! I posted to alloys forum and they told me as long as the shader is unlit (not interacting with the light model) I should be OK

    Thank yoU! :)
    --Joshua
     
  50. Deleted User

    Deleted User

    Guest

    Hello Good sir! I wonder if i can hook these lightshafts up to dynamic alphatest materials? so the lightshafts will emitt from the visible parts on a mesh? And if its been tested on difrent OpenGl platforms like linux and mac