alinakipoglu
alinakipoglu
About Me
Connect
LOCATION
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Generate voxel volume of mesh (HDK) Feb. 28, 2013, 10:58 a.m.
Ok! Got it. You can find procedure below. It will convert meshes into fog volumes.
OP_ERROR SOPNODE::cookMySop( OP_Context &context_ )
{
if( lockInputs( context_ ) >= UT_ERROR_ABORT )
{
return error();
}
duplicateSource( 0, context_ );
UT_BoundingBox bbox;
GU_SDFParms sdfParms;
GU_SDF sdf;
gdp->getBBox( &bbox );
sdfParms.setMode( GU_SDFParms::RAY_INTERSECT );
sdfParms.setDivisions( 100, 100, 100 );
sdfParms.setBBox( bbox );
sdfParms.setLaserScan( true );
sdfParms.setFixSigns( true );
sdfParms.setSweepCount( 3 );
sdfParms.setSweepThreshold( 2.0f );
sdf.build( gdp, sdfParms );
gdp->clearAndDestroy();
GU_PrimVolume *volumePtr = (GU_PrimVolume *)GU_PrimVolume::build( gdp );
UT_VoxelArrayIteratorF vit;
vit.setArray( sdf.getFunction() );
for( vit.rewind(); !vit.atEnd(); vit.advance() )
{
vit.setValue( vit.getValue() <= 0.0f ? 1.0f : 0.0f );
}
volumePtr->setVoxels( sdf.getFunction() );
unlockInputs();
return error();
}
OP_ERROR SOPNODE::cookMySop( OP_Context &context_ )
{
if( lockInputs( context_ ) >= UT_ERROR_ABORT )
{
return error();
}
duplicateSource( 0, context_ );
UT_BoundingBox bbox;
GU_SDFParms sdfParms;
GU_SDF sdf;
gdp->getBBox( &bbox );
sdfParms.setMode( GU_SDFParms::RAY_INTERSECT );
sdfParms.setDivisions( 100, 100, 100 );
sdfParms.setBBox( bbox );
sdfParms.setLaserScan( true );
sdfParms.setFixSigns( true );
sdfParms.setSweepCount( 3 );
sdfParms.setSweepThreshold( 2.0f );
sdf.build( gdp, sdfParms );
gdp->clearAndDestroy();
GU_PrimVolume *volumePtr = (GU_PrimVolume *)GU_PrimVolume::build( gdp );
UT_VoxelArrayIteratorF vit;
vit.setArray( sdf.getFunction() );
for( vit.rewind(); !vit.atEnd(); vit.advance() )
{
vit.setValue( vit.getValue() <= 0.0f ? 1.0f : 0.0f );
}
volumePtr->setVoxels( sdf.getFunction() );
unlockInputs();
return error();
}
Generate voxel volume of mesh (HDK) Feb. 28, 2013, 4:41 a.m.
Im still looking for insights :roll:
Generate voxel volume of mesh (HDK) Feb. 27, 2013, 4:48 a.m.
anybody knows something about GU_SDF?