Jump to content

Hongzhu

Members
  • Content count

    2
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Hongzhu

  • Rank
    Peon

Personal Information

  • Name
    Hongzhu Zhao
  • Location
    Pittsburgh
  1. So I'm still building some microsolver nodes for water simulation. I noticed that all the microsolver I made including the Gas Add from the HDK sample all have a grey input point on the left. All built-in in gas node do not. Seems like this doesn't effect the execution result but I'm still curious how do I make a node that looks exactly like the built-in ones. And also, enable bypass on these nodes doesn't seem to work. Do I need to manually skip in solveGasSubclass()?
  2. I'm learning HDK and fluid sim by swapping out microsolver nodes in Houdini's built in FLIP solver. I've successfully changed the GasExternalForce node to my simple gravity node. It works okay but there's a small problem that bugs me a lot. So here's the implementation in the built in solver: There's a gravity node in the Auto DOP network (looks like the order doesn't really matter. I tried putting the gravity node before the flipsover and nothing changed.) And then in the flipsolver there's a GasExternalForces microsolver that apply forces on the particles. I deleted the gravity node and changed the GasExternalForces node to my implementation: bool SIM_HZExternalForce::solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep) { SIM_Geometry* geo = (SIM_Geometry*)obj->getGeometry(); if (!geo) { return false; } GU_DetailHandle gdh = geo->getOwnGeometry(); const GU_Detail* gdp_in = gdh.readLock(); // Must unlock later GU_Detail* gdp_out = gdh.writeLock(); GA_RWAttributeRef p_ref_vel = gdp_out->findPointAttribute("v"); GA_RWHandleT<UT_Vector3F> p_vel(p_ref_vel.getAttribute()); if (p_vel.isInvalid()) { return false; } for (GA_Iterator it(gdp_out->getPointRange()); !it.atEnd(); it.advance()){ int pid = it.getOffset(); UT_Vector3F vel = p_vel.get(pid); vel[1] -= timestep * 9.80665f; p_vel.set(pid, vel); } gdh.unlock(gdp_out); gdh.unlock(gdp_in); // Successful cook return true; } The problem is, the velocities in the first frame are all zero in the official implementation: But in my implementation, the velocities got changed in the first frame: I really want to know where this discrepancy comes from. Any suggestions? I've uploaded the source code and scene file if anyone is interested. GravityTest.zip
×