JoshJ Posted September 12, 2015 Share Posted September 12, 2015 (edited) 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 September 13, 2015 by JoshJ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.