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. Dismiss Notice

Unity 5, shuriken and particles

Discussion in 'General Discussion' started by hippocoder, Mar 22, 2014.

  1. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    In this video (apologies in advance for it being an UE4 video - I do not want this discussion about UE4, but about the TECHNIQUE used in Unity 5)



    UE4 is shown using the depth buffer to handle collisions for particles. How does Unity 5 handle collisions for particles? I can't imagine shuriken's method of selective raycasting working at all well here at this volume. The workflow for using depth buffer makes it trivial vs having meshes. In addition to this, you can use masked image that write to depth, so a texture with holes will allow particles through. A character can have stunningly accurate collisions with particles.

    Thoughts?
     
    Last edited: Mar 22, 2014
    CharlieSamways likes this.
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Does UE4 have particle collision feedback?
     
  3. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    That is sooo clever. Doing it that way materials are vocal about the way particles reacts to the surfaces while cheaper to calculate collisions.
    They took real seriously the concept of “physically based shaders” lol

    I have no clue how to do it, but can’t a shader guru access depth buffer in Unity also??
    Would be a matter of accelerating the particle from a vector grabbed from the depth value; of course Shuriken collisions must be turned off and you also would need to control the physical movement based on the results from buffer.
    How to get the correct direction the particle should go after hitting the pixel is beyond me though. Maybe that raytracing thingy, Enlighten, on Unity5 can be useful for this?!
     
  4. vx4

    vx4

    Joined:
    Dec 11, 2012
    Posts:
    179
    You can use Compute Shaders to simulate particles collision
     
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,753
    Only on Windows.
     
  6. Deleted User

    Deleted User

    Guest

    Lol that good old OpenGL gotcha.
     
  7. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,753
    It's actually supported by OpenGL!

    Just not the version Unity uses.
     
  8. Deleted User

    Deleted User

    Guest

    I know ;)
     
  9. deram_scholzara

    deram_scholzara

    Joined:
    Aug 26, 2005
    Posts:
    1,043
    I can't find it on the website anymore (now that it has all this "learn" section stuff), but Unity actually used to have a really great writeup on how to do this kind of particle collision calculation - and I'm pretty sure it was done around the 3.5 time frame. No reason it couldn't be done now.

    Stop assuming that just because Unity doesn't have something built in by default means that it's not possible in Unity. Sure it's nice to have things done for us for the sake of convenience, but the fact that somebody didn't do the work for you doesn't mean the work is impossible.

    Edit: apparently it was a download from a blog post: http://blogs.unity3d.com/2011/09/08/special-effects-with-depth-talk-at-siggraph/
     
  10. Photon-Blasting-Service

    Photon-Blasting-Service

    Joined:
    Apr 27, 2009
    Posts:
    423
    You can do that in UE3 as well. Cascade can take data from almost any module in Unreal and use that any way you want in the particle system. The same is true for the material editor.

    You can create a lot of interaction using data from the world. For example, I made a three-layer cloud system for a Kinect game. When the player would move in the correct way, I triggered a lightning flash effect on the bottom of the normal-mapped particle clouds. I could have used a depth map to only make the middle layer of clouds flash, or have lightning strike only the background layer.

    Shuriken can do the exact same thing but it requires scripting. It's not as simple as typing in the correct name of an event or selecting a graph from a list.

    In my experience, the fancier an effect is the faster it gets cut. It looks cool to have sparks shooting through a grill and trigger lighting effects on collision etc. But, it adds up quickly and those cycles are often needed to make the main character more detailed or put another layer of paint on a car. I can make an uber-detailed shader in any engine, but it's more important to know how to fake the same look using an absolute minimum of resources.
     
  11. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'm suggesting though, that this is a constant speed. If you use depth, it doesn't matter how complex your scene is.
     
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    The depth buffer only stores z (camera near/far plane) values in the range of 0 to 1, would be hard to just rely on it to do GPU particles. There's some posibilities to get advantage of the Gbuffer wich provides more data to compute GPU collisions (like surface normals).
     
  13. Photon-Blasting-Service

    Photon-Blasting-Service

    Joined:
    Apr 27, 2009
    Posts:
    423
    I understand that for this specific effect there isn't much of a cost. So, if you have a specific need for stuff shooting through a texture-mapped mesh, then it's easier to do out of the box in Unreal 3 or 4. But, I don't see any reason why you couldn't script Unity particles to use a depth-map for collisions.

    Personally, I would just fake it and move on. On an environment that size and with a realistic indie budget, I can't spend time twiddling one effect unless it is something really special.
     
  14. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,899
    Are the particles in Unity 5 GPU accelerated ? Anyone knows ?

    Also will the collision system change ? It would be nice to start thinking of ways to alter Particle Dynamic Magic systems to be Unity 5 ready

    Is there a time frame for more info release as well ?
     
  15. Kaspar-Daugaard

    Kaspar-Daugaard

    Unity Technologies

    Joined:
    Jan 3, 2011
    Posts:
    150
    They are still simulated on the CPU as in Unity 4. We like being able to collide with geometry that's not on the screen. :) In the future we might look into GPU acceleration as an option.

    We are upgrading to a newer, faster version of PhysX. Collision is already quite fast for lots of particles, because we only do collision once for particles that are very close to each other.
     
  16. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,899
    Thanks a lot for the info :).

    Is it possible to change the min check distance in the collisions in the current system ?