3D Wave Interference

I was doing R&D on visualizing electromagnetism and I came up with a cool solution using volumes.

I think volumes are a great tool for 3D, especially with data-driven work. The premise for this relies primarily on three nodes, the Labs Sine Wave node, the Volume from Attribute node, and the Volume Merge / VDB Combine node.

I could not find a great way of doing it with VDBs from the start so I generated Houdini volumes and then converted them to VDBs. You can also just use Houdini volumes, there is no real need for VDBs at this stage.

First I had to create the wave, which I used a line and the Labs Sine Wave node for. Then with a little vex I turned the positional sine wave into an internal attribute called density. This gets revolved twice to make a sphere of points.

float sin = @P.z;
sin = fit(sin, -0.05, 0.05, -1, 1);
f@density = sin;
v@P.z = 0;

These points all have a sin wave with an amplitude of 1 radiating out from the center of the sphere in an attribute called f@density. This can be used to drive a volume with the Volume from Attribute node, where you need to create an empty container fog volume and use the f@density attribute in that node. The resolution of the volume has to be high (Uniform Sampling Divs) so that each point can affect its own voxel in the volume.

Because of the spherical nature of this example’s point cloud it ends up demonstrating the inverse square law with the outside having much fewer points per unit of volume than the center, and in my tests this is fine, just adjust the Uniform Sampling Divs to get a good looking volume on the outer areas of the sphere and it will end up looking good.

If you are looking for more resolution, just crank up the number of points in the original Line sop, the number of subdivisions on the Revolve sops, and then dial in the Uniform Sampling Divs in the original Volume. Also, make sure the size on the Volume is large enough to contain the point cloud.

Now you can either convert these to VDBs with the Convert node or just leave them be.

To get the intereference pattern all you need is a duplicate of this set up, but in the Labs Sine Wave node just change the settings a bit to get an out of synch wave from the original, and you can transform the volume to change the effect as well.

Then use the Volume Merge node if you are still using volumes, or the VDB Combine node if you have converted it, and with the mode set to Add (for both options) the waves will demonstrate interference behavior and give the effect shown in my flip book render above.

If you would like to take a look at the scene file you can download it here. Please tag me or reach out if you end up improving or making anything cool with this, I would love to see it.

Next
Next

Ordered POP Emission