[Sidefx-houdini-list] HDK - help with volumes
Vincent Houzé
vince.houze at gmail.com
Mon Mar 14 18:38:18 EDT 2011
Hi,
I'm trying to port my Cuda fluid solver (http://vimeo.com/20625705) to Houdini.
I want to do it as a black box sop first, because it seems easier, and
faster as well, from what I have read.
I had a first successful try copying values to the color attributes on
primitives, but now I'd like to fill a volume primitive.
The code from the gengeovolume sample works on the first cook (I
modified the SOP_star example) :
GU_PrimVolume *volumeGdp = (GU_PrimVolume *)GU_PrimVolume::build(gdp);
UT_VoxelArrayWriteHandleF voxelHandle = volumeGdp->getVoxelWriteHandle();
voxelHandle->size(global_grid.grid_x, global_grid.grid_y, global_grid.grid_z);
.......
voxelHandle->setValue( x, y, z, phi);
but on the next one gdp->clearAndDestroy() causes Houdini to crash,
which is already described in this forum post
http://forums.odforce.net/index.php?/topic/11677-how-can-i-delete-gu-primvolume/page__gopid__80497&#entry80497
but wasn't answered.
I had another try, this time I create a volume sop and I want to
modify the volume primitive instead of creating it, avoiding the
clearanddestroy().
But no success either.
with
pprim = gdp->primitives().head();
volume = (GU_PrimVolume *)pprim;
UT_VoxelArrayWriteHandleF handle = volume->getVoxelWriteHandle();
the handle seems correct, but I get a crash with the first setValue().
It seems related to the compression of the tiles (only difference
between the volume I create from scratch and the volume I get from a
volume sop is myDitherType set to "DITHER_ORDERED", and the crash
occurs in UT_VoxelTile::uncompress(), called by setValue().
The docs don't say much, except access to the tiles should be transparent.
Thanks a lot for any help/a working example,
Vincent
PS : also what do the GU_, GB_, GD_, UT_ prefixes mean ? The docs
don't say, maybe it would help me understand the inheritance diagram
which don't make much sense right now to me!
More information about the Sidefx-houdini-list
mailing list