[Sidefx-houdini-list] HDK - help with volumes

Andy Milne Andrew.Milne at disneyanimation.com
Tue Mar 15 19:44:34 EDT 2011


I tried your code, and it doesn't crash for me.  How do you 
get it to crash, just change frames?  What version of 
Houdini are you using?  I'm on 11.0.646

Andy Milne

On 03/15/2011 03:32 PM, Vincent Houzé wrote:
> Sorry, forgot to add the link, it's the same as before
> http://forums.odforce.net/index.php?/topic/11677-how-can-i-delete-gu-primvolume/page__gopid__80497&#entry80497
>
> Vincent
>
> 2011/3/15 Vincent Houzé<vince.houze at gmail.com>:
>> Thanks for the answer.
>> I did try this but I still get the segmentation fault on gdp->clearAndDestroy().
>> I tried gdp->deletePrimitive(0) with the same result, and also
>>
>> volume = (GEO_PrimVolume *)gdp->appendPrimitive(GEOPRIMVOLUME); to
>> build the volume
>> This also crashes, but outside of the cookMySop() function.
>>
>> I've posted the whole source files on the odforce forum if you want to
>> check it out!
>>
>> Thanks a lot
>> Vincent
>>
>> 2011/3/15 Andy Milne<Andrew.Milne at disneyanimation.com>:
>>> I've done a little work with volumes.  I have some code that looks similar
>>> to yours, except that instead of using the voxelHandle directly, I get the
>>> voxel array from the voxel handle and set it using an iterator.  I don't
>>> remember why I did it that way, but you might try this to see if it helps.
>>>   This is in a SOP, and it calls gdp->clearAndDestroy() without any crash.
>>>
>>>     GU_PrimVolume *vol =
>>>         dynamic_cast<GU_PrimVolume*>( GU_PrimVolume::build( gdp ) );
>>>     UT_VoxelArrayWriteHandleF voxelH =
>>>         vol->getVoxelWriteHandle();
>>>     UT_VoxelArrayF *voxels =&(*voxelH);
>>>     voxels->size( counts.x, counts.y, counts.z );
>>>     UT_VoxelArrayIteratorF vit( voxels );
>>>     vit.setCompressOnExit( true );
>>>     for ( vit.rewind(); !vit.atEnd(); vit.advance() ) {
>>>         phi = grid[vit.x()][vit.y()][vit.z()];
>>>         vit.setValue( phi );
>>>     }
>>>
>>>
>>> For an overview of what the GU_, GB_, GD_ prefixes mean, see:
>>> http://www.sidefx.com/docs/hdk11.0/hdk_geometry_intro.html#HDK_Geometry_Intro_Classes
>>> UT_ is just "utilities"
>>>
>>>
>>>
>>>
>>> Andy Milne
>>>
>>> On 03/14/2011 03:38 PM, Vincent Houzé wrote:
>>>> 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!
>>>> _______________________________________________
>>>> Sidefx-houdini-list mailing list
>>>> Sidefx-houdini-list at sidefx.com
>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list