Im trying to generate volumes from geometry inputs. Is there a way to achieve this goal using HDK?.
I tried using GU_SDF and i posted my process on separate topic. The docs for it lacks any walk through and i got stuck.
Is there any one can point me to right direction?
Any suggestions?
Generate voxel volume of mesh (HDK)
2985 3 0- alinakipoglu
- Member
- 10 posts
- Joined: 7月 2012
- Offline
- alinakipoglu
- Member
- 10 posts
- Joined: 7月 2012
- Offline
- alinakipoglu
- Member
- 10 posts
- Joined: 7月 2012
- Offline
- alinakipoglu
- Member
- 10 posts
- Joined: 7月 2012
- Offline
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();
}
-
- Quick Links