Search Unity

[Open Source] TC Particles: millions of GPU particles

Discussion in 'Assets and Asset Store' started by pvloon, Feb 28, 2013.

  1. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
  2. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    143
    Does this work with single pass stereo rendering?
     
  3. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    353
    Awesome, thanks!
     
  4. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    @yezzer: Normal singe pass, yes! The new singe plass instanced in 2017.3 doesn't yet though - need to look into that
     
  5. svanderbeck

    svanderbeck

    Joined:
    Oct 23, 2017
    Posts:
    17
    What is the proper way to get a particles position in world space in the Vertex (or Frag) shader? I am trying to create a simple effect where the color of a particle is tied to its position in world space. But for some reason I cannot seem to get its coordinates correctly from TCAppdata input (vertex : POSITION) property. Thanks!
     
  6. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hey Svanderbeck,


    It's a little confusing at the moment. TC Particles runs as a procedurally instanced shader. You get access to particle data in that instancing function. You can see that most shaders have a line like:

    #pragma instancing_options procedural:TCDefaultProc

    TCDefaultProc is defined in TCFramework.cginc. You can see there it gets passed a Particle part as it's first argument - from there you can grab part.pos.

    It's easiest to copy over TCDefaultProc from there, rename it, and redirect the instancing_options in your shader to that function.


    I'll see if I can make this a little neater in the future.
     
  7. svanderbeck

    svanderbeck

    Joined:
    Oct 23, 2017
    Posts:
    17
    Thank you so much. That worked like a charm. Was real easy to just copy part.pos into a new member of the 'TCAppdata' data structure I created, float3 worldPosition : TEXCOORD3 for the vertex shader to have access to it..
     
  8. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Hi,
    Is there a demo of this somewhere I can try?

    Use case:
    I need a GPU particle solution for a Music VR project in development for Microsoft Mixed Reality Dev program.
    I need the ability to animate the particle systems based on audio analysis as well (reactive visuals) so I assume this is possible?

    But I'd like to try it first.

    ty!
     
  9. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Hi there,

    I have been using TC Particles for a few years and love it! Just wondering if there is a way of getting the particles to be effected by lights in the scene, with shadows etc?

    Keep up the awesome work!

    A
     
  10. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hey all!

    Just uploaded a new version to the Asset store!

    V 1.8

    - Added Scripter Importer for Ply files
    - Added Point Cloud emission shape
    - Added new samples for Point Clouds
    - Added support for surface shaders
    - Added new TC Particles Standard shader based on unity standard particle shaders
    - Updated some samples
    - Improved wireframe performance & appearance
    - Various bug fixes
    - Added support for 2018.1

    Here's a little test of some of this new stuff in action:




    @elwolfeo: See above :) Should be a few days before this version is up. Do note that this is not a volumetric solution - so for transparent stuff it might not quite be what you want!
     
  11. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Incredible.... just keeps getting better and better, thanks so much!
     
  12. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    New version is in the store, just gave the demo scenes a try and this version looks very pretty, bravo! :)
     
  13. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Thanks Elbows! Awesome that you're still keeping up, been quite a few years now haha

    Besides the new version TC Particles is also included in the madness sale!
     
  14. Homer-Johnston

    Homer-Johnston

    Joined:
    Nov 26, 2012
    Posts:
    46
    Am I right that particles can't be individually affected by light position & strength? The only effect which lights have is calculated from the light to the main particle system object, and then applied uniformly to all of that system's particles regardless of their position? So it's not, for example, possible with GPU particles yet to use them for dust/fog in a dark tunnel and have a player flashlight brightening just the particles which the light hits, right?

    Also, the lit shader seems to be broken. Assigning any albedo texture just takes a single color from the texture and setting the mode from anything other than Opaque simply causes the particles to vanish. Changing back to unlit I can use fade or cutout OK (although I have to stop/start playmode to refresh it but that's fine). Is this by design, still work in progress, or just something I'm doing wrong? I'm using 2017.3 right now, let me know if I might need 2018. Thanks!
     
  15. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Eah particle can be lit individually (in fact to integrate with unity easily it's even per pixel). Are you seeing the per-system behaviour you described or just a question? If so - are you in forward or deferred? I have seen forward act a little finnicky, but I do want to support it fully.


    You are totally right about the standard shader having issues though, woops! Uvs are not passed in correctly causing your troubles. I'll upload a fixed version soon
     
    Homer-Johnston likes this.
  16. Homer-Johnston

    Homer-Johnston

    Joined:
    Nov 26, 2012
    Posts:
    46
    @pvloon I love it when I'm wrong... thanks for replying! I'll have to play with it again whenever the fixes make it to the asset store :) I have one other question: it looks like the sprite sheet order is starting on a random index. Am I missing a setting that controls this, or else could you look into it to make it optionally start from 0 or random?
     
  17. Research_3DVAL

    Research_3DVAL

    Joined:
    Jun 26, 2014
    Posts:
    15
    I'm looking to download this version but the package I download (even after clearing out the old package from users\user\AppData) seems to be the old one without the LitCloud files etc. Has the assets store package for the former indie-version been updated?
     
  18. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    @Homer-Johnston: Ah yeah you're right. Was a setting added for a client but shouldn't be on by default. Next version will add a checkbox to the inspector. THe fixed standard shader is also on the store now!

    @CofaResearch: Oh that's very strange... Yes both packages should be updated. Are you on 2017.3.1+ ? I think the asset store might be downloading older versions if you're not
     
    Homer-Johnston likes this.
  19. Research_3DVAL

    Research_3DVAL

    Joined:
    Jun 26, 2014
    Posts:
    15
    mmm 2017.3.0f3, that would be it then! thanks
     
  20. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Hi, I'm trying to emit from a moving skinned mesh.

    Using BakeMesh I have transferred the mesh movement to a normal mesh every frame, but then when I try to use this mesh as the Emitter Mesh each frame, it only emits from the first frame.

    I'm using the following code:-

    public void TCUpdate() {
    _emitter.EmitMesh = this.gameObject.GetComponent<MeshFilter> ().mesh;
    UpdateComponents();

    }

    I'm sure this was working on a previous version so has something changed?

    Thanks!
     
  21. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Sorted it by using the new cache!
     
  22. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    I've been looking to use GPU particles in my game. I've looked at this asset several times, but am hesitant because of other GPU particles systems I have tried. None of them have been able to give me the kind of control that the shuriken particle system does. My biggest issue with the other systems is the inability to run my particle simulations in world space. They are all done in local space so the entire simulation moves if I move the transform that it is emitting them. The shuriken system does not have this issue. If you could provide a preview build that would allow me to test it out that would be great. I've seen other assets provide preview builds by simply making their code stop working after a set amount of time that the scene is played (normally like a minute or so).

    If I could get that kind of clarity, I would definitely purchase this asset. I also think the preview build would help with sales significantly as I'm sure I'm not the only one on the fence for this asset.
     
  23. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    Also, is this particle system capable of using meshes?
     
  24. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hey TCROC

    World space particles are definitely supported (and local space is too). TC Particles can emit from meshes, and can render meshes for the particles. Particles can't collide with meshes however.

    Send you a package to try!
     
  25. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    @pvloon Hi, can TC Particles emit from skinned meshes? Thanks.
     
  26. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hiya!

    Not directly, but there is some API on skinned meshes (BakeToMesh) and API on TC Particles to then update the emission mesh efficiently.

    It's not ideal if you're doing lots and lots of skinned meshes, but for hero effects it works well :)
     
    ikemen_blueD likes this.
  27. stacche

    stacche

    Joined:
    Mar 11, 2016
    Posts:
    1
    Hi @pvloon I am struggling to get particle colour by speed to work, seems to only do color by lifetime. Am I missing something? Thanks!
     
  28. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    I've uploaded version 1.8.5 to the asset store:

    V 1.8.5
    - Fixed building TC Particles, cleanup folder ASM definition structure
    - Fixed lighting not working properly because of incorrect normals on billboards
    - Fixed color over speed not functioning
    - Fixed shader not updating when changing materials
    - Improved performance of vertex shader slightly
     
  29. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,048
    Where does one find the webplayer demo - your website and webplayer demo links on the asset store page point to some BS weblinks about programming and other things - looks like you let that site lapse so change the link to https://www.arthurbrussee.com/tc-particles-1/ . Also this text is confusing "*: This used to be the indie version without source code. The pro version was scrapped though. This package will be continued to be updated, but for convenience buy the used-to-be-pro version" It might help if you put some extra bold text on the preferred page to make it more apparent or link directly to the preferred page from the non preferred page.

    Anyhow would really like to check out your web demo - Thanks!
     
    Last edited: Oct 8, 2018
  30. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hey ibyte

    Unfortunately the online materials are indeed a bit out of date. Let me know if you want a build or package to give a try.

    The text refers to the fact that there used to be an "indie" version without source but cheaper. Later, we made it so all versions have source and are cheaper - resulting in two versions on the store. I've removed that text now - in practice there's no way I can remove either, so doesn't really matter which you buy.

    Thanks :)
     
    ibyte likes this.
  31. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,048
    Arthur, If you would DM me a package to try that would be great.
     
  32. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Hi @pvloon ,

    Just wondering if you would be able to give me an idea of how I might be able to access certain information for individual particles, namely their position and colour? I am trying to connect particles with lines similar to the after effects plugin 'plexus'. It would be great if I could get a list of particle positions and colours each frame. Is this possible?

    Thanks

    A
     
  33. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hi Elowfeo,

    You can! But you do need to use GPU scripting for that - there's no way to access the data on the CPU. There's a concept of "extension shaders" in TC Particles that makes it easy to do.

    - Arthur
     
  34. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Thanks for getting back to me Arthur. Is there any documentation on how I might start with extension shaders?
     
  35. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
  36. andyox66

    andyox66

    Joined:
    Aug 27, 2015
    Posts:
    15
    Thanks for the reply @pvloon,

    I'm a little lost at how I might go about getting the information for each particle using the extension shader. I can see that the 'Spring Extension' example takes the initial position, but I can't see how I could repeat this every frame and then access the information with another script. Is this even possible? Ideally I would like to get the position of each particle to connect them with lines and also the colour so I can 'delete' particles that are a certain colour. Do you think this is achievable? any help would be massively appreciated.

    Thanks for your continued support
     
  37. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hey elwolfeo,

    In a compute shader you could access all the particle positions. You could also access the color, and if it matches your setting, set the particle lifetime to 0 (killing them).

    Drawing lines between particles is trickier though! Maybe I can help a bit, feel free to share more details here, dm or mail me. Good luck!
     
  38. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    TC Particles is now free & open source!

    https://github.com/ArthurBrussee/TCParticles

    Thanks so much to everyone who has followed & supported this project over the years :) I hope in this way I can give back a little. If you've bought TC Particles in the last 3 months feel free to contact me with your invoice ID for a refund.

    (Please note the asset store version is still listed at 85$ - I've submitted the update there today, so will be free there soon too. I advise you to upgrade to the package version if you can - I will stop supporting the asset store version someday).
     
  39. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    259
    Hi! Just discovered this asset and it is really great, I would have definitely payed for it.
    I was wondering if you have any tips on how to get the per-vertex world position of the particles in a custom shader? I have a shader running like I want it to, but I can't seem to get this last part sorted out (please note I'm talking about the vertex world position, not the particle world position). mul(unity_ObjectToWorld, v.vertex) is not working for me.
    Thanks!

    Edit:

    I think I got it using the following code:
    Code (CSharp):
    1. float4 vert = v.vertex;
    2. float4 screenPos = UnityObjectToClipPosRaw(float4(tc_Particle.pos.xyz, 1.0f));
    3. float mult = _PixelMult.x * lerp(1.0f, screenPos.w, _PixelMult.y);
    4. vert.xyz *= mult;
    5. o.worldPos = tc_Particle.pos.xyz + mul(transpose(UNITY_MATRIX_V), vert);
    Another question: Is it possible to sort the particles by distance from camera to improve translucent particle rendering?
     
    Last edited: Aug 13, 2019
  40. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    259
    Alternatively, would it be possible to reverse the order in which the particles are drawn? Thanks.
     
  41. skaughtx0r

    skaughtx0r

    Joined:
    Mar 9, 2014
    Posts:
    74
    @Fewes Did you ever find a solution to the particle rendering order?
     
  42. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    259
    No, I ended up implementing my own GPU particle system which did sorting, which was no easy task. I believe it would be possible to reverse the rendering of TC Particles, but you would have to understand how the particle buffer is structured and rendered to do it.
     
  43. skaughtx0r

    skaughtx0r

    Joined:
    Mar 9, 2014
    Posts:
    74
    Thanks, I'll do some digging and see if I can figure out a way to reverse the order.