Search Unity

Question Multiple Bindings VFX Graph

Discussion in 'Visual Effect Graph' started by Entchenklein, Jun 7, 2020.

  1. Entchenklein

    Entchenklein

    Joined:
    Feb 25, 2016
    Posts:
    12
    I am currently trying to get Multiple Bindings from Objects in the Scene to the VFX Graph

    I am currently using the Multiple Position Binder
    Unity VFX Graph Multiple Position Binder.PNG
    This one Will output me a Texture2D and a Integer that represents how many positions i am storing in the Texture2D

    Unity VFX Graph Position Array.PNG
    Getting the positions out of the Texture isnt a problem ether

    The problem comes when i want to use thous positions as for example points that apply velocity to nearby particles i cant realy iterate over thous points and have a effect over other particles

    I basically want to do something like this
    https://imgur.com/sbGsYLH
    but with a variable amount of Capsules

    Thanks in Advance
    Entchenklein
     
    Last edited: Jun 7, 2020
  2. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    hello u can use something called 'perlin noise' like in this video

     
  3. Entchenklein

    Entchenklein

    Joined:
    Feb 25, 2016
    Posts:
    12
    unfortunately this doesnt help i am already using perlin noise for the wave effect
    but i want to have positions that essentially lay on top of the perlin noise creating dents (where the Pill is) like in the gif i sent
    but i dont just want one dent i want a variable amount of dents for example when i have 3 players i want 3 dents that follow the players around
     
  4. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    I think you can get that effect for a fixed amount of capsules by writing a graph with multiple position properties. Each position property would affect the y value of a grid of particles (which is doing the wave effect) by adding a force proportional to distance from the particle to the point.

    I don't see a way of doing it for an arbitrary number of capsules - you'll have to choose a maximum limit and include that many copies of the shader sub-graph all linked to individual properties.

    Steps would be:
    - CPU: set the properties for all capsule locations
    - spawn/initialise particles in a grid
    - apply wave calculations as forces towards the correct wave height
    - in update include stack of capsule force graphs (using a unique property each)
    - calculate force based on distance
    - cancel x,z components of force
    - apply remaining y direction force to particle
    - output the particle
     
  5. Entchenklein

    Entchenklein

    Joined:
    Feb 25, 2016
    Posts:
    12
    thats unfortunately the problem
    thank you for you input yeah thats unfortunately exactly my problem i dont want to duplicate things in the graph if it was for like one or two things i would probably do it like this but unfortunately i want to have it pritty dynamic
     
  6. theman224

    theman224

    Joined:
    Mar 23, 2017
    Posts:
    5
    Been working on this myself. Not an expert, but this seems to works for me. The node Getattribute Spawnindex gets the particle index of each spawned particle and i use that index to walk through the sampletexture2d. That way i can get to the bound Gameobjects (in editor, but working on making it runtime). Basically i am making a trail system where one VFX graph can be used for the trails of 10.000 gameobjects (Soon too be ECS Entities). Each trail is a particle attached to a gameobject (or ECS entity) and each particle spawns a ribbon for the trail.
     

    Attached Files:

    dreamer2017helloworld likes this.