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.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Feedback Wanted: Visual Effect Graph

Discussion in 'Visual Effect Graph' started by ThomasVFX, Oct 21, 2018.

Thread Status:
Not open for further replies.
  1. nonnicram

    nonnicram

    Joined:
    Apr 3, 2014
    Posts:
    20
    I saw that there are plans to have also particle trails like in the shuriken particle System. Is there a date for that? Or is there a possibility to get particle trails right now?
     
  2. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    How to play VEG only once? So that it won't loop forever.


    I saw this in feature roadmap.
     
    Last edited: Jan 30, 2019
  3. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    Where is road map?
     
  4. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    try this one
     

    Attached Files:

    nonnicram likes this.
  5. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995

    Attached Files:

    • vfx.JPG
      vfx.JPG
      File size:
      31.3 KB
      Views:
      1,010
    nonnicram likes this.
  6. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Twitter Gif doesn't really do it justice, but it's been fun playing with 150K unique brush strokes to paint with VEG
     
  7. nonnicram

    nonnicram

    Joined:
    Apr 3, 2014
    Posts:
    20
    Nice one! Thats a good start! Thank you!
     
  8. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    161
    I have a cloud system where I spawn a bunch of particles across the sky then from each of them i spawn a puffy cloud made from multiple particles so each cloud is unique in my sky.

    There is a problem though, that when you are not looking at the centre of the particle emitter all the clouds vanish.
    If i am at the edge of the cloud system and look to the centre it all looks fine.

    I tried putting the camera right on top of the particle emitter and slowly moved it away (while looking away from the particle emitter) and all my clouds disappeared at 150m. This doesn't appear to be effected by the camera clipping plane.

    Turning the camera back around and all the clouds reappear. It's as if the particles are getting culled when you're not looking at the spawner.


    upload_2019-1-31_10-25-26.png
     
    ROBYER1, Dan4x8 and konsic like this.
  9. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    I'd try playing with the Orient: Face Camera Plane block at the bottom of your graph. I'm guessing that's calculated from the center of the system, which would fit your described behavior
     
  10. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Most the existing examples and documentation are focused on single system VEG scenario. It would be good to see some examples of how "best" to set up multiple systems/instances of the same graph and how to trigger those from script or using timeline.

    For example, once we get an explosion graph working, how should we implement carpet bombing across the screen? Should we clone the VEG across multiple gameobjects, or is it better to send multiple/overlapping SendEvent() to the same VEG object?

    In the original blog, there's a video about using timeline to start/stop a graph, which seems at odds with the Parameters/Events wiki note about a multi-explosion event.
     
  11. KongGameArtist

    KongGameArtist

    Joined:
    Feb 1, 2019
    Posts:
    10


    in my current ver of VFX grapth 4.9.0 , i tried to add 2 parameters and made them exposed but they do not exposed to the inspector, anyone know workaround pls help thanks ?
     
  12. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    161
    this only seems to effect the orientation of each particle to face the camera, doesn't seem to help the problem i am having :(
     
    ROBYER1 likes this.
  13. Juan_Lagu

    Juan_Lagu

    Joined:
    Apr 23, 2014
    Posts:
    3
    I have fixed that by increasing the bounds size on Initialize, but I don't know how much it impacts on performance.

    Unity VEG bounds.JPG
     
    ROBYER1 and Dan4x8 like this.
  14. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    I'm trying to work with GPU events and ran into a couple of odd things.
    1. I had to turn Particle Options > Sort > Off on the secondary Output block to make them visible
    2. Some secondary particles spawn at the origin of the primary System
    3. So I had to add a Kill Box block to the Initialize Context of the secondary system to hide those
    Is there any description on how sorting works and how we should set it all up? Is there a difference between Auto and On? Is there somewhere to set sort order?

    Is there a better way to prevent/stop those unwanted GPU events?

    The primary system is on the left, the secondary/GPU event system is on the right, and the unwanted secondary particles are on the bottom left at the origin of the primary system
    gpubug.JPG
     
  15. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Most of the position types (box, circle, etc.) don't need orientation, EXCEPT for the Cone. Is there a way to orient the cone to point it in a different direction other than Up?
     
  16. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    161
    wow, you're a legend mate. Thanks for this!!!
    I also noticed that bounds can be local or world space eventhough the particle system is in world. very interesting
     
    Juan_Lagu likes this.
  17. Juan_Lagu

    Juan_Lagu

    Joined:
    Apr 23, 2014
    Posts:
    3
    I'm glad I could help. ;)
     
  18. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Would also be great to see a working c# code example of sending events with different parameters during runtime. I can trigger a new SendEvent easily enough, but the parameters never change from the original blackboard values

    I checked that the parameters were exposed, I checked in the code that they existed, and I tried with the scene gameobject toggled to override and not override

    Here's my code attempt, that didn't work
    Code (CSharp):
    1. VFXEventAttribute nextevt = m_VfxGraph.CreateVFXEventAttribute();
    2.  
    3.             Vector2 randomSpot = Random.insideUnitCircle * scale;
    4.  
    5.             nextevt.SetVector3("Location", new Vector3(randomSpot.x, 0f, randomSpot.y));
    6.  
    7.             m_VfxGraph.SendEvent("OnPlay", nextevt);
     
  19. Drazok

    Drazok

    Joined:
    Jan 26, 2019
    Posts:
    9
    Has anyone tried to put visual effect graph into asset bundle? It seems that UnityEngine.Experimental.VFX.VisualEffectAsset gets somehow corrupted in the process. Even when I reattach it from bundle to gameobject using script it still doesn't work.

    Compiling scene into build works fine, probably putting it into resources would also work. But those are not the solutions I'm looking for, it creates a mess in organized project and/or requires additional code.
     
  20. PaulDemeulenaere

    PaulDemeulenaere

    Unity Technologies

    Joined:
    Sep 29, 2016
    Posts:
    133
    Your issue is really strange, are you using 2018.3.3f1 ? Could you share us this VFX asset file ?

    It should work, the timeline activation track use this CreateEventAttribute. Could you share a screenshot of this Visual Effect Graph ?
     
  21. KongGameArtist

    KongGameArtist

    Joined:
    Feb 1, 2019
    Posts:
    10
    Thank you for reply, but the problem perish as i upgrade today to 2018.3.4f1. maybe new version fix that.
     
  22. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Pretty basic graph. From what I remember of the timeline example, that just started and stopped a graph. Using sendevent to start/stop works for me. What doesn't work is sending a different parameter than what is set in the gameobject, which is also the default of graph. For example, start in a different location.

    spawnParameter.JPG

    The fallback approach I'm using is to update the gameobject directly first and then call a generic sendevent with no parameters
    Code (CSharp):
    1.                 m_VfxGraph.SetFloat("Volume", intensity);
    2.         m_VfxGraph.SendEvent("OnPlay");    
     
  23. PaulDemeulenaere

    PaulDemeulenaere

    Unity Technologies

    Joined:
    Sep 29, 2016
    Posts:
    133
    I think I understood the mistake, back to the previous code :

    Code (CSharp):
    1. VFXEventAttribute evt = m_VfxGraph.CreateVFXEventAttribute();
    2. evt.HasVector3("Location"); //return false (event attribute)
    3. m_VfxGraph.HasVector3("Location");//returns true (exposed parameters)
    There are two flows of input data, exposed parameters in blackboard are a kind of uniform, they are not related to event attributes.
    VFXEventAttribute is an object manipulated by spawn context and automatically sent to the following initialize context.

    Here, the minimal graph to readback an attribute transmitted through an event.
    upload_2019-2-4_18-44-19.png
    The source location is pretty important, it indicates that you are reading a value from the previous context (by the way, it only works with initialize context for now). You can alternatively use a block "Inherit source attribute position", I did it this way to be more explicit.

    With this graph, you should be able to do :
    Code (CSharp):
    1. VFXEventAttribute evt = m_VfxGraph.CreateVFXEventAttribute();
    2. evt.HasVector3("position"); //should return true
    3. evt.SetVector3("position", new Vector3(randomSpot.x, 0f, randomSpot.y));
    4. m_VfxGraph.Play(evt);
     
    Last edited: Feb 4, 2019
    Livealot likes this.
  24. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Wow, I really got that wrong as they seemed like all the same thing (e.g., "inputs").

    In the event attribute approach, can we create our own named attributes or are we limited to the ones already defined? In your example, you used "position" which is a defined attribute with an existing Get Attribute block. I see there's a Get Custom Attribute block, but I can't figure out how I might use that to send/receive a custom event attribute like "MyCoolFloat"
     
  25. PaulDemeulenaere

    PaulDemeulenaere

    Unity Technologies

    Joined:
    Sep 29, 2016
    Posts:
    133
    This is clearly something which should have a better documentation.

    There is already a way to add/use custom attributes but you can't specify the location. So, for now, for a source attribute, you are limited to those already defined.
    We are going to release a blackboard dedicated to custom attributes with a better integration for 2019.1.
     
    Livealot likes this.
  26. pumpedbarbarous

    pumpedbarbarous

    Joined:
    Mar 18, 2015
    Posts:
    16
    I've got a major problem where if the particle system is half-way off screen, it totally dissapears from the view of the camera. I tried to change the culling, layer properties, etc, but I can't seem a way to fix it? Did anyone have the same problem, and does anyone know how to fix it?

    Changing the Culling Flags property to "Always recompute bounds and simulate" doesn't work...

    Changing the bounds on the inititalize part makes this work for anyone that has the same problem.
     
    Last edited: Feb 5, 2019
    Dan4x8 likes this.
  27. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Thought I'd do some show and tell.

    I got array attributes....working. In a very hacky way however, will be excited to see these actually happen. So I was able to add spatial partitioning and neighbor search, speeding up simulation by > 10x. Here's 100k fluid particles in realtime:

     
  28. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    How to make a graph perform the same in a build as it does in the editor.

    I've got a great looking VEG working in the editor and humming along at 60fps. I went to build it to a standalone PC player so I could capture some clean video and noticed a big loss in fidelity. It works, but behaves much differently than in the editor.

    I'm running two graphs simultaneously and I'm triggering events/changing parameters with each during runtime. In the editor, my "highlight" graph plays on top of the "base" graph, since I set the parameters to make the position of the "highlight" graph closer to the camera.

    In the build, my observation is that the "highlight" graph disappears over time. Here are some guesses as to why.
    1. Sort order works differently in the build than the editor???
    2. Draw order works differently in the build than the editor???
    3. Particle capacity is lower in the build??? maybe there are some file size limits in builds that I'm hitting
    4. Editing graph settings at runtime works in the editor but not the build??? I remember this was an issue of ScriptableObjects where a lot of things you could do in the editor weren't possible in the build
    5. Build Player Settings are incorrect/incompatible with VEG??? I've experimented a lot here with no success, but still a possible reason.
    6. My machine is running DX12, which changes the build, but not the editor???
    Please let me know any ideas on how to make the build look like what you see in the editor.

    Thanks!
     
    Last edited: Feb 6, 2019
  29. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Bumping this. I'm looking for a way to get:

    - Limited information out of VFX systems in realtime. Latency is fine. This would let us do two-way forces on a rigidbody by sending a force vector out from a collider.
    - Much more complex information out of VFX systems in the editor, not in realtime (baking a system into a vector field, for example)

    Are any of these possible? Even something like being able to receive a GPU event in a custom compute shader could help a lot.
     
  30. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    160
    Will VFX Graph be available for default SRP? At least unlit version of it.

    I really want to implement next-gen VFX in my game, but I don't really need next-gen lighting (also want to save some Performance), so no point of using HDRP. Sure, I can convert particle shaders to GPU instantiated mode with this article (https://docs.unity3d.com/Manual/PartSysInstancing.html), but it is not the same. No controls over each step and etc.
     
    Last edited: Feb 6, 2019
  31. barbelot

    barbelot

    Joined:
    Jul 18, 2017
    Posts:
    36
    I've been playing with the VEG and bumped into two issues so far :

    1. Particles sorting seems to cause flicker with high number of particles (~100k). Those goes away if I turn the sort option to Off so I guess something is wrong with the sort. I've seen this mentionned earlier in this thread but wanted to mention it again since it is pretty impactful visually.



    2. I have a setup where particles are attracted to an outside transform position with a relative force. This only works if the VFX object is at the origin (0,0,0). If it is not, then I can't get the particle to be attracted to the correct position, even when I set the transform position and VFX update block to be in world space. Am I missing something here ?

     
  32. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
  33. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    120
    These vector fields are pretty cool! But what about simple stuff like.. can particles follow a spline path? Or should everything be turned into vector fields?

     
  34. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    You can achieve this with spherical and angular velocity vectors.
     
    Kirsche likes this.
  35. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    try to sample point cache from this helix model and choouse custom position mode per index in sequential way
     
    Kirsche likes this.
  36. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    120
    @Danua
    That worked well, thank you. Right now the particle jumps between each point but interpolation should be easy to implement.

    @konsic
    That's not something that can be done with high level Houdini nodes, right? It requires VEXpressions?
    Here's what I came up with. Only the helix points are created by VEXpressions:

    Edit: Never mind. I've just discovered what you meant. Unity Visual Effect Graph already has these nodes. Just had to right-click the right context. Ty!

     
    Last edited: Feb 9, 2019
  37. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    Does anybody know how to set gravity vector always straight to the ground? I have issue when I rotate vfx system via transform of gameobject from INSPECTOR, it it, it... just change coordinate system and vector don't look at the ground!
     
    Last edited: Feb 9, 2019
  38. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    phahah solution was too easy, just set up world space vector
    upload_2019-2-9_14-1-56.png
     
    Rich_A likes this.
  39. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,304
    I just updated to Unity 2019.1 and am getting a fairly annoying compilation error:

    Code (CSharp):
    1. Library\PackageCache\com.unity.visualeffectgraph@5.2.3-preview\Editor\Expressions\VFXExpressionTransform.cs(64,47): error CS0117: 'VFXExpressionOperation' does not contain a definition for 'InverseTRS'
    Now, this is trivial to fix: Instead of InverseTRS, just make it InverseMatrix. The annoying part is that each time I close and re-open the project in Unity, Unity seems to try to be "smart" and overwrites my fix. This is with all VFX Graph versions that are compatible with Unity 2019.1 (5.2.3, 5.2.1, 5.2.0).

    I'm not sure why the package manager does this - I only know that it almost certainly didn't do this in earlier versions, and this will break VR support for the HDRP render pipeline because that requires changes being applied to the files in the package.

    EDIT:I have worked around this by switching to the version on GitHub that I have cloned locally (that version also has this fix built-in already - but more importantly, that way, Unity doesn't overwrite my changes all the time).

    Also posted about this in the Package Manager Forum because the main issue probably is an issue with the Package Manager.
     
    Last edited: Feb 10, 2019
  40. norgalyn

    norgalyn

    Joined:
    Feb 15, 2014
    Posts:
    8
    It would be nice to be able to specify the sort order. For example I want specifically back to front sorting so that transparency is not overdrawing, so I had to replace the sort shader, which means I cant use systems that use on back to front sorting.
     
  41. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    197
    try to write custom camera sort shader xD
     
  42. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    841
    I took a first dive into VFX Graph and I'm loving the underlying concepts and the graph UI, it all makes sense. I have a couple of noob questions.

    1) Are there any good examples available of how to start writing your own nodes?
    2) Am I right that shadows and motion vectors are not currently supported by any of the lit mesh outputs?
     
    createtheimaginable likes this.
  43. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    For 1, I'm assuming you've already found all the examples Unity has posted. They are great in that they use sticky notes to document what different regions of the graph do. You can learn a lot just by mixing and matching those nuggets.

    At this early stage of development, I think it's also fairly productive to just blindly experiment and see what you get. Click an empty spot in the graph and add something from the drop down list at random. Then drag the output onto a blank spot and it will give you a context relevant set of choices, and so on and so on until you plug an output into into one of the main system blocks inputs, and why not try several while you're at it!!! See what happens. You'll probably learn a lot faster than hoping someone has already discovered the exact thing you're trying to build. Good luck!
     
  44. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    If you are looking to write your own nodes in C#, the API isn't public yet, but you can embed the package and then add a
    InternalsVisibleTo
    attribute to get access, or make an assembly definition file for your code with the name
    Unity.VisualEffectGraph.EditorTests
    . In our case, we patch the VFX package for FluvioFX to make our custom blocks for fluid dynamics.

    There's also this package on GitHub, which may be more suitable for learning purposes and experimentation: net.peeweek.vfxgraph-extras

    Just be aware that this isn't supported yet, their internal APIs may change at any point as they decide what will be best to expose, and you will run into plenty of issues while experimenting with custom blocks/nodes if something isn't set up correctly. It also requires some HLSL knowledge and a good read-through of Unity's code to understand how the VFX system works at a low level.
     
    Olmi and cecarlsen like this.
  45. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    841
    Wow thanks for the overview @thinksquirrel_lily, I see it's still early days. I think I'll wait and keep working on my own compute particles while things settle a bit.
     
  46. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    302
    This is not supposed to happen and probably due to bugs. Can you enter a fogbugz with a repro project. Note also that I wouldnt recommand DX12 now with VFX Graph as it was not tested a lot and has some known bugs.

    We have plans for that (Using some VFX Graph data from either an external shader or reading it back asynchronously to CPU) But no ETA yet.

    VFX Graph is coming to LWRP in 2019.1 (unlit particles on compute capable devices only at the moment). It is also possible to use it with custom SRP (with a header implementation and a few template description). As for legacy renderer, even though there's a way to get it work, we wont maintain anything for it.

    1. There's a known bug in sorting that will be adressed soon.
    2. From my knowledge, there's no bugs with space transformation at the moment. For every system you need to ask yourself whether you need it in world or local space and for every input values that can be transformed you can set it in either world or local space too and the transformation is handled automatically.

    Having other sort orders and more generally being able to set the sort key directly in the graph is something that is planned in the future.

    1. API is planned to be public for 2019.3
    2. Shadows are implemented already (just toggle the checkbox in the lit output inspector) and motion vectors will be in 2019.2
     
    cecarlsen and lilymontoute like this.
  47. AlexTheProcrastinator

    AlexTheProcrastinator

    Joined:
    Feb 8, 2019
    Posts:
    1
    Hi there! Quick question:

    -Can you access/change exposed VFX parameters via Script in C#?
    I've looked through your documentation and there are a couple functions (Like GetFloat and SetInt), however in my specific case, I'm trying to access my exposed color parameter, there doesn't seem to be any way to do it, as there is no GetColor function, nor anything similar. Am I missing something?

    (I want to access the color so I can set some lights around the effect to the same color)

    Thanks!
     
  48. joonan05

    joonan05

    Joined:
    May 10, 2018
    Posts:
    1
    Somewhy the project which has the visual effect graph and the high definition pipeline (which is on the cloud) shows my effects on my main computer, but not on my other computer. The particle effect doesn't show up in the inspector or in the scene on the other computer (see image). I have no idea why it doesn't show them, even though both of my computers meet the system requirements and have the same packages installed.

    Project version: 2018.3.3f1 (Both computers)
    Project settings are the same too.
    amazingeffects1.PNG
    Any help would be appriciated :) Thank you!
     
  49. racarate

    racarate

    Joined:
    Jul 14, 2012
    Posts:
    62
    Hey gang! I am having a hard time figuring out if VEG is supported for the Magic Leap. Before I go down an expensive and unfruitful route, can anybody share their experience with this combo, or if it is even possible?

    Much appreciation!
     
  50. graycrawford

    graycrawford

    Joined:
    Feb 24, 2018
    Posts:
    1
    Is it possible to get the particle positions/velocities out of VFX graph? I'd love to drive an audio granulation with that data.
     
    313b likes this.
Thread Status:
Not open for further replies.