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

Question Shader Graph: How do I access the sprite from the Particle System's Texture Sheet Animation?

Discussion in 'Shader Graph' started by stefanplc, Dec 20, 2021.

  1. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    TLDR: I'm trying to create a custom Particle Shader using Shader Graph and I need to be able to access the Sprite from the Particle System's Texture Sheet Animation.
    ss.jpg
    How can I do that?

    I keep all of my particle textures in an atlas and split them using the Sprite Editor. To then use them in a Particle System, I just place whichever sprite I want to use in the Texture Sheet Animation section and I assign a material that uses the default URP > Simple Lit shader.

    I would like to replace the URP Simple Lit shader with a custom one to achieve various effects. The problem that I'm having, is that I'm not sure how to access the sprite within the shader. I tried the Vertex Color node, but that only appears to grab the Particle color. ss2.jpg

    In the example above I was hoping that Vertex Color would grab the particle color multiplied by the texture and I could multiply that by a custom HDR color which in my case would be white but with a higher intensity, with the final result being what I had previously, but with HDR intensity.

    Thank you!
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    Take a look at this. It's from Unity's Lost Crypt tech demo.


    For the "Main Texture," you need to create a texture property on the Blackboard. In the Reference field, put "_MainTex" without the quotes.
     
  3. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    That worked great, thank you!