How to use advection?

100 views
Skip to first unread message

Alessandro Mastronardi

unread,
Mar 19, 2022, 7:38:22 AM3/19/22
to OpenVDB Forum
Hello, after following a partial example here: https://www.openvdb.org/documentation/doxygen/codeExamples.html#sModifyingGrids (Advecting Points section), I've been trying to implement advection using a gravity velocity field. The resulting vdb is just the initial one, and I can't understand what I'm doing wrong. There is really little information around, anyone can help me? Here is the code I've so far:

openvdb::points::PointDataTree::Ptr pointTree(new openvdb::points::PointDataTree(grid->tree(), 0, openvdb::TopologyCopy()));
    openvdb::points::PointDataGrid::Ptr points = openvdb::points::PointDataGrid::create(pointTree);  // get the PointDataGrid from the initial FloatGrid
  auto gravity = openvdb::Vec3SGrid::create(openvdb::Vec3s(0, -9.81, 0));  // Create an empty velocity grid with gravity as background value
    openvdb::points::advectPoints(*points->create(), *gravity, 4, 1.0 / 24.0, 1000); //  Advect points in-place using gravity velocity grid

Thanks for any suggestion.
Reply all
Reply to author
Forward
0 new messages