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.

Question [SOLVED] Can i generate a pointcache through script, and then assign it automaticaly? (yes you can)

Discussion in 'Visual Effect Graph' started by wichilowat, Nov 27, 2022.

  1. wichilowat

    wichilowat

    Joined:
    Feb 9, 2015
    Posts:
    8
    Hi!

    I am using vfx graph to render my grass. I sample a point cache that gives the direction and position of each grass mesh. Currently, I create the point cache file through my own script which works fine, then I use the exposed textures and input them as 2d texture maps in my (multiple for performance, fps tanks if I render to much grass with only one vfx system) vfx systems manually.

    My question is then how can I automate this process so the generated textures are automatically assigned in my VFX components after they are generated? The classes pointCache and pointCacheAsset are private so I'm unable to access the generated textures. So my current plan is to generate these point cache 2d maps myself but I don't know how to do this.

    How does unity bake the array of vectors into a texture? Is my approach fine or am I going about this in a dumb way?

    Thanks in advance!
     
  2. wichilowat

    wichilowat

    Joined:
    Feb 9, 2015
    Posts:
    8
    gregjdf likes this.