Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

VFX graph SIGGRAPH 2021 video

Discussion in 'Visual Effect Graph' started by YuriyPopov, Nov 15, 2021.

  1. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    Hey there,
    Is it possible to release a sample project containing the effect seen here in the video. Recently I've been investing time in procedural characters and would love to be able to play around with this.
     
    Lex4art, Roy-Hu and PutridEx like this.
  2. TinySynapse

    TinySynapse

    Joined:
    Feb 29, 2020
    Posts:
    10
    Can only agree on this.
    @VladVNeykov would you please be so kind and release it to the public? Would mean a lot to us.
     
    Last edited: Nov 16, 2021
    PutridEx likes this.
  3. TinySynapse

    TinySynapse

    Joined:
    Feb 29, 2020
    Posts:
    10
  4. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi, these samples were quick explorations to validate the features, and not something I had intended to share publicly.
    I've favored speed over polish and they don't necessarily represent best-practice examples (naming, optimization, etc.)

    I can clean them up a bit and share them, but they will be shared as-is, from me as an individual without the bandwidth to offer support on them, and not as polished official learning material from Unity.

    With that disclaimer, would you still want them? :)
     
  5. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    Of course,
    I never expected official support or anything. I just want to look at them for my own tinkering and experiments and maybe learn a thing or two :). Thank you for taking the time to respond.
     
    VladVNeykov likes this.
  6. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Right, I've cleaned it up a bit and zipped it; the project can be found here. (124.6 MB)
    Verified that it works with 2021.2.4f1 (but should work with slightly older and newer versions).

    The samples are in the VFXGraph folder, organized by release version / feature. At the root level of each feature folder is a scene with the sample. Go into the nested folders at your own risk :D

    Hope this helps; enjoy! :)


    p.s. as discussed, the project is shared as-is, without support, and it does not represent official Unity learning material.
     

    Attached Files:

    crash_over, sivrikaya, Lijal and 15 others like this.
  7. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    Thank you! The shadow spired is one of the coolest things I've seen :)
     
    VladVNeykov likes this.
  8. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    I'd just like to say that I think @VladVNeykov is worrying too much about the project quality.

    Sharing is always better than not sharing and I wish all the Unity staff would ramp down their concerns on this front as we might see more material to learn and inspire.

    No code is perfect and I've learned so much from trawling Github. You often learn as much from projects with bad architecture as you from those with good - but in either case you will always learn something.

    Compare this to all the projects that are never released where there is a 0% chance of learning something. An easy cost/benefit calculation ;-)
     
    Loishtc and Roy-Hu like this.
  9. glitchlabstudio

    glitchlabstudio

    Joined:
    Jun 30, 2015
    Posts:
    3
    Awesome! The spider example is exactly what I'm trying to archieve for the project I'm working on.
    Just same my career!

    Thank you @VladVNeykov
     
    VladVNeykov likes this.
  10. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,295
    Additional very simple example of usage. It's based on my VFXController, but stripped from almost all functionalities:
    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3. using UnityEngine.VFX;
    4.  
    5. public class VFXController : MonoBehaviour
    6. {
    7.     private const int BUFFER_STRIDE = 12; // 12 Bytes for a Vector3 (4,4,4)
    8.     private static readonly int VfxBufferProperty = Shader.PropertyToID("BufferPropertyName");
    9.  
    10.     [SerializeField] private int bufferInitialCapacity = 32;
    11.     [SerializeField] private VisualEffect visualEffect;
    12.     public List<Vector3> data;
    13.     private GraphicsBuffer graphicsBuffer;
    14.    
    15.     void Awake()
    16.     {
    17.         // List with data used to fill buffer
    18.         data = new List<Vector3>(bufferInitialCapacity);
    19.         // Create initial graphics buffer
    20.         EnsureBufferCapacity(ref graphicsBuffer, bufferInitialCapacity, BUFFER_STRIDE, visualEffect, VfxBufferProperty);
    21.     }
    22.  
    23.     void LateUpdate()
    24.     {
    25.         // You can gather data during frame or construct it here
    26.         // data.Clear();
    27.         // data.Add(new Vector3(Random.value, Random.value, Random.value));
    28.  
    29.         // Set Buffer data, but before that ensure there is enough capacity
    30.         EnsureBufferCapacity(ref graphicsBuffer, data.Count, BUFFER_STRIDE, visualEffect, VfxBufferProperty);
    31.         graphicsBuffer.SetData(data);
    32.     }
    33.  
    34.     void OnDestroy()
    35.     {
    36.         ReleaseBuffer(ref graphicsBuffer);
    37.     }
    38.  
    39.     private void EnsureBufferCapacity(ref GraphicsBuffer buffer, int capacity, int stride, VisualEffect vfx, int vfxProperty)
    40.     {
    41.         // Reallocate new buffer only when null or capacity is not sufficient
    42.         if (buffer == null || buffer.count < capacity)
    43.         {
    44.             // Buffer memory must be released
    45.             buffer?.Release();
    46.             // Vfx Graph uses structured buffer
    47.             buffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured, capacity, stride);
    48.             // Update buffer referenece
    49.             vfx.SetGraphicsBuffer(vfxProperty, buffer);
    50.         }
    51.     }
    52.  
    53.     private void ReleaseBuffer(ref GraphicsBuffer buffer)
    54.     {
    55.         // Buffer memory must be released
    56.         buffer?.Release();
    57.         buffer = null;
    58.     }
    59. }
    60.  
    In this example I use Vector3 as data, so remember to setup sampler in the same way.
    upload_2022-4-8_14-56-53.png
     
    yty, Rowlan and VladVNeykov like this.
  11. Michele_P_LF

    Michele_P_LF

    Joined:
    Oct 18, 2021
    Posts:
    9
    Thank you for sharing @VladVNeykov! This is an invaluable resource on VFX graph!

    I was wondering if the URP project you showed with the SDF letters is also available anywhere?

    Many thanks!

    Michele
     
  12. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @Michele_P_LF ,
    Apologies for the delay; I didn't keep the original, so recreated it to the best of my ability :)

    You can find a package with the effect here (made in 2021.3.9f1, but should work in any newer version too)
    Hope this helps!
     

    Attached Files:

  13. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    Godzooks. I've kept everything I've ever done in Unity including 5 minute aborted experiments.

    Now finding them - that's a different question.
     
  14. kiddsun8954

    kiddsun8954

    Joined:
    Oct 19, 2022
    Posts:
    2
    Hello, friend, I can't find some scenes such as SDFBaker, and Samplescene about explosions, Is that have some more file in history?
     
  15. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    With the risk of triggering another Godzooks from @andybak, I'm afraid I properly don't have the SDFBaker ones :)
    Did them quickly for the presentation, if I recall it's just a default system with a Position (Signed Distance Field) in Initialize, some Turbulence in Update, and a a few slight size/texture tweaks in Update.

    The explosion can be found here. It was done by @peeweekVFX, so all credit goes to him :)
     
    Noisecrime, Michele_P_LF and andybak like this.
  16. Michele_P_LF

    Michele_P_LF

    Joined:
    Oct 18, 2021
    Posts:
    9
    @VladVNeykov my turn to apologise for the delayed replay!

    Thank you SO much for putting time and effort into recreating the FX for us! I'll check it out just as soon as I have a second.

    M
     
    VladVNeykov likes this.
  17. kiddsun8954

    kiddsun8954

    Joined:
    Oct 19, 2022
    Posts:
    2
    You are doing me a great service, and I'm very grateful to you。:)
     
    VladVNeykov likes this.