# twist setting

 04 April 2013 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA twist setting Looking to solve my twist issue in the math equation? Thank you for the help guys. Below is a function I'm using to generate verts between a start and end radius of verts. The twist function is collapsing the verts instead of retaining it's volume. The problem lies in my math question below somewhere. I looking for some help. `````` fn genTweenSegs numHeightSegs:0 startHeight:0.0 maxHeight:0.0 startVerts:#() endVerts:#() biasHeight:0.0 powerHeight:0.0 biasRad:0.0 powerRad:0.0 = ( local tmpVerts = #() for eachSeg = 1.0 to numHeightSegs-1 do ( f = eachSeg/numHeightSegs h = maxHeight*(fastValue f bias:biasHeight power:powerHeight)+startHeight for v = 1 to startVerts.count do ( bottomRadius = startVerts[v] topRadius = endVerts[v] r = bottomRadius + (topRadius - bottomRadius)*(fastValue f bias:biasRad power:powerRad) mPos = [r[1],r[2],h] append tmpVerts mpos ) ) return tmpVerts )`````` __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com share quote
 04 April 2013 denisT MAX Doctor   portfolio Denis Trofimov CA, USA i don't have time to debug your code now, but here is a function that does do twist: `````` fn twistPolyAboutZ node angle:45 = if iskindof node editable_poly do ( tm = node.objecttransform itm = inverse tm bb = nodeGetBoundingBox node tm for v=1 to node.numverts do ( p = (polyop.getvert node v) * itm a = (bb[2].z - p.z)/(bb[2].z - bb[1].z)*angle t = p * (rotatez (matrix3 1) a) * tm polyop.setvert node v t ) update node ) delete objects c = cylinder radius:20 height:40 heightsegs:8 sides:24 wirecolor:orange pos:[10,10,10] rotation:(eulerangles 40 20 50) twistPolyAboutZ (converttopoly c) angle:45 c = cone radius1:20 radius2:5 height:40 heightsegs:8 sides:24 wirecolor:green pos:[-10,-10,-10] rotation:(eulerangles -40 -20 -50) twistPolyAboutZ (converttopoly c) angle:90`````` share quote
 04 April 2013 denisT MAX Doctor   portfolio Denis Trofimov CA, USA here is an expended version for all three axis ``````fn twistPoly node angle:45 axis:#z = if iskindof node editable_poly do ( k rotate = case axis of ( #x: (k = 1; rotatex) #y: (k = 2; rotatey) #z: (k = 3; rotatez) ) tm = node.objecttransform itm = inverse tm bb = nodeGetBoundingBox node tm for v=1 to node.numverts do ( p = (polyop.getvert node v) * itm a = (bb[2][k] - p[k])/(bb[2][k] - bb[1][k])*angle t = p * (rotate (matrix3 1) a) * tm polyop.setvert node v t ) update node ) delete objects c = cylinder radius:20 height:40 heightsegs:8 sides:24 wirecolor:orange pos:[10,10,10] rotation:(eulerangles 40 20 50) twistPoly (converttopoly c) angle:65 axis:#x c = cone radius1:20 radius2:5 height:40 heightsegs:8 sides:24 wirecolor:green pos:[-10,-10,-10] rotation:(eulerangles -40 -20 -50) twistPoly (converttopoly c) angle:180 axis:#z twistPoly c angle:45 axis:#y`````` share quote
 04 April 2013 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA I ended up messing with it a bit last night and I got a similar setup. I'm going to add bias and what not to this as well. I'll post that version. __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com share quote
 04 April 2013 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA Denis Denis here is an idea. I've taken your script and added just a few lines to show what a bend would look like. How would the function be modifier to replicate that of the actual bend modifier, assuming the base pivot of the rotation is always at the base center of the object like in the example? `````` fn twistPoly node angle:45 axis:#z = if iskindof node editable_poly do ( k rotate = case axis of ( #x: (k = 1; rotatex) #y: (k = 2; rotatey) #z: (k = 3; rotatez) ) tm = node.objecttransform itm = inverse tm bb = nodeGetBoundingBox node tm for v=1 to node.numverts do ( p = (polyop.getvert node v) * itm a = (bb[2][k] - p[k])/(bb[2][k] - bb[1][k])*angle t = p * (rotate (matrix3 1) a) * tm polyop.setvert node v t ) update node ) delete objects c = cylinder radius:10 height:40 heightsegs:8 sides:24 wirecolor:orange pos:[0,0,0] rotation:(eulerangles 0 0 0) twistPoly (converttopoly c) angle:90 axis:#x c = cylinder radius:10 height:40 heightsegs:8 sides:24 wirecolor:orange pos:[0,60,0] rotation:(eulerangles 0 0 0) addmodifier c (bend angle:90 direction:90)`````` __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com share quote
 04 April 2013 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA simplified for testing use for testing `````` ( local startRadius = 10.0 local endRadius = 5.0 local height = (units.decodevalue "30.0cm") local heightSegs = 20 local columns = 8 local columnAngle = 360.0 / columns local bendAngle = 45.0 clearlistener() delete objects for row = 1.0 to heightSegs do ( f = row/heightSegs stepHeight = height*f curRadius = startRadius + (endRadius - startRadius)*f curBend = bendAngle*f --*(fastValue f bias:0.0 power:10.0) col = random white white for c = 1 to columns do ( calcX = curRadius * cos((c-1) * columnAngle) calcY = curRadius * sin((c-1) * columnAngle) orgPos = [calcX,calcY,stepHeight] /* BENDING */ tm = rotateY (transmatrix orgPos) curBend bentPos = (tm * (matrix3 1)).pos point pos:bentPos size:1 wirecolor:col ) ) c = cone radius1:10 radius2:5 pos:[0,0,0] addmodifier c (Bend angle:bendAngle) )`````` __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com Last edited by JokerMartini : 04 April 2013 at 09:02 PM. share quote
 04 April 2013 JokerMartini Expert   portfolio John Martini CG Supervisor, 3D, Maxscript, VFX Ingenuity Engine Los Angeles, USA anyone have any ideas on how to properly do a bend on an objects verts without using the the bend modifier? __________________ ____________ ___ __ _ John A. Martini JokerMartini@hotmail.com www.JokerMartini.com share quote
 04 April 2013 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.
Forum Jump
 Please select one User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home -------------------- Gallery     Latest Entries     Featured 2D     Featured 3D     CG Awards     Community Awards Main     News     General Discussion     Off Topic     Recruitment         Temp Job Board Challenges     Rival Crimson X Chaos     Education     Demo Reel     Portfolio Review GROUPS WIP ADVICE     Pro Select     Art Direction and Interviews     New 2D/3D Sketchbooks 2018     WIP 2D/3D & Animation         WIP/Critique: 3D         WIP/Critique: 2D             Speedpaints & Sketchbooks         WIP/Critique: Animation     Partners and Groups         Kitbash 3D Thunderdome         Collaborative Projects Autodesk     Autodesk Maya         Maya Dynamics         Maya Rendering         Maya Character Setup         Maya Programming     Autodesk Miscellaneous         Autodesk MotionBuilder         Autodesk Mudbox         Autodesk Softimage             XSI: Programming             ICE: Interactive Creative Environment     Autodesk 3ds max         3dsMax Tutorials & Tips         3dsMax Resources         3dsMax SDK and MaxScript         Plugins & Add-ons         Particle Flow     Mudbox Featured Gallery ZBrush     Featured Zbrush Gallery     Pixologic ZBrush     Keyshot     Marvelous Designer Texturing     Allegorithmic Substance         Substance Designer         Substance Painter         Substance Featured Gallery     Texturing XYZ     Mari     Marmoset Toolbag Software     Maxon Cinema 4D         Cinema 4D Resources     Side Effects Houdini     Compositing Software         The Foundry Nuke         Adobe After Effects         Autodesk Effects and Compositing         Eyeon Software Digital Fusion     Additional Software         Lightwave 3D             LW Resources             LW Tutorials         The Foundry Modo             The Foundry Time Travel Challenge         E-on Software Vue         Photoshop / Painter         Blender         3DCoat Techniques     Art Techniques and Theories     Digital Matte Painting         Digital Matte Painting Mini-Challenge     Modeling         Modeling Challenge             Member Model Collection     Texturing and Surfacing     Character Rigging     Animation     Lighting and Shaders         Lighting Challenges     Compositing and Editing     Anatomy and Figurative Art         SPOTLIGHT: Best of the Artistic Anatomy and Figurative Art Forum         Tutorials and Workshops         Personal Anatomy & Sketchbook Threads         References, Resources, and Supplies Technical     VR/AR     Master Virtual Reality with BrioVR     Workstation Builds     Game Engine     Graphics Programming     Technical and Hardware
Miscellaneous

All times are GMT. The time now is 05:25 PM.