stevegh Posted June 29, 2015 Share Posted June 29, 2015 (edited) So I have a circle I am sweeping along a curve, and I am assigning UVs to points with a simple attribWrangle with f@u = float(@ptnum)/float(@numpt-1); on the circle and f@v = float(@ptnum)/float(@numpt-1) on the curve and then a v@uv.x = @u; v@uv.y = @v; and this works great except for the seam 1>0. Obviously I want to be using vertex attributes for UVs, and when I throw a UVProject on a tube I see that verts are indexed by prim # then vert #. How could I go about assigning UVs in a similarly simple matter but to vertices where for example my 0:0 vertex @uv.x = 1.0 and 7:1 @uv.x = 0.0, which are both point 0? Am I doing it wrong? Thanks! Edited June 29, 2015 by stevegh Quote Link to comment Share on other sites More sharing options...
fathom Posted June 30, 2015 Share Posted June 30, 2015 (edited) use "vtxnum" instead of "ptnum" (and iterate over vertices and not points in your attribWrangle). edit: hmm... rethinking this. edit again: okay, well, "vtxnum" and "numvtx" would work for a single primitive, but i dunno a good way if you have multiple prims using vex. Edited June 30, 2015 by fathom Quote Link to comment Share on other sites More sharing options...
stevegh Posted June 30, 2015 Author Share Posted June 30, 2015 Heh, yea I just ended up doing it in a python SOP in a very non pythonic way. Set xsec and ysec on the cross section and backbone of the sweep, attribTransfer the ysec over to the result and chuck this in a python SOP: node = hou.pwd() geo = node.geometry() xsec = geo.attribValue("xsec") ysec = geo.attribValue("ysec") for y in range(ysec-1): for x in range(xsec): prim = x + (y*(xsec)) xinc = 1.0 / (xsec) yinc = 1.0 / (ysec-1) geo.globPrims(str(prim))[0].vertices()[0].setAttribValue("uv", (x*xinc, y*yinc, 0)) geo.globPrims(str(prim))[0].vertices()[1].setAttribValue("uv", ((x+1)*xinc, y*yinc, 0)) geo.globPrims(str(prim))[0].vertices()[2].setAttribValue("uv", ((x+1)*xinc, (y+1)*yinc, 0)) geo.globPrims(str(prim))[0].vertices()[3].setAttribValue("uv", (x*xinc, (y+1)*yinc, 0)) Not pretty but works for me. Thanks anyways! Quote Link to comment Share on other sites More sharing options...
kgoossens Posted June 30, 2015 Share Posted June 30, 2015 Another workaround you can do is Unroll the circle before sweeping using the ends node. Then after applying your uv's you can promote the uv point attribute to a uv vertex attribute using the attribute promote node then fuse the points together. Quote Link to comment Share on other sites More sharing options...
stevegh Posted June 30, 2015 Author Share Posted June 30, 2015 @Kim yup that works as well! Thanks! Quote Link to comment Share on other sites More sharing options...
kgoossens Posted June 30, 2015 Share Posted June 30, 2015 And yet another method Sweep-02.hipnc 1 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.