Jump to content

info about GU_Detail::polyIsoSurface


JoshJ

Recommended Posts

I'm experimenting with creating a sop, returning a polygon mesh from an implicit function, using GU_Detail::polyIsoSurface.  The example density function works fine, returning a sphere.

 

SPHERE_FUNCTION:

static float

densityFunction(const UT_Vector3 &P, void *data)

{
// Return the signed distance to the unit sphere
return 1 - P.length();
}

However, when I change the return value so that a level set function should return a plane, I only receive empty geometry.

 

PLANE_FUNCTION:

static float

densityFunction(const UT_Vector3 &P, void *data)

{
// Return the signed distance to the unit sphere
return P.y();
//or
//return 1 - P.y();
//or
//return -P.y();
}

The bounds are set just like in the standalone example file, but in the cookMySop function:

OP_ERROR
SOP_IsoFunction::cookMySop(OP_Context &context)
{

    OP_AutoLockInputs inputs(this);
    if (inputs.lock(context) >= UT_ERROR_ABORT)
        return error();

    // Duplicate input geometry
    duplicateSource(0, context);

    // Flag the SOP as being time dependent (i.e. cook on time changes)
    flags().timeDep = 1;

    gdp->clearAndDestroy();
    UT_BoundingBox bounds;
    bounds.setBounds(-1, -1, -1, 1, 1, 1);
    gdp->polyIsoSurface(densityFunction, NULL, bounds, 20, 20, 20);

    return error();
}

Any ideas why this is returning a sphere with SPHERE_FUNCTION, but empty geometry with PLANE_FUNCTION? The levelset should be crossing the zero threshold on the xz plane, right?

 

Edit: I found that when I add a slight noise to the plane function, it appears.  But if the plane is perfectly flat, it returns empty geometry.  Strange.

Edited by JoshJ
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...