Hello!
I'm working on a GPU based Fluid Engine. I have a Fluid Voxel Mesh that is simulated on the GPU via a Compute Shader. I'm writing information about the mesh to textures and using those in the VFX Graph to create a few visualizations for the mesh. I've successfully created a VFX that visualizes the mesh using cubes with the color of each cube set based on the velocity of each voxel, so I know my basic approach works. What I'm struggling with is creating a visualization that instantiates an Arrow mesh at each voxel location and points in the direction of the voxel's velocity.
If I don't do anything to the velocities and just write them directly to the texture, all of my arrows point in the default direction of the mesh. I assume this is because the velocities are all rather small (e.g. [0.0003, 0.02, -0.34]) and/or not properly formatted for the node they're being used in. Each component of the vector tends to be between -1 and 1. I've also tried scaling them and converting them to degrees and I do end up getting rotated arrows but they don't accurately represent the velocity.
I'm using Render Textures with the ARGBFloat format to allow non-clamped and negative values to be written/retrieved.
Here's my VFX Graph setup: ![alt text][1]
I've tried working with a number of different nodes for setting the orientation of the arrows but the SetAngle.XYZ from Map node has given me results closest to what I'm expecting.
What I'm hoping one of you clever folk might be able to help me with is converting the velocity vectors into vectors that can be properly utilized by the SetAngle.XYZ node. I would like to avoid performing the conversion on the CPU, so the conversion would preferably take place in the compute shader.
If this approach is completely missing the mark, I'm more than open to alternatives as well.
I'm using Unity 2021.3.1f1 and VFX Graph 12.1.6 [1]: /storage/temp/204585-voxelarrowdirections-vfxgraph.png
I'm working on a GPU based Fluid Engine. I have a Fluid Voxel Mesh that is simulated on the GPU via a Compute Shader. I'm writing information about the mesh to textures and using those in the VFX Graph to create a few visualizations for the mesh. I've successfully created a VFX that visualizes the mesh using cubes with the color of each cube set based on the velocity of each voxel, so I know my basic approach works. What I'm struggling with is creating a visualization that instantiates an Arrow mesh at each voxel location and points in the direction of the voxel's velocity.
If I don't do anything to the velocities and just write them directly to the texture, all of my arrows point in the default direction of the mesh. I assume this is because the velocities are all rather small (e.g. [0.0003, 0.02, -0.34]) and/or not properly formatted for the node they're being used in. Each component of the vector tends to be between -1 and 1. I've also tried scaling them and converting them to degrees and I do end up getting rotated arrows but they don't accurately represent the velocity.
I'm using Render Textures with the ARGBFloat format to allow non-clamped and negative values to be written/retrieved.
Here's my VFX Graph setup: ![alt text][1]
I've tried working with a number of different nodes for setting the orientation of the arrows but the SetAngle.XYZ from Map node has given me results closest to what I'm expecting.
What I'm hoping one of you clever folk might be able to help me with is converting the velocity vectors into vectors that can be properly utilized by the SetAngle.XYZ node. I would like to avoid performing the conversion on the CPU, so the conversion would preferably take place in the compute shader.
If this approach is completely missing the mark, I'm more than open to alternatives as well.
I'm using Unity 2021.3.1f1 and VFX Graph 12.1.6 [1]: /storage/temp/204585-voxelarrowdirections-vfxgraph.png