Particle orientation to object normals.

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
  11 November 2011
Particle orientation to object normals.

Hi all,

I am trying to figure out something for the past 3 days. Very much new to particle flow scripting.

In the scene i have a circular spline with 12 knots on it. I am trying to put a particle on each knot on the spline. As all the knots on the spline have the same normals, i put a plane object on each knot point and oriented it the wat i wanted it. Now i want the normals of each plane object that is on the knot point to be reflected on my particles. That means the particles should face the way the planes face.

I tried copying the plane's transform to the particle's transform but unfortunately it resizes the particles which i dont want.

Please help me with this obstacle i am facing.

Thanks to all
 
  11 November 2011
without box#3: speed by surface > Surface normals with veeery low speed and an age test of 1 to pass em to an event without speed (aka. a speed operator set to 0.0)

with box#3: grab the point normals of your objects and make a matrix transform V:1>M:Z so the normal vector is the new up vector.
 
  11 November 2011
Also you might wanna take a look at this tutorial about planting on splines and orienting:

http://www.3dtotal.com/index_tutori...isplay=1&id=546

cheers,
Anselm
 
  11 November 2011
Really thanks Psycho,

I will give it a try and post my results.

Again thanks
 
  12 December 2011
I'm trying to do something that's very similar to this.
My current flow begins with particles spawning and being affected by a vortex force so they flow around a sphere. A particle Age test sends them to to next event where a find target is. And the next event is a lock and bond.

What I want is the patricles locking using the normal of the sphere an spreading them evenly around the sphere. I thought using Docking Direction: Surface normals would do the trick but they don't take the correct alignment and they don't spread evenly. We have Box #2 and #3 but I discovered that yesterday and my experiences in they boxes are slim to none.

Is there a simple solution?
__________________
2 * Core i7980@3.8Ghz, 24GB DDR3, Geforce GTX580
 
  12 December 2011
Ok I got the normal alignment using a data test from box #3. Now just the even distribution..
__________________
2 * Core i7980@3.8Ghz, 24GB DDR3, Geforce GTX580
 
  12 December 2011
I am sorry Villean, i couldn't get it to work for some reason. Can you post your max file please? I haven't done anything with box 3 ops, i think its high time now.
__________________
Thanks all.
 
  12 December 2011
The most "even" distribution would be to use a GeoSphere and birth by polyOp.getFaceCenter in a Birth Script.

This will align to normal and position on face center:

  on ChannelsUsed pCont do
  (
  	 pCont.useTime = true
  	 pCont.useAge = true
  	 pCont.usePosition = true
  	 pCont.useTM = true
  )
  
  on Init pCont do 
  (
  	global bObj= $GeoSphere001 --define your ePoly mesh birth object
  	global theTM = matrix3 0 --create an empty matrix
  )
  
  on Proceed pCont do 
  (
  	t1 = pCont.getTimeStart() as float --Get the current integration step time
  	count = polyOp.getNumFaces bObj --Count the number of faces on the ePoly Birth Object
  	if t1 <= 0 then -- If time is zero then do the iterator
  	(
  		for i in 1 to count do --Iterate through all of the faces
  		(
  			pCont.AddParticle() -- Add one particle
  			pCont.particleIndex = pCont.NumParticles() -- Set its current node Index
  			pCont.particleTime = currentTime -- Set its time
  			pCont.particleAge = 0 --Set its age
  			theTM = matrixFromNormal (polyop.getFaceNormal bObj i) --Get the normal from the face and convert it to a matrix
  			pCont.ParticleTM = theTM -- set its rotation to match the face normal (note this will move position to 0,0,0) so position needs to be last
  			pCont.particlePosition = polyOp.getFaceCenter bObj i --Position it in the center of the ePoly face
  		)
  	)
  )
  
  on Release pCont do 
  (
   
  )
  


So that would be the easiest way, if not, you will have to use something like surface area and nearest neighbor to get an equal distribution.
__________________
poof ~>Vimeo<~
 
  12 December 2011
I did the same thing, but for some reason the moment the particle gets aligned to the faces normals, it gets resized. Else everything worked fine.

Thanks Villean
__________________
Thanks all.
 
  12 December 2011
The FIRST thing you need to do is set its rotation since you are using the particleTM (the transform matrix) TM overwrites everything. ONLY after you set the rotation can you set its position/scale/whatever transform.

I suppose if you are slick you can account for all of this, me no, so I do it in order of execution.
__________________
poof ~>Vimeo<~
 
  12 December 2011
Quote: The FIRST thing you need to do is set its rotation since you are using the particleTM (the transform matrix) TM overwrites everything.


Thanks Johny,

How is rotation and resizing of the particles linked? So if i set the rotation first, still the particleTM is going to overwrite the rotations too.

I guess i am understanding it wrong Johny.
__________________
Thanks all.
 
  12 December 2011
The TM controls position/rotation/scale.

Is it possible that you scaled the original particle base object at some point in time?

Since the script is using MatrixFromNormal to get the face normal it is going to overwrite all of the current particles particleTM unless you can figure out how to get the current TM and combine it with the MatrixFromNormal.

Read about it here:
http://docs.autodesk.com/3DSMAX/14/...AAE048D-476.htm

You typically use the TM for rotations simply because particleOrientation is a bit of a PITA.
__________________
poof ~>Vimeo<~

Last edited by JohnnyRandom : 12 December 2011 at 04:53 PM.
 
  12 December 2011
Johny -
Yes I did scale my particles at the beginning of the flow. Oh, i guess i am getting it now. The whole Matrix and MatrixFromNormal always confused me. Also went through Bobo's DVD to get an idea on it. But now as i am digging deep, i am gettting it slowly. Your explanation was simple and informative.

3ak -
Thats exactly what i am looking for. I got my particles aligned to the face normals, but my problem was the resizing of the particles.
__________________
Thanks all.
 
  12 December 2011
Originally Posted by sumchans: Johny -
Yes I did scale my particles at the beginning of the flow. Oh, i guess i am getting it now. The whole Matrix and MatrixFromNormal always confused me. Also went through Bobo's DVD to get an idea on it. But now as i am digging deep, i am gettting it slowly. Your explanation was simple and informative.

3ak -
Thats exactly what i am looking for. I got my particles aligned to the face normals, but my problem was the resizing of the particles.


I don't use any script here. Don't know your setup so my approach may be not suitable:
http://dl.dropbox.com/u/46208032/3a...e%282010%29.max


Or you can use JohhnyRandom's script. But i think you'll get chaotic rotations around particle's aligned axis.
 
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 07:03 PM.


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