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.

Visual Effect Graph - pCache Attribute Map (split components) and particle shadows

Discussion in 'Visual Effect Graph' started by Whiz-Bang, Jun 20, 2020.

  1. Whiz-Bang

    Whiz-Bang

    Joined:
    Jun 25, 2011
    Posts:
    20
    Hi, I am new to Unity's new Visual Effect Graph editor. Though I have used similar systems for many years.

    My project is using Unity 2019.3.3f1, Universal Render Pipeline (URP)


    I have 3 questions:


    1. Can I use custom mesh with my own shader (URP)?

    2. Is there a way to split the pCache Attribute Map (3d texture) into separate RGB channels, so that I can use these for different particle manipulations? Position, size, color tint

    I want to use red vertex color area to spawn submesh mask1, green for submesh mask2, blur for submesh mask 3, and so on.

    upload_2020-6-21_0-53-55.png


    upload_2020-6-21_0-54-11.png
    I can only seem to spawn grass particles on the red vertex color channel


    3. Is there a way to tint grass particles that are spawned in shadowed areas? E.g. by looking up light map pixel below, to the nearest particle pivot, and tint the grass by this value.If a grass particle is half way in light and half way in shadow then it will use the tint from where the pivot is. Or is there another method? I understand that GPU particles are unlit on URP?

    upload_2020-6-21_0-54-37.png


    Please advise!
     
  2. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    51
    To split the RGB you could try setting it as the particle colour, then using get attribute colour for the components, and finally resetting the particle colour to whatever it is meant to be. I've been told that the order of operations in a context is linear from top to bottom so this kind of trick should work...
     

    Attached Files:

  3. Whiz-Bang

    Whiz-Bang

    Joined:
    Jun 25, 2011
    Posts:
    20
    Thank you, that sounds like an interesting workaround. I will try that out!
     
  4. Whiz-Bang

    Whiz-Bang

    Joined:
    Jun 25, 2011
    Posts:
    20
    Using the 'Get Attribute Color' and resetting the color on Ouput worked! Do you know if particles are automatically culled when they reach size 0? Or do I need to use some kind of a Size Test to kill particles below a certain size?