Hakeem Adam

getuffassassin11

About Me

Media Artist / Researcher
EXPERTISE
Game Artist
INDUSTRY
Gamedev

Connect

LOCATION
Germany

Houdini Skills

Availability

Not Specified

Recent Forum Posts

HDK local variables and updating the Viewport Dec. 10, 2024, 2:41 p.m.

Hello, I have been trying to implement a resampling function with the hdk. I used the SOP/SOP_Flatten.C example as a reference which has a helpful comment about using local variables and the viewport. However, I still cannot get the viewport to update when deleting points, i.e, updating my parameter. I can see the geometry spreadsheet update, but when the display flag is on the C++ node, the viewport does not update, I was wondering if anyone has encountered this issue and has any suggestions. Any help?

OP_ERROR MapResample::cookMySop(OP_Context& context)
{
    OP_AutoLockInputs inputs(this);
    if (inputs.lock(context)>= UT_ERROR_ABORT)
        return error();

    fpreal now = context.getTime();
    duplicateSource(0, context);
    setVariableOrder(3,2,0,1);
    setCurGdh(0, myGdpHandle);

    setupLocalVars();

    fpreal target = evalFloat("target", 0, now);
    target /= gdp->getNumPoints();
    

    GA_RWHandleV3 pos_h(gdp->getP());
    if (!pos_h.isValid())
        return error();
    
    UT_Array<GA_Offset> pointsToDelete;

    GA_Range pts_range = gdp->getPointRange();
    GA_Size numPoints = pts_range.getMaxEntries();

    for (GA_Iterator it(pts_range); !it.atEnd(); ++it)
    {
        GA_Offset ptoff = *it;
        GA_Index idx = gdp->pointIndex(ptoff);

        myCurPtOff[0] = ptoff;

        if (idx ==0 || idx == numPoints-1)
            continue;

        UT_Vector3 curPos = pos_h.get(ptoff);

        if (idx + 2 >=numPoints)
            continue;

        GA_Offset nextOffset = gdp->pointOffset(idx+1);
        UT_Vector3 nextPos = pos_h.get(nextOffset);

        GA_Offset secondNextOffset = gdp->pointOffset(idx+2);
        UT_Vector3 secondNextPos = pos_h.get(secondNextOffset);

        UT_Vector3 edge1 = curPos - nextPos;
        UT_Vector3 edge2 = curPos - secondNextPos;

        UT_Vector3 crossVector = cross(edge1, edge2);
        fpreal area = crossVector.length() /2.0f;

        if (area< target)
        {
            pointsToDelete.append(ptoff);
        }
        
    }
    
    for (GA_Offset i = 0; i < pointsToDelete.size(); i++)
    {
        gdp->destroyPointOffset(pointsToDelete(i));
        
    }
    resetLocalVarRefs();
    triggerOutputChanged();
    return error();
}

Procedural Biome Authoring Using Relational Data Models Aug. 20, 2023, 10:55 a.m.

Dear Fellow Houdini User, I just published a blog post on my approach to procedural biomes using relational databases. I discuss encoding and decoding data, WFC and a bit of PDG. Looking forward to any feedback, questions or comments you might have. Thank you https://hakeemadam.info/procedural-tools [hakeemadam.info]

Data-Driven Instancing Using Relational Models July 24, 2023, 3:59 a.m.

Dear Houdini Community, I just published this blog post on my approach to data-driven instancing using a relational data model. you can read it here https://hakeemadam.info/procedural-tools [hakeemadam.info] . This tool builds upon the use of UV packing in the Stack Tool demonstrated by Side FX in the Project Titan Stacking Tool by Thomas Tobin