Search Unity

Expose point cache as blackboard attribute?

Discussion in 'Visual Effect Graph' started by savorygreatness, Mar 30, 2020.

  1. savorygreatness

    savorygreatness

    Joined:
    Jan 5, 2018
    Posts:
    5
    I'd like to have a ton of particles in my scene coming from multiple baked point caches. For this to be feasible, I want to be able to set point caches as an exposed attribute of my graph. It doesn't look like this is possible (not in the list of supported types), but can I add it somehow?
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,464
    The answer is probably a simple one - you would need to somehow extend the functionality of VEG. Or wait for Unity to do that.

    But can't you work your way around the problem some other way, if you don't need some fancy user interface? And you don't necessarily need point caches, you could use textures too.
     
  3. Maarja

    Maarja

    Joined:
    Jul 21, 2019
    Posts:
    12
    Hi @savorysalisbury. Did you figured this out? I also have a large scene consisting of numerous pCache and it would be really hepful to re-use the same VFX graph and change only the exposed attribute. In Unity2019.3 HDRP I don't see such an attrubute in the Blackboard dropdown.
     
  4. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    725
    This important feature is still missing in 10.0.0-preview.26 and 9.0.0-prev55.
     
    Egad_McDad and Melloe like this.
  5. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    725
    Took me few hours to find workaround...

    Tried exporting pCache to texture but somehow negative values were clamped to 0 (maybe this could be fixed with exr textures). Found something better, pCache asset has all the textures but they are hidden!

    1. In
    PointCacheImporter.cs

    Comment this line (HideInHierarchy):
    Code (CSharp):
    1. foreach (var kvp in surfaces)
    2. {
    3.     kvp.Value.Apply();
    4.     //kvp.Value.hideFlags = HideFlags.HideInHierarchy;
    5.     ctx.AddObjectToAsset(kvp.Key.Name, kvp.Value);
    6.     cache.surfaces[k] = kvp.Value;
    7.     k++;
    8. }
    2. Right click a pCache asset and Reimport


    3. Replace

    With


    These are Texture2D properties set to 2. that can be changed also at runtime.

    @Remy_Unity please remove these lines and expose pCache textures going forward.
     
    skoteskote, Melloe and MagiJedi like this.
  6. Melloe

    Melloe

    Joined:
    Feb 22, 2015
    Posts:
    5
    You sir, are a legend and a scholar
     
    bunnybreaker, skoteskote and Kamyker like this.
  7. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    725
  8. pbaumgartner98

    pbaumgartner98

    Joined:
    Mar 1, 2020
    Posts:
    13
  9. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    396
    It's in 2020.2 already. Just select the pointcache asset and unfold it. The textures are inside and can be dragged to a VFX Texture2D property.
     
  10. bunnybreaker

    bunnybreaker

    Joined:
    Dec 10, 2013
    Posts:
    21
    Today is my first day using point caches and my immediate first thought was "why can't this parameter be exposed?".

    You are a legend indeed. Thank you.
     
  11. elephantcove

    elephantcove

    Joined:
    Feb 9, 2021
    Posts:
    9
    Thanks for this thread. I'm still confused how to set the value from a script. Does anyone have an example? I can't seem to get the path to individual textures in the .pcache. Any help would be GREATLY appreciated.
     
unityunity