Jump to content

Generate Volumes from Meshes with HDK


Recommended Posts

Are you trying to output a fog volume or SDF? Offhand, you should be able to double-check your GU_SDFParameters by using an IsoOffset SOP to confirm that the volume generated is what you expect. It should be fairly obvious as to which parameters on that node map to the ones in GU_SDFParameters.

The HDK is a deep library and quite frankly, (at least) I'm reluctant to help anyone out unless they've shown that they're competent in programming and C++. Looking at your other post, it looks like you have the right idea in the use of GU_SDF but I'm unfamiliar with how to write proper mantra procedurals.

Link to comment
Share on other sites

Hi Edward

Thank you very much. I used IsoOffset values in GU_SDF. I wonder why this is happening. Im getting only a small volume cube rendered even with a wrong bbox (fair to smaller then original input). Im fairly comfortable with cpp and if you tell me how to use SDF in a proper way i hope i can fix this problem. Why sesi didn't provides any example for this :/

Edited by alinakipoglu
Link to comment
Share on other sites

Sorry, I don't understand what you are saying. Are you getting the expected volume when using the IsoOffset SOP? If yes, then you should try to replicate this in your own custom SOP and verify that you can reproduce what the IsoOffset SOP does. Once you get this to work, then you will have your answer (on how to generate volumes from meshes in the HDK).

Link to comment
Share on other sites

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();
}
[/CODE]

Link to comment
Share on other sites

Ok! Got it. You can find procedure below. It will convert meshes into fog volumes.

Er, I don't think you ever quite mentioned that you wanted a fog volume? SDF stands for Signed Distance Field, so why would it ever generate a fog volume? :)

  • Like 1
Link to comment
Share on other sites

Edward, I know what it is. To get Fog volume i needed that first. This is why i posted both..

I know my explanation text has some issues. Maybe its not clear. Im doing my best.

Actually your contribution to this post again not for helping either!

Anyway thank you for your comments.

Edited by alinakipoglu
Link to comment
Share on other sites

Actually your contribution to this post again not for helping either!

Are you serious? Edward's one of the developers and he's trying to help you out of his own charity. Yet you sound like you are entitled to getting your problem solved. You should be glad he even bothered to reply IMO.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...