Jump to content

"position by uv value" from hou.surface and hou.face modules.


cloudfx

Recommended Posts

Hi, I am trying to make a point deformer and I am stucked in a step.

Here is my plans

  1. copy all the points that I want to deform to the polygon object so they are 1 object using hou.geo.createPoint in python.
  2. get uv attributes from the object
  3. copy the uv attributes of first frame so it will contain the static uv value while the object is deforming.
  4. get position value from the uv and fetch the output position value to the points that I want to deform but it seems like from the uv, it's not getting the right position.

Can anybody take a look inside of this file and what step I am missing?

point copy to object python script


node = hou.pwd()
geo = node.geometry()
geo2 = node.inputs()[1].geometry()
ptGrp = geo.createPointGroup("ptGrp")

for point in geo2.points():
pos = point.attribValue("P")

pt = geo.createPoint()

pt.setAttribValue("P" , pos)

ptGrp.add(pt)[/CODE]

[b]get position by uv and fetch to the original points script[/b]

[CODE]
node = hou.pwd()
geoPdef = hou.pwd().geometry()
geoAnim = node.inputs()[1].geometry()

fPtGrp = geoAnim.findPointGroup("ptGrp")
ptsGrp = fPtGrp.points()
i = 0
for point in geoPdef.points():
pt = ptsGrp[i]
ppos = pt.attribValue("P")
nprim = geoAnim.nearestPrim(ppos)[0]
u = pt.attribValue("uv")[0]
v = pt.attribValue("uv")[1]
pos = nprim.positionAt(u)
point.setAttribValue("P" , pos)
i += 1 [/CODE]

test.hip

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