Search Unity

ArcReactor procedural ray generator

Discussion in 'Assets and Asset Store' started by CatsPawGames, Jun 4, 2014.

  1. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    KeyImage_forums_16.png

    ArcReactor lets you generate rays and beams in any shape, form, color and behavior.

    ArcReactor on Asset Store

    Tutorials on YouTube (work in progress)

    ArcReactor easily generates lasers, lighting arcs, plasma rays and magic effects procedurally.

    FEATURES:
    • reflections algorithm allows easy setup for ray reflecting off scene colliders.
    • particles emitting from ray volumes
    • generation of point lights for simulating volumetric light sources.
    • performance manager allows dynamic changes of detail level for mobile platforms.
    • flares generation and control of their color and intensity.
    • various randomization options
    • every possible parameter is editable, giving you unprecedented control over looks and behavior of your effects.
    Package contains arcs generator script, custom additive shader for realistic ray visualization, helper script for easy integration into existing projects, ready-to-use prefabs and 3 demo scenes.

    Manual
    P.S. Check my other assets:
    Shader-independent See-Through System
    Colorify partial recolor shaders
    U Chroma Key image effect
    Advanced Selective Coloring image effect


    particles.jpg
    reflections.png
    trails.png
    features.jpg
     
    Last edited: May 22, 2020
  2. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi this looks nice especially the dynamic lighting. Would this be suitable for use on a mobile device or ps vita do you think ? How are your plasma splines being rendered are they rendered using unity particles , meshes or another type of system ? Could you give any figures on how many draw calls your demo scene is for example or perhaps compile an apk demo for android that I could try to see how it runs before purchasing ?
     
  3. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Thanks for reply.
    All splines are meshes and are rendered using LineRenderer component.
    Draw calls amount depends heavily on usage of dynamic lights. Without them, plasma ray with spiral effect takes 4 drawcalls, with them - 30 (you can regulate amount of lights on your systems). Basically, each active arc of system adds 1 drawcall, and each point light along arc adds some more (depending on scene setup).
    Right now project undergoes some serious mobile testing with the help of some volunteers and I will inform you of results.
    Preliminary results: Demo scene contains 30k static triangles(platforms and such) and max of 170k triangles from ArcReactor effects, and max of about 115 drawcalls(mostly due to heavy usage of dynamic lights - around 50 max without them). On Galaxy S2 at most performance-intense moment it run at 47 fps with lights on.
     
    Last edited: Jun 6, 2014
  4. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi I purchased this and can confirm it does work on mobile. It gets about 47 fps on a high end nexus 5 but about 20 fps on a ps vita with all the lights on. One suggestion I would have would be to create an arc manager object that can control and change the quality of the lighting and arcs based on the current frame rate. At present it is a bit time consuming having to select every arc point and turning the lighting off individually. It would be better if there was an option or script that all arcs could be controlled from. For example have an option where when a new arc was generated it checked the current frame rate and only enabled lighting from it if the fps was above a certain number. That way the quality could dynamically adjust based on the complexity of the scene and performance of the phone it was running on without the user having to worry about the lighting when they were creating the scenes.
     
  5. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    That's a great idea concerning performance manager. I'll release updated version with that and some tweaks at the beginning of the next week.
     
  6. VectorNector

    VectorNector

    Joined:
    May 22, 2013
    Posts:
    62
    Is there a collision example in the asset?
     
  7. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    If you mean rays collision with scene colliders - yes, all launchers on demo-scene are cofigured with that in mind.
    For more info, you can consult manual on "ArcReactor_Launcher" component, specifically "Launch Method", "Start behavior" and "End behavior" parameters.
    If you meant something else or there isn't enough info in the manual, ask away!

    P.S. Update took longer than expected, but soon there will be version 1.01 containing performance manager, automatic flares and new spatial noise options.
     
    Last edited: Jun 14, 2014
  8. VectorNector

    VectorNector

    Joined:
    May 22, 2013
    Posts:
    62
    Very cool. I like examples cause sometimes I miss details that are really obvious.
    Thank you!
     
  9. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi how is that update coming along. Any idea when you will be able to release it with the performance manager update ?
     
  10. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    My main job kept me pretty busy, so I only able to work on update during weekends. I think I'll finish it around 20 July, so it should be available for download through Asset Store around 23 July.
     
  11. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.1 available on asset store!
    Changes:
    • Performance manager!
    • Flares
    • New random spatial noise system (sorry, spatial noise options in old prefabs are not compatible)
    • More prefabs
     
  12. axeloid

    axeloid

    Joined:
    Sep 5, 2014
    Posts:
    1
    Hi.In my scene i have a mirror(plane),how to make specular reflection of rays?
     
  13. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi!
    Concerning reflection of rays, please look at the new reflections demo.
    If that is what you're looking for, it will be available in 1.2 update in about 1-2 weeks.
    Tracing demo is also available.

    Sources for both demos will be included in the update.
     
    Last edited: Sep 6, 2014
  14. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.2 available on asset store! (Unity review team pleasantly surprised me with their speed)
    Changes include:
    - Complex ray reflections added
    - 2 new example scenes: reflections and shape tracing
    - Improved precision of shape calculations
    - Multiple small features added and minor bugs fixed
     
  15. gterveen

    gterveen

    Joined:
    Dec 17, 2012
    Posts:
    22
    Hi,

    do you by any chance know if your Colorify shader is compatible with the PolyWorld conversion? It is just what I could use to no longer do it in photoshop, but it is only useful to me if the shader can run through PolyWorld. :)
     
    Last edited: Sep 10, 2014
  16. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi!

    I don't use PolyWorld myself, so I can't be sure. If PolyWorld uses standard Unity shaders, then you can easily swap them for Colorify shaders. If, on the other hand, there's some custom shading going on (and my guess there is), Colorify obviously wouldn't work from the box. If that's the case, you can send me an example of PolyWorld shader and I would tell whether it would be possible to befriend it with Colorify.

    P.S. There's a thread about Colorify, so any further discussion of Colorify should probably be there.
     
    Last edited: Sep 10, 2014
  17. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    awesome
     
  18. Megalithic

    Megalithic

    Joined:
    Apr 21, 2014
    Posts:
    61
    Hi, How would you detect collision on object after the ray is cast? Like for instance if the laser beam hits a particular object, the object should detect it which would allow me make it do anything I want.
     
  19. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi!

    There's a message system built-in into the Launcher component. You need to toggle "Send Message To Hit Objects" or "Send Message To Reflectors" parameters, and the component will automatically send messages to objects that've been hit. All you have to do to is to place an "ArcReactorHit()" or "ArcReactorReflection()" functions in any scripts on your objects, and they will be performed when they are hit by ArcReactor-launched ray.

    The reflections demo-scene contains example of using "Send Message To Reflectors" parameter. If you look carefully, hit mirrors change their color continually - that's done by changing variable in ArcReactorReflection() function.

    P.S. It turned out I forgot to mention this in the manual, my apologies. I'll update online manual as soon as I can.
    P.P.S Updated manual and uploaded updated 1.2b version to Asset Store, should be available in 3-7 days.
     
    Last edited: Sep 12, 2014
  20. Megalithic

    Megalithic

    Joined:
    Apr 21, 2014
    Posts:
    61
    I thought the shader on the mirrors are reflecting the light emitted from the lamps on the ray. Isn't that whats happening? or the mirror is literally changing the material? I couldn't figure it out.
     
  21. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Both are correct.

    Mirrors are specular and reflecting lights, but when you stop the ray you can see they still go white-yellow-red-gray. That color gradient comes from dynamic changes in material color via messaging system. (Basically there's "temp" variable that determines color of mirror. Usually it's 0, but ray hitting the mirror gradually raises it towards 1. When ray stops hitting the mirror, it gradually goes back to 0 in about a second. Of course, it's just particular implementation of messaging, you can do whatever you want with your objects inside hit and reflect events.)
     
    Last edited: Sep 12, 2014
  22. Megalithic

    Megalithic

    Joined:
    Apr 21, 2014
    Posts:
    61
    Man your thing is awesome. So can I also use those functions to instantiate particle systems at the point of contact?
     
  23. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Yes, you certainly can. To do that your functions should be also receiving exact point of raycast hit, so use something like "void ArcReactorReflection(Vector3 hitPoint)" (C# example). I can send you modified launcher script that includes that hit point in SendMessage.
    (Actually, that's a good idea about sending coordinates of contact and other info, I'll include that in next update)
     
    Last edited: Sep 12, 2014
  24. Megalithic

    Megalithic

    Joined:
    Apr 21, 2014
    Posts:
    61
    I think I just recently stepped into intermediate territory of scripting. So thank you very much for you offer but I will try to figure it myself mate. Besides that awesome asset thank you for your support. will definitely get back in touch with you for further questions.
     
  25. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Glad to help!

    It should be pretty easy to modify ArcReactor_Launcher script yourself for your needs, there's only two invokes of SendMessage there, one for Hit and another for Reflect.

    Will be glad to answer any further questions if they arise.
     
  26. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Minor manual and effect demo-scene updates.
    Also, new version should be available on asset store in 3 days containing updated manual and minor fixes.
     
  27. Megalithic

    Megalithic

    Joined:
    Apr 21, 2014
    Posts:
    61
    Is there any way you can make the palyback type on the arcreactor_ arc consistent? The Ray needs to emit a straight line.
     
  28. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I'm not sure I understood your question, can you please elaborate?
     
  29. Megalithic

    Megalithic

    Joined:
    Apr 21, 2014
    Posts:
    61
    The play back type has 3 options. Once, loop and pingpong. How can i make it consistent?meaning the ray should look like a laser with no looping effects. In the example scenes simple laser when shot from a gun emits a consistent laset as long as the mouse button is held down. But I am emitting it from an object in the scene but for some reason i cant seem to make the ray emit a straight laser.

    Also any ideas how to reduce draw calls with this. Coz I need that asset for a mobile but the draw calls shoots up by 20. I tried reducing segements, smooting segments but doesn' t bring it down too much.
     
  30. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Playback:
    The easiest way to make ray consistent is to choose loop or pingpong playback and set your color gradients and curves flat. That will make a constant endless ray (texture animations, randomizations and oscillations will still affect it).

    EDIT: Disregard that, please read next post
    If you want to retain gradual appearance and disappearance of the rays, you can use Once playback type and manually set current system lifetime through your scripts. For that to work, you need to make "elapsedTime" variable public in the ArcReactor_Arc script. Example of usage from firing script:
    Code (CSharp):
    1. public bool fire;
    2. public ArcReactor_Arc arc;
    3.  
    4. void Update ()
    5. {
    6.      if (fire && arc.elapsedTime > 0.5f)
    7.            arc.elapsedTime = 0.5f;
    8. }
    When you set "fire" variable to true, ray will gradually appear and "freeze" at 0.5 seconds lifetime position. If you set "fire" to false later, it will return to normal playback and destroy itself at the end of its lifetime. If you use Launcher component, you can get currently active rays from "RayInfo[] Rays" array. (Data structure is described in script reference in the manual). 0.5 seconds value is just for example, you should use appropriate value depending on your rays lifetime.
    I'll look into providing more convenient interface for that functionality in the next update.

    Drawcalls:
    Volumetric light simulation is the main source of drawcalls. Disabling lights will reduce drawcalls drastically - to 1 drawcalls per arc, so 1 for laser, 4 for plasma spirals etc(flares may add 1 more). If you want to retain lights, you can increase lights radius in lights options, reducing number of generated lights.
    Note that manipulating shape, vertex count, oscillations or any other parameters except lights and flares will not affect drawcalls - every system always add 1 drawcall per arc beside lights and flares.
     
    Last edited: Sep 17, 2014
  31. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Concerning consistent playback, I made a quick update of the Arc script. Now, you can use "freeze" boolean variable to freeze the playback of the ray at any time(by freeze I mean status of the ray along it's lifetime, it will still be affected by randomization, oscillation, changing shape transforms etc.)
    It will be available in the next update. If you bought ArcReactor and need this update now(next asset store update will be in about 2 weeks), send me PM and I will send you updated script.
     
  32. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Coming soon in version 1.3:
    Shuriken particles emiitting from ray shapes:
    WIP_particles.jpg

    P.S Shuriken API is seriously lacking. I hope it gets better in 5.0
     
    Last edited: Sep 24, 2014
  33. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.3 is live on Asset Store!
    Changes:
    • Shuriken particles emitting from rays volumes (see Effects demo for examples)
    • More control over ray system playback
    • Hit data messaging in hit and reflect events, added example of usage in reflections demo-scene
    • Interframe interpolation support
    • Added 1 new ready ray prefab and updated existing prefabs
     
    Last edited: Sep 30, 2014
  34. chrs944

    chrs944

    Joined:
    Oct 1, 2014
    Posts:
    4
    The ArcReactorHit method seems to only be called once when the ray hits an object, how could I get notified when the ray is no longer hitting the object? or is there a way to make the ArcReactorHit method be called continuously as long as the ray is hitting it?
     
  35. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    That's strange, this method(as well as ArcReactorReflect) should be called each frame the ray hits object. I just quickly tested it and it works as intended. Can you post an example of your usage of this event?
     
  36. chrs944

    chrs944

    Joined:
    Oct 1, 2014
    Posts:
    4
    never mind, it does.. I must have been looking at something else. I did however change the line hit.transform.gameObject.SendMessage("ArcReactorHit"); to hit.transform.gameObject.SendMessage("ArcReactorHit",SendMessageOptions.DontRequireReceiver); within the ArcReactor_Launcher.cs file to suppress the No Receiver error message in the console.
     
  37. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I'm glad to hear that things worked out.
    Still thanks for mentioning I guess since I started reviewing messaging system and found that messages only go out if you have reflections turned on. Fixed that, now hit messages go out regardless of reflections settings.
    Also, good idea disabling error messages, that slipped my mind.
    Just uploaded fixes to Asset Store(version 1.3b), should be available sometime next week.
     
  38. chrs944

    chrs944

    Joined:
    Oct 1, 2014
    Posts:
    4
    Thanks, this is a great asset and I'll be using it quite a bit.
     
  39. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Thank you for the kind words, it's good to know that my asset is being useful =)
    It would be very helpful if you leave a rating or review for it on Asset Store.

    Also, I would help with promoting any project that's using ArcReactor by mentioning it on my twitter. If anyone is interested in that, PM me or post project info here.
     
  40. nirg

    nirg

    Joined:
    Oct 3, 2014
    Posts:
    2
    Hi, I want to place a ray on a spaceship to use as a minning beam...

    Next to my ship, the ray looks tiny.....

    I can't find / dont understand how to make the rays larger(wider?).

    Can you please help?

    Thanks!
     
  41. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi!

    Control over size and shape of ray is done via "Size options" segment. To make your ray wider, change "Start width curve" by increasing Y-values (make the curve "higher"). If "Only start width" isn't toggled, you should also change "End width curve".

    Note that if your ray system contains several arcs, you should change width curves of each arc individually.

    On all behavior curves of the ray, X-axis is time along ray life.
     
    Last edited: Oct 3, 2014
  42. nirg

    nirg

    Joined:
    Oct 3, 2014
    Posts:
    2
    Thanks a lot!!!
     
  43. poke50uk

    poke50uk

    Joined:
    Jul 29, 2013
    Posts:
    11
    Hi Cat
    So I'm trying to create an effect with your kit. At the moment I'm struggling to find any way to create nice caps of effects that aren't lens flares.

    This is my current effect


    This is what I was looking for



    Just soft ends to the effect

    And what would be even better would be some tiny effects at the points which the effect is touching a surface.

    Which options would I use for these?
     
  44. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi!

    I made a quick update and added fade parameters in "Color options"
    Now you can set a fade point(point on the length of the ray from which fading begins) in worldspace units (e.g. 1 meter) or relative units (e.g at 12% of ray length). Point is calculated from the end of the ray, so if you set up relative point at 0.12, last 12% of the ray will be faded. I'll send you PM with links for updated files since update will be available at Asset Store only in about a week.

    As for generating effects on hit point, for now you can do it via "ArcReactorHit" event. For examples of how to do it, see reflections demo (hit and reflect events are identical). I'll look into providing simplified way of generating effects on endpoint of the rays, but it'll probably be in the next major update at the end of October.

    Simplest example of fading:
    fading off:
    no_fade.jpg
    fading on:
    fade.jpg
     
    seansteezy likes this.
  45. poke50uk

    poke50uk

    Joined:
    Jul 29, 2013
    Posts:
    11
    The fade works as expected : D

    Thanks!
     
    Last edited: Oct 4, 2014
  46. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.3c is live on Asset Store!
    Updates include:
    - ray fading
    - fixed hit messaging on non-reflective objects
     
  47. catfishCanada

    catfishCanada

    Joined:
    Oct 7, 2014
    Posts:
    2
    Hi Cat, thanks for the awesome kit! I've got some good looking rays, but I need to have a bit more control.

    Is there any way you can add a curve control to multiply the current width over the length of the ray? That is, I want the ray to be skinny near the source, bulge out, and then be skinny at target.

    Also, could there be a way to assign velocity to the spawned particles that is along the vector of the beam? I want my particles to shoot forward with the beam, not spawn in random directions.

    Thanks for considering!
    Sean
     
  48. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi and thanks for kind words!

    I'm sorry, but there's no way to set the width of the ray by curve due to LineRenderer limitations. There can be a workaround in procedurally generated mesh, but I think the performance will be abysmal. I'll think about another solutions, but can't promise anything on that one. For now, you can only control start and end width of the arc.

    As for particles velocities, I added "Direction during lifetime" curve to the emission options. X axis of this curve is lifetime of the ray system, Y axis is direction with 0 meaning random direction, 1 - forward direction alongside ray, and -1 - backward direction. Values in between will be interpolated, so value of 0.5 gives you half-random direction with bias towards forward.
    direction.jpg

    As always, this will be available in the next Asset Store update and I'll send you link for direct download.
     
  49. catfishCanada

    catfishCanada

    Joined:
    Oct 7, 2014
    Posts:
    2
    Awesome, thanks! I won't have time to try it for about a week as I'm going on vacation, but thanks for the fast turnaround!
     
  50. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    1.4 version coming soon!

    main changes:
    - shape texture which allow for very precise control over ray width
    - combined shape - you will be able to designate system shape by Vector3's, Transforms or any combinations of them.