Showing posts with label vdb. Show all posts
Showing posts with label vdb. Show all posts

Monday 25 September 2023

resolving intersections between multiple closed objects (like cushions)

to summarise - convert to vdb, do a volume point sample. multiply the normal of the geo by the volume sample and then add back to the original position. It should push in -or out- for a packed cushiony effect.

nicely demo'd here by Emīls Geršinskis - Ješinskis
https://www.youtube.com/watch?v=2yGxLHSYf8I

Wednesday 31 March 2021

flickering pyro - especially after converting particles to vdb

 Say you've made some nice particles and you give them density/burn/temperature and then convert these to VDB fields. You might find they flicker ever so slightly during rendertime. This is to do with a changing grid size. The "fix" is to make a gigantic box shaped VDB that encompasses the area of your particles/sim and plug this into the second input of the VDB from Particles node. Now the grid is fixed and you shouldn't have any more related flickering!

Pro tip from Walter.

Friday 25 October 2019

blurring vdbs

float dist = xyzdist(1,@P);

float distremap = fit(dist,ch("near"),ch("far"),0,1);

f@density *= distremap;


This gives a vdb a falloff based on how close it is to the original object's surface.
Stick the VDB into a volume visualisation and then plug that into input 0
Put the original geo into input 2.

Now you can "blur"

Friday 23 June 2017

latticing VDBs/volumes

Bring in your VDB however you need to.
Plug it into a VolumeVOP and create an addpoint node. Plug P into the ptvalue input.
Next create a setattrib node and plug your addpoint's ptnum output into the setattrib's i1. Plug your density into the value node and name the parameter "density". Jump back out of the VOP.

This will have made a volume grid of points that represent your VDB, each containing the corresponding density value. The number of points created is dependent on the resolution of your VDB, although I guess you could duplicate points and hope that they interpolate nicely?

Next, add a Timeshift node after the VOP and freeze your volume at the point you think it occupies the most space. Eg. if it's a trail of cigarette smoke, it's last frame. Create a Bound node for this.
This is now the lattice you can transform and deform.
Then make a Lattice node and plug your Volume VOP into the first input, the output of the Bound into the 2nd and then finally whatever your transform/deforms are into the 3rd.

So far, we've transformed a bunch of points, that hold our density values.. Now we have to recreate our volume..


Connect a Bound node to your deformed points. We're making an empty volume that encompasses the limits of your deformed sequence. Add an Iso Offset to this, set the Output Type to Fog Volume, Mode to Ray Intersect and name it Density. You control the effective resolution with the sampling. Next let's copy the density back into your empty volume.

Make a volume VOP, plug the Iso Offset into the first input & the lattice into the second. Jump in and make a Point Cloud Open node. Connect the P to the P and the OpInput2 into the File input.
Create a Point Cloud Filter and set it's signature to Float Channel and label the Channel "density". Plug the Point Cloud Open's handle into the Point Cloud Filter's handle input. Finally plug the value into the volumevopoutput's Density..

Your blank volume now has a deformed version of the original's density!
Sit back, relax and pretend you're resimming now.

Saturday 3 December 2016

FLIP volume velocity field (again)

Create a VDB with desired turbulence/noise in whichever way you fancy. Make sure the vdb is called "vel". Keeps things neater..

Inside the FLIP autodopnetwork, use a Source Volume node to bring in your velocity vdb. Scale & Temperature can be ignored. Be sure to uncheck the velocity "mask" and set the volume operation to "add".


Thursday 20 October 2016

Checking if a point is inside a volume

This can be done with a point wrangle, but for those that prefer VOPs...

create a point VOP, connect the geometry you wish to test into the first input. connect the volume you want to test with into the second.

Enter the VOP, create a volumesample. Connect P and OpInput2 into this node.
The value it returns (bind export this to something) indicates how "deep" within the volume the point is. A negative value means the point is within the volume & a positive value means it is outside of the volume.

reliable(r) collision objects in FLIP

The deforming object shelf button serves most collision purposes, even for static objects (turn off use deforming objects) but sometimes it doesn't quite cut it.

Add a trail node, set to "calculate velocity" to your moving geometry.
Create a VDB from polygons node, setting the name of the volume to "collision" and add a point attribute at the bottom, choosing the "v" as the option. Name this "collisionvel". These names are defaults in Houdini.

In your FLIP sim dop-network, add a "volume source". Set the initialisation to "collision" and navigate the SOP path to the VDB you made earlier. Set the scale to -1, because that's how the maths work..and change the velocity to whatever you want..1 is probably sensible.
Finally plug the volume source into the "volume" connection tab of the Flip solver.

That should be it.

Tuesday 4 October 2016

velocity volume fields like Maya

It's possible to make a piece of geometry, pump it through a PointVOP and give it some velocity, using constants, curl noise or whatever method you like.
Then convert the polygon to a VDB, using the V point attribute. Name the field "vel".

Within POPs/dynamic network use an advect with volume operator. The defaults should keep the velocity's affect within the volume created.

If this doesn't work as expected you might need to use a Geometry Wrangle (within the POP/Flip/dynamics)
Using the code below, you'll want to set the 2nd input (in the input tabs) to the velocity volume created earlier.

vector vel = volumesamplev(1,0,@P);

v@force += vel * ch("scale");

v@a = vel;

Basically we're affecting the velocity via a force, rather than adding directly to it - to avoid overly strong changes in velocity. We also have extra control with a scale slider & the "a" attribute is a little debug value to watch out for in the Geometry Spreadsheet.
Note - you might have to really crank up the velocity values, depending on the current velocity of the existing particles/fluid/whatever.

*NOTE* The Geometry Wrangle should be plugged into the particles tab of the solver! (2nd one)

Monday 26 September 2016

sticky fields Houdini

Enable Sticky in the Flip Solver.
Create sticky attributes using point wrangle (f@stick=1;) and paint (replace Cd with stick).
VDB from polygons, using the attribute at the bottom of the node.

in the flip solver, add a SOP-scalar-field node and change the data at the bottom to "stick".

Thursday 22 September 2016

bounding box group node for faster VDB meshing

Group points, turn off numeric, enable bounding points & change bounding type to points only.
Blast away particles before VDB evaluation to save on computation time.

Tuesday 20 September 2016

particle velocity to VDB fog/volume

particles, run a pointVop taking length of velocity and fit ranging them (min max to 0 and 1)
Plug new values into pscale.

VDB from particles, select fog, set minimum particle radius to 0.

should have a VDB mask ready for the faster parts of the sim.