skew Mod - recreate

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 05 May 2013   #16
Originally Posted by JokerMartini: Below is a duplication of the bend Modifier from max thanks to Bobo.

where did you find this sample?
 
Old 05 May 2013   #17
Ahhhh!!!

Haha. You'll have to show me what is wrong then since I'm not seeing it .
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 05 May 2013   #18
Originally Posted by JokerMartini: Ahhhh!!!

Haha. You'll have to show me what is wrong then since I'm not seeing it .

you test your code probably for cylinder only. it's specific case where center of deformation at the bottom of the mesh and zero position. try the code for a sphere and try to mach to the built-in skew.

'my bend' is also not correct. it doesn't match what the built-in bend does do.

and as i said... for both modifiers you can do 'case' only once.
 
Old 05 May 2013   #19
Originally Posted by denisT: where did you find this sample?


This sample was posted here on cgtalk by Bobo , answering someone making a bend mod.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 05 May 2013   #20
I'll have to mess with it tomorrow. I do not see any problems off hand.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 05 May 2013   #21
Originally Posted by JokerMartini: I'll have to mess with it tomorrow. I do not see any problems off hand.

about using only one case... it's so obvious! how do you not see it?! you can do it JUST FOR FIRST VERTEX ONLY!
 
Old 05 May 2013   #22
attempt

attempt but failed.....
I thought I was going in the right direction but not so much....



delete objects
plugin simpleMod skewy
name:"skewy"
classID:#(0x6b15953d, 0xb0cf3d07)
version:1.1
( 
	parameters main rollout:main
	(
		skewAxis type:#integer ui:uiSkewAxis default:3
		skewAmount type:#worldUnits ui:uiSkewAmount default:0
		skewDirection type:#float ui:uiSkewDirection default:0
	)

	rollout main "MyBend Parameters"
	(
		group"Skew"
		(
			radiobuttons uiSkewAxis "" labels:#("X","Y","Z") columns:3 align:#center offset:[0,0]
			spinner uiSkewAmount "Amount: " type:#worldUnits range:[-1e9,1e9,0] scale:.01 offset:[0,4]
			spinner uiSkewDirection "Direction: " range:[-1e9,1e9,0] scale:1
		)
	)

	on map i p do
	(
 		skewVal = (skewAmount*p/extent) --* theDirMatrix
		p += (case skewAxis of
			(
				1:	([0,0,skewVal[skewAxis]] * (rotateXMatrix -skewDirection))
				2:	([0,0,skewVal[skewAxis]]  * (rotateYMatrix -skewDirection))
				3:	([0,skewVal[skewAxis],0] * (rotateZMatrix -skewDirection))
			)
		)
	)
)

m = sphere radius:10-- height:60 heightsegs:20 radius:5 sides:4 wirecolor:yellow
addmodifier m (Skewy()) 
select m
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com

Last edited by JokerMartini : 05 May 2013 at 04:31 PM.
 
Old 05 May 2013   #23
i cleaned up bend code... as i said there is no reason to recalculate some constants for every point.
there is away how to do it only once when any parameter changes value:

   plugin simpleMod Bend1D
   	name:"Bend1D"
   	classID:#(0x00001967, 0x001182ab)
   (
   	parameters main rollout:main 
   	(
   		angle type:#float ui:ui_angle default:0
   		axis type:#integer ui:ui_axis default:3
   		direction type:#float ui:ui_direction default:0
   	)
   	
   	rollout main "Parameters"
   	(
   		group "Bend: "
   		(
   			spinner ui_angle "Angle: " range:[-1e9,1e9,0] type:#float fieldwidth:64 align:#rigth offset:[4,0]
   			spinner ui_direction "Direction: " range:[-1e9,1e9,0] type:#float scale:0.1 fieldwidth:64 align:#rigth offset:[4,-1]
   		)
   		group "Bend Axis: "
   		(
   			radiobuttons ui_axis labels:#("X   ", "Y", "Z") columns:3 align:#left offset:[20,0]
   		)
   	)
   	local last, value, dirMatrix, factor, rotateMatrix
   	on map i p do if angle == 0 then p else
   	(
   		if value == undefined or last != [angle,direction,axis] do 
   		(
   			factor = angle/extent
   			radius = (180.0/pi/factor)[axis]
   			
   			case axis of
   			(
   				1: 
   				(
   					dirMatrix = rotateXMatrix -direction
   					value = [0,0,-radius]*dirMatrix 
   					rotateMatrix = rotateYMatrix
   				)
   				2: 
   				(
   					dirMatrix = rotateYMatrix -direction
   					value = [radius,0,0] * dirMatrix 				
   					rotateMatrix = rotateZMatrix
   					factor = -factor
   				)
   				default: 
   				(
   					dirMatrix = rotateZMatrix -direction
   					value = [radius,0,0]* dirMatrix 				
   					rotateMatrix = rotateYMatrix
   				)				
   			)
   			last = [angle,direction,axis]
   		)
   		tm = translate ((rotateMatrix (factor*p)[axis]) * dirMatrix) value
   		p[axis] = 0
   		(p - value)*(inverse dirMatrix)*tm
   	)
   )
   


PS. original Bobo's algorithm shown above is absolutely right.

EDIT: some bug fixed

Last edited by denisT : 05 May 2013 at 02:17 PM.
 
Old 05 May 2013   #24
Is my latest version of the skew mod closer to what you were directing me towards.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com

Last edited by JokerMartini : 05 May 2013 at 09:14 PM.
 
Old 05 May 2013   #25
Any more suggestions?
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 05 May 2013   #26
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.
 
Thread Closed share thread



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 vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:17 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.