Search Unity

SDF

Discussion in 'Visual Effect Graph' started by DuvE, May 7, 2020.

  1. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    169
    Are there only two blocks to work with SDF right now? I can see only collide and conform to SDF in an Update part of the Graph. What if I want to scale particle based on the distance to the closes point to SDF for example? Or am I missing something?
     
    Last edited: May 7, 2020
    florianhanke likes this.
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi, yes, these are the two SDF blocks currently available. You can submit ideas for new functionality on our public roadmap.
     
  3. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    Cheers Vlad, added two :)
     
    VladVNeykov likes this.
  4. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
    Seems that what you actually want is a generic operator "SampleSDF". This is something that we plan to add
     
    pjbaron likes this.
  5. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    I tried something a little sneaky to get more functionality from the current SDF system.
    - set lifespan to constant and store it in a custom attribute
    - collide with SDF and make it remove 50% of life if collision
    - compare lifespan against custom attribute, if they are different then do whatever you want with the particle inside the SDF
    Unfortunately it didn't work... I believe that the order of operations in a context is not necessarily the order of blocks top-to-bottom? My several similar attempts to do things requiring ordered steps A then B then C have all failed.
     
  6. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    It should be, with the exception of triggers, which actually trigger at the end of update (they are experimental blocks and the UX is still WIP). Can you share a screenshot of your graph where you are doing what you described?
     
  7. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    Here's an example of what I was trying with screen grab.
    - custom attribute stores a constant which is set into lifetime
    - sdf collider should detect particles which are inside (mode: Solid) and reduce lifetime by 50%
    - comparison of custom vs lifetime should detect if life has been reduced
    - branch sets particle size tiny outside, large inside, for nice visual effect
    What I see is a sphere of particles all the same size.
    I checked that the SDF Model is inside the sphere and is visible when using SDF Conform.
    upload_2020-6-25_10-17-29.png
    EDIT: updated image, original was resetting size in the Output (oops) - same result from this one
     

    Attached Files: