Search Unity

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
    Hey guys,

    is it possible with the awesome vfx graph to get nested particles. Like branches on a tree? I try to create trails that split into more trails a few seconds later. Something like this... but a little bit more beautiful / organic ;)


    For the trails i started with a really good example here from Keijiro...
    https://github.com/keijiro/VectorFieldExamples

    Thanks guys!
    Cheers, Marc
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @nonnicram It's definitely possible, if you use some trickery and are smart with it. But it might not work for all situations. When you say you try, what did you try so far?

    I've dabbled in branching with VFX Graph a bit, when I was thinking is there any way to achieve it. I just cleaned up a bit one of my proof-of-concept scenes and did a quick render:


    You can pretty much use the same technique as with lines, just inherit some positions and use those to your benefit.
     
    Voronoi and andybak like this.
  3. nonnicram

    nonnicram

    Joined:
    Apr 3, 2014
    Posts:
    20
    Hey Olmi,

    thanks for the reply. Wow, thats already an impressive example from yours! Right no i just draw lines that generate trails. I have no clue how to inherit those new positons, I tried to add new positions in the update but that didnt do the trick. Here is the vfx graph so far for the trails. Any hints in the right direction are appreciated.

    Screenshot (100).png

    Thanks Olmi
     
  4. bjedlowski97

    bjedlowski97

    Joined:
    Feb 13, 2018
    Posts:
    34
    I am wanting to create lightning in the vfx graph, it there a way to get the particles to do that jagged movement like lightning. I was able to achieve it before in the normal particle system with noise, but I am unsure how I would do it here
     
  5. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    Create a line strip (or just connected line segments) and deform it with noise? That’s a good starting point.
     
  6. protoben

    protoben

    Joined:
    Nov 11, 2013
    Posts:
    39
    That's great. exactly the right tool for altering a particle under a condition. thanks!

    With the tools you showed I was able to state "check if particle below this line, and if so change particle." Playing around a little I was able to say check if it is below this line, above this line, left of this line AND right of this line, but any idea how to make it check if a particle is with in a circular area or sphere?

    thanks again for pointing out branching
     
  7. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    Use the distance operator and check for distance < radius?
     
  8. barbelot

    barbelot

    Joined:
    Jul 18, 2017
    Posts:
    15
    Hello,

    I'm trying to understand how to use a Shader Graph in the Visual Effect Graph and I got the shader graph part with the visual effect master node, but I don't understand how to create an output context using this shader in the visual effect graph.

    I looked at Keijiro's examples (https://github.com/keijiro/VfxShaderGraphTest) but in those vfx graphs, if I create a new output context, it will use the default shader and not the shader graph.

    upload_2019-11-8_16-55-13.png

    I am missing something to create a node using the custom shader graph here...
     
  9. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,417
    Please let us change the background color, to something custom, I want to pick a grey color not so dark.
     
  10. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @barbelot
    I'm not sure if understood your question correctly, but are you using VFX Graph on Unity 2019.3? And the latest version. That Shader Graph support is not there in earlier versions. The versions that have Shader Graph support look like this in version 7.1.2 on Unity 2019.3.0b8.

    vfx_graph_lit_output_nodes.PNG

    See that Shader Graph field there? You just drag your shader there.

    P.S. If you think you're missing something with VFX Graph, always select some element (like a block) and then check Inspector, as many critical options appear there, which I think is something that many people are oblivious of.
     
    barbelot likes this.
  11. protoben

    protoben

    Joined:
    Nov 11, 2013
    Posts:
    39
    Thanks Andy, that worked. Here is map of an example set up using the tips from Olmi and Andybak. In this set up, Im using the users current gaze location (from a tobii eye tracker) to updated the particles they are looking at.

    upload_2019-11-9_23-52-8.png

    One thing I noticed though. This set up updates the particles as they enter the effected area as if they had been running their whole life off those new settings. So as they enter that area, they pop to that setting. Same is true as the particle leave the defined area. They pop to the original size settings.

    Can anyone think of a way to allow for the particle to tween from it's original settings to a new setting instead of pop to that new settings?
     
    andybak likes this.
  12. sergiobd

    sergiobd

    Joined:
    May 14, 2014
    Posts:
    21
    I wonder if there is any possibility to control individual vertices of a triangle output? I would like to use this to construct/deconstruct meshes.
    Any clues?
     
  13. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    > I wonder if there is any possibility to control individual vertices of a triangle output? I would like to use this to construct/deconstruct meshes.

    If they enabled position inputs for custom shaders it would be doable but I haven't heard a whisper on that front. Not sure if this aspect is extendable.

    Unity don't seem terribly interested in making SRP stuff extensible right now. I imagine they have deprioritised that side of things - understandable given how much they have taken on - but it's a real shame as the community would be helping fill in some of the functionality gaps that make HDRP/URP hard to love at the moment.
     
  14. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @protoben you could do a little bit of math there to make a fading zone? I did a small test on this just to show one way how to do it.

    Here's a video of it in action:


    Check the graph image to get some sort of idea how it's implemented; basically I create a buffer zone which starts after the set threshold, which was something like 5 meters in this test (adjustable value as you see in the video.) Then this value inside buffer zone is normalized / remapped to 0-1 range so that it can be used to drive a lerp that changes value for particle size and gradient sampling location in another case.

    VFX_Graph_change_params_gradually_2.png
     
    andybak likes this.
  15. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    56
    Is it possible to render a lit quad with soft edges? Basically, alpha threshold results in hard edges and I'm looking to have soft edges on the lit quads. -> More to resemble points that fade at the edges. Any suggestions?
     
  16. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    113
    What prevents you from using alpha blended lit quads with an alpha mask to make soft edges?
     
  17. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    56
    Can you point to any documentation or examples of how to accomplish this? Thanks!
     
  18. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @Elliott-Mitchell just apply a texture map that has an alpha channel to the Lit Quad Output context.
    Do you know how to make an transparent image? If not, it's best to go check a tutorial on the basics.

    lit_quad.PNG
     
  19. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    56
    @Olmi - Yes, I know how to make a transparent image and had the Lit Quad set up like that (which wasn't rendering) :p - FWIW, the issue ended up having to do with the system not having an update context, because of another bug having to do with the Update context (which renders incorrectly on OSX but not PC). Turns out this was a more complex issue. Thanks for your wisdom.
     
  20. NeonTheCoder

    NeonTheCoder

    Joined:
    Feb 1, 2014
    Posts:
    17
  21. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    I wonder if it's possible to do with custom blocks. Not officially supported but I managed to get something working on an older version (I need to figure out why it's broken on 7.1.2)

    https://github.com/IxxyXR/Parametric-VFX

    based on https://github.com/peeweek/net.peeweek.vfxgraph-extras

    From memory - blocks are much simpler than nodes if you can do it that way. A huge glob of hand-coded hlsl in a block might be the simplest thing.
     
  22. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @NeonTheCoder I would just try to fake the galaxy somehow, like creating spiral arms and then modulate the density with some hacks... Just the same way as you can make vortices etc. But if you're going really for a simulation, probably best to try use your own code. And you could also do it outside VFX Graph and import the results to be rendered.
     
  23. o2co2

    o2co2

    Joined:
    Aug 9, 2017
    Posts:
    17
    @ThomasVFX When do you start supporting custom nodes? Thank you
    Output node, ShaderGraph's vertex change?
     
  24. bjedlowski97

    bjedlowski97

    Joined:
    Feb 13, 2018
    Posts:
    34
    I made a blade with the vfx graph, and I want a character to swing it around and leave some particles in the air as it swings by. Much like world simulation in the regular particle systems, I keep trying to set it to world but it does seem to work, and tried to set position to local but no such thing appear for me to do it
     
  25. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    Someone solved this somewhere back on this absurdly long thread. Good luck finding it.

    Maybe if the mods hurry up and create a specific forum for VFX graph then users won't need to keep asking the same questions again and again. Page 18 and counting...
     
  26. SoloChristian

    SoloChristian

    Joined:
    Oct 9, 2012
    Posts:
    682
    So I am just starting on the VFX Graph and I download some from the FPS sample. I noticed when I used a couple of VFX with Instantiate they always play at 0,0,0 in the game, Not where I spawned them. Is there something basic I am missing???
     
  27. angelomoro

    angelomoro

    Joined:
    Sep 4, 2018
    Posts:
    13
    Hi there!

    It's there a way to create your own Position Map with an external package (Blender for instance) in order to make void spaces? something like a 3d noise for using it in the Initialize block?
     
  28. bjedlowski97

    bjedlowski97

    Joined:
    Feb 13, 2018
    Posts:
    34
    I think I had found it, but I tried to implement what they said and it didn't work
     
  29. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @tuxkhan you could probably write something that does that in Unity too, if your needs aren't super special (like capturing some liquid animation data or such.)

    And as that Set Position From Map supports both indexed lookups and 3D textures (among other things), it gives some flexibility...
     
    Last edited: Nov 19, 2019
  30. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    979
    What kind of data is Position Map ?
    Can I get vertex position data map from Blender so that I can use it?
     
  31. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    No. There was definitely a working solution because I remember trying it. (Unless I'm getting it mixed up with something else) Pretty sure it was a Unity employee that chipped in. I'll try and dig out my test project if I find the time. It was basically the world/local switch but with some small extra detail that eluded me when I tried to figure it out myself.
     
  32. protoben

    protoben

    Joined:
    Nov 11, 2013
    Posts:
    39
    Thanks Olmi!

    After looking at that example and thinking about it, I made this solution I wanted to share where I scale the intensity of the effect based on the distance particles are from the center of the effect circle.

    the formula:
    upload_2019-11-19_23-53-9.png

    upload_2019-11-20_0-15-59.png

    upload_2019-11-19_23-50-34.png

    thanks to everyone who chimed in and helped make this.
     
    Last edited: Nov 20, 2019
    Antypodish and Olmi like this.
  33. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    One thing that appears odd. You've used a distance sphere node in one place but then gone ahead and recreated your own distance using sqrt in another. You know there's multiple built-in distance nodes that can calculate that for you?
     
    Olmi likes this.
  34. angelomoro

    angelomoro

    Joined:
    Sep 4, 2018
    Posts:
    13
    I didn't knew that. I'm going to try out creating 3D Textures, thanks @Olmi
     
  35. angelomoro

    angelomoro

    Joined:
    Sep 4, 2018
    Posts:
    13
    Hei @Olmi! I've tried to attach a Texture3D to the Set Position from Map but I cannot be linked.

    upload_2019-11-20_14-56-15.png

    I've also tried to drag and drop the Texture3D from the Project folder to the Attribute Map and it says:

    Code (CSharp):
    1. Wrong Texture Dimension
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    Do you know the exact parameters of the texture accepted?

    Thanks in advance!
     
  36. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    You need to use correct mode I think, for 3D textures it has to be SAMPLE3DLOD. Then you can connect a 3D texture. Internally those position maps use RGBAFloat (afaik), if you check the code:
    Code (CSharp):
    1. positionMap = new Texture2D(count, 1, TextureFormat.RGBAFloat, false);
     
  37. protoben

    protoben

    Joined:
    Nov 11, 2013
    Posts:
    39
    I did not know that! Im happy to simplify!

    And of course I should have searched for it, this looks like it would have done most of that work in one simple node:

    upload_2019-11-20_9-30-3.png

    :p
     
  38. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @tuxkhan Now that you mentioned those maps, I thought to check how those VFX Binder things are made and can I make one myself... you could create a custom VFX Binder that does that texture creation work for you, i.e. you generate the map inside it, so there's less hassle than with some other types of setups, maybe? I never had time to check into these but they seem to be using just SetPixels so it's not really performant if you want to create thousands or a lot more positions. But I doubt that was ever the intended purpose... It will save a lot of time if compared to setting up a compute shader (easier to debug, way less boilerplate etc.) Just set up some positions, maybe generate some shapes or such, then dump that data to a map.

    Anyway. I thought it might be super complicated or somehow prevented, but looks like that's not the case; you can just copy one of them as an example and pretty much just modify it. Change a few things like name and so on, and you already get something that works. Just don't leave it in the Visual Effect Graph folder, at least here I think Unity deleted it after restart? But it seems to function ok in the project, at least in Unity 2019.3b8 and with VFX Graph 7.1.2.

    I made a quick test moment ago, this one just sets triangle vertex positions, I then render them in VEG. Sry for the choppy recording, had a few instances of Unity running here. :)

     
    Last edited: Nov 20, 2019
  39. CG_Bull

    CG_Bull

    Joined:
    Feb 12, 2017
    Posts:
    70
    Hi, I use VEG to build ParticleFX, this is a incredible tool. I have some question.
    1 : Can i give SubGraph a custom category?
    2 : Do you have any plan to move inspector and view to VEGWindow inside?
    3 : Can i open multi VEGAsset or SubGraphAsset in VEGWindow?
     
  40. bjedlowski97

    bjedlowski97

    Joined:
    Feb 13, 2018
    Posts:
    34
    So I think I found this for helping me simulate my vfx in world space, but the set position node in my graphs doesn't have that L there, is there a setting I need to change or do i need to update my hdrp to the latest one, i am currently using 5.7.2
     

    Attached Files:

  41. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    296
    i've been trying to search through this thread, and so far it seems that the only way to get an array of data into the VFX graph is through a texture. Is this always going to be the workflow, or will there be another system to feed array data into the VFX graph?

    I understand that if you are talking point clouds, or millions of data points, a texture format may work best. But what about something like a weather map? I am using NOAA weather bouy data, and have about 400 bouys that I use to populate my data set. Each bouy has about 15 readings, wind speed, wave height, air temp, as well as their location.

    I can convert the longitude/latitude to Vector3's showing their location on a sphere. That would be the RGB part of a texture, leaving me with only one other channel for additional data. I'd much rather pipe in arrays to the VFX graph, picking and choosing what data goes where. This could show wind direction, temperature as a color, etc.

    Do I need to generate multiple 2DTextures in order to use data like this?
     
  42. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    @Voronoi If you can't fit data to a single texture, I guess the answer is yes? I guess you could somehow pack your data, and then decode those values in VFX Graph. But that might be a bit tricky to say the least.

    But I've used multiple textures and it's not really that big deal. Of course it's a lot harder than if you could just type code and set data to some array in VFX Graph and so on but I've always approached visual effect stuff as something you set up, and then when it's functioning, you can feed in data, create variations and so on etc.

    You probably wouldn't need to do a different setup every day for your visualization?
     
  43. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    638
    I just upgraded to Unity 2019.3.b12... Looks like the latest VFX Graph performance has degraded a lot in some areas. A few graphs I had that were running quite well on b8 are now really laggy and pretty much unusably slow. I get sudden freezes and so on. Most likely not my system as a copy of the project was running just fine moment ago on b8. I guess I'll be heading back pretty quick.

    EDIT: Looks like Unity might be doing something on the background, as speed improved 20min later. But I couldn't see any indication if some compiling or such was going on...
     
    Last edited: Nov 25, 2019
  44. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    I'd view that as a 400x15 texture and use each row as a different data point.

    I've done this for bringing in complex data types. As long as the number of items is less than the maximum texture then it works fine. You could pack the floats into pixels to make better use of RGBA but it's probably not worth it for this amount of data.

    If you ever need more items than you can fit in a single texture row then you can do some basic modulus arithmetic to fill the texture more efficiently.
     
    Olmi likes this.
  45. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    296
    That's what I am doing after @Olmi suggestion and thinking on this a bit more. Right now I have a 400X1 texture and brought in the XYZ coordinates as RGB float values. It's not too painful now that I realize it's just one texture to deal with.

    Still, it's seems like mental gymnastics to do this in script, and then strip out the data into the VFX graph. Ideally, I could just have a custom node with the 15 values clearly labeled, and then draw lines directly to what I want the value to do. At least that's how I would do this with other node based systems.
     
  46. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    296
    This is close to working, but now I cannot figure out how to influence large streams of particles, rather than individually initializing a particle with the correct direction.

    In a script, I've create an RGBAFloat texture at 400X1, where rgb is the location on a sphere in XYZ coordinates. I'm using the A channel as the Wind direction.

    Using the Set Position from Map, set to Sequential, I get the streams of particles that I want emitting from each position on the sphere, but with no individual point control over the direction.

    I can get each position to emit in the direction the wind is going by changing the Position from Map to Index mode and cycling through the number of positions (pixels in the X direction). Using the VFX graph below, each point emits particles correctly in the direction of the wind, but only intermittantly and very slow.

    Setting the Periodic time minimum to .001 actually makes it worse, emitting fewer particles. Is there a Node that I am missing, or am I on the wrong track here?

    Screen Shot 2019-11-26 at 2.14.08 PM.png

    Edit: SOLVED

    Found it! I needed to use the Random number generator, set to Constant per Particle.

    Screen Shot 2019-11-26 at 5.37.24 PM.png
     
    Last edited: Nov 27, 2019
  47. zeekindustries

    zeekindustries

    Joined:
    Jun 4, 2010
    Posts:
    19
    Hey everyone!

    I'm doing some tests on a custom effect where our current implementation relies on reading custom attributes made in Houdini from a .pcache file.
    As of now we've succeeded in writing and wiring our custom attributes to VFX graph but we are curious if it would be possible to blend between two (or more) pCache files.

    What I have tried so far is sampling the outputs of the cache as a 2D texture but then I'm a little bit lost on how to interpret that output in order to blend between the resulting values and set the particle attributes that I need.

    Hope that explanation makes sense and if there's any chance anyone can shed some light in this matter, I'd be very grateful.

    Cheers!
     
  48. o2co2

    o2co2

    Joined:
    Aug 9, 2017
    Posts:
    17
    Using position: sequential (threedimensional) there are vertical and horizontal gaps. What is the reason for this and how can I solve it?
     
  49. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    289
    I might be misunderstanding but I've been using a simple lerp.

    So just sample your texture A and texture B and either lerp the Vector3 (if it's an x/y/z) or lerp each component (if you've packed floats into RGB).

    Have I misunderstood you?
     
  50. zeekindustries

    zeekindustries

    Joined:
    Jun 4, 2010
    Posts:
    19
    Hey Andybak! Thanks a lot for replying :D

    That's sort of the first try I gave to it, but if I sample the Point Cache as a Texture2D then I need to find a way to associate the ID of the particle with the resulting UV of the sampler (which I'd be grateful too if there's any guiding light). I was wondering if there was a way to lerp the cache files (or any texture for that matter) and plug the result in a Set [WhateverAttribute] from Map.
     
Thread Status:
Not open for further replies.
unityunity