Feedback Wanted: Visual Effect Graph

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.

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:
5193657--516191--upload_2019-11-19_23-53-9.png

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

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

thanks to everyone who chimed in and helped make this.

2 Likes

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?

1 Like

I didn’t knew that. I’m going to try out creating 3D Textures, thanks @Olmi

Hei @Olmi ! I’ve tried to attach a Texture3D to the Set Position from Map but I cannot be linked.

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

Wrong Texture Dimension
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!

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:

positionMap = new Texture2D(count, 1, TextureFormat.RGBAFloat, false);

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:

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

:stuck_out_tongue:

@angelomoro 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. :slight_smile:

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?

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

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?

@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?

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…

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.

1 Like

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.

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?

Edit: SOLVED

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

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!

Using position: sequential (threedimensional) there are vertical and horizontal gaps. What is the reason for this and how can I solve it?

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?

Hey Andybak! Thanks a lot for replying :smile:

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.