Search Unity

How to use a texture atlas with particle trails?

Discussion in 'General Graphics' started by Mike_vom_Mars, Feb 17, 2020.

  1. Mike_vom_Mars

    Mike_vom_Mars

    Joined:
    Aug 23, 2019
    Posts:
    1
    Hi there. I am currently optimizing all my particle effects to use a single texture sheet only. Works great so far using the "Texture Sheet Animation" module of the particle systems. However, this only sets the texture of the particle itself, not the particle trail.

    I couldn't find a way to also use a texture sheet for the particle trails yet. Am I missing something? o_O
     
    matthewstephen likes this.
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Sorry, it's not supported :(
     
  3. matthewstephen

    matthewstephen

    Joined:
    Feb 26, 2019
    Posts:
    1
    I was just having a very very quick stab at this. I'm not expecting to find a solution (and haven't searched for solutions as yet) but quickly knocked up a flipbook shader in Shader Graph just to see if I could figure out a way of doing this.

    The bit where I think I'll run into trouble is figuring out how to sync the flipbook to play with the trails correctly (off-hand I can't think of a way to do this).

    It would be lovely if trail materials could have an option to inherit [or have their own] texture sheet animation settings.

    It's something that would be an incredibly useful feature (although, quite likely, a far from simple to implement).
     
  4. AlperJoygame

    AlperJoygame

    Joined:
    May 3, 2023
    Posts:
    1
    I'm having the same trouble and because of this I'll have to copy materials for each trail with different sprites. Was trying to find a way to integrate flipbook node with current sprite assigned to texture sheet module but didn't get anywhere. If Unity could make everything that's applicable to particles work on trail particles too, we all would save a lot of time and performance cost. Do you think this'll be available any time soon?
     
  5. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Sadly no - Unity focuses most particle dev effort on the Visual Effect Graph. We only do bugfixing and very simple quality of life improvements to the Particle System.
     
  6. fabrism77

    fabrism77

    Joined:
    May 5, 2019
    Posts:
    12
    mobile devs could still benefit from it, so i dont see why not support it... also is it possible to modify the system myself?
     
  7. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    We do support it. We just don't do new feature development work on it.
    You can't modify the engine part of it, but you can extend it in any way you like - you can write your own modules using the C# job system support, for example.

    Contrary to my statement above, we actually did make an improvement to the particle trail support very recently for a contractual obligation (there is an exception to every rule!) it now supports vertex streams just like the main particle system particles. This means it's now possible to solve this desired use case by sending the texture animation frame to the trails shader as a custom stream, and setting the UV's accordingly. Requires a bit of technical know-how, but at least now it can be done. It's available in 2022.3 and newer. 2022.3.11f1, to be precise.
     
    Torbach78 likes this.
  8. fabrism77

    fabrism77

    Joined:
    May 5, 2019
    Posts:
    12
    and how do we write our own modules? I googled everything and no one seems to do it
     
  9. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Here are 3 examples (1 for each type of job we support)

    https://docs.unity3d.com/ScriptReference/ParticleSystemJobs.IJobParticleSystem.Execute.html
    https://docs.unity3d.com/ScriptRefe...bs.IJobParticleSystemParallelFor.Execute.html
    https://docs.unity3d.com/ScriptRefe...obParticleSystemParallelForBatch.Execute.html

    A job that operates on all the particles and does "something" with them is equivalent to a custom module.
    You could also do it all on the main thread with GetParticles/for loop/SetParticles code, but the links I am providing show more efficient ways to do it.
     
  10. fabrism77

    fabrism77

    Joined:
    May 5, 2019
    Posts:
    12
    so using this we could do anything? like texture sheet and vertex streams for trails etc?