redpaw

redpaw

About Me

Connect

LOCATION
Not Specified
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

HDK create new AgentShapeDeformer 2025年7月10日17:13

Ok! so fundamental question about the "packed agent" eval/draw on crowds..

What I'm ultimately after is being able to swap out the agentShapedeformer on particular shapes after the
Agent is set up.. Is this possible without unpacking the agent?

For example if I were to swap linearskinning to blendshape on a specific agent?
What node / workflow could I use to do this? Can I do this with an attribute?


I have a test agent, being scattered a few times using crowd source. everything looks good in linearskinning default.


Right now the only thing that has worked, is using an agentLayer node after, and changing the "shapeDeformer" in the
"use existing shapes/shapebinding" multiparm to set the shape deformer to "blendshape".
This seems to work as the agent returns to the t-pose origin in the viewport.

However when I try to change it to my custom "myDeformer" it continues to show the linear skinning in the viewport,
I have print statements as you can see above when "deform" and "computebounds" are called... and neither seem to get called.

They DO get called if I "agent_unpack" after the agentLayer node however. The viewport shows the mesh at the origin in T-pose as I would expect, since I'm not doing anything yet in "mydeformer". Also if unpacking, you can notice changes in skinning between linear and dualquat as well for example, but no changes before the unpack.

Is this something related to a draw override when agents are packed, that they only evaluate linear or blendshape ? I know that there's an OpenGL version of linearskinning that is used for fast viewport display, but I wasn't aware of blendshape also having an override for that as well? It seems like packedAgent = "use OpenGL shapedeformer display"? Is this whats going on?

Is there a way around this even if its slower to draw? something that allows disabling of the OpenGL override? Ideally on a per agent basis?


thanks for any information!

HDK create new AgentShapeDeformer 2025年7月8日21:19

Gah.. I was missing this :

void GUregisterAgentShapeDeformer(void*)
{....

HDK create new AgentShapeDeformer 2025年7月8日20:30

Thank you! I am so close with this.. but it doesn't seem to be registering to the list of deformers yet...
I'm trying to check this with the python command: (and looking in the pulldown menu on the agentLayers node)

import hou

deformers = hou.crowds.shapeDeformers()
print(deformers)

Here's what I have

<HEADER FILE>
class MyAgentDeformer : public GU_AgentShapeDeformer
{
public: 
    MyAgentDeformer(const UT_StringHolder &name);
    ~MyAgentDeformer();
    const UT_StringHolder name(); 

    void deform(GU_Detail &gdp, const GU_AgentShapeLib::Shape &src_shape, exint xform_idx, const GU_Agent &src_agent) const override;
    
private:
    
    UT_StringHolder myName;
  
};

<CPP>
MyAgentDeformer::MyAgentDeformer(const UT_StringHolder &name):GU_AgentShapeDeformer(name) 
{
    cout <<  "creating MyAgentDeformer" << endl;
}
MyAgentDeformer::~MyAgentDeformer() {}


const UT_StringHolder MyAgentDeformer::name() 
{
    cout << "setting name to MyAgentDeformer" << endl;
    MyAgentDeformer::myName = "MyAgentDeformer"; 
    return myName; 
}


void  MyAgentDeformer::deform(GU_Detail &gdp, const GU_AgentShapeLib::Shape &src_shape, exint xform_idx, const GU_Agent &src_agent) const  
{
  // do stuff here
    cout <<  "deform called" << endl;
}

void GUregisterAgentShapeDeformer()
{
    cout  <<  "calling register agent shape deformer" << endl; 
    UT_StringHolder name = "MyAgentDeformer";
    GU_AgentLayer::registerDeformer(UTmakeIntrusive<MyAgentDeformer>(name));
}