PFlow scatter

Become a member of the CGSociety

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

Thread Tools Search this Thread Display Modes
  10 October 2012
PFlow scatter

I need to scatter xref objects to a surface so I thought of creating my own scatter tool using maxscript with pflow. Well creating actual scatter flow with maxscript is easy, but a problem comes when I need to actually place to objects in scene. I can't use shape instance and mesher compound because it kills all xref related stuff.

First thing that came to my mind is just loop thru all particle positions and place objects that way. Problem is that I need to align my objects to that surface and so far I havent figured out how to get normal from each particle. I could use intersectray to find face normal, but how do I know which direction ray needs to be shot from each particle position?
  10 October 2012
Oh damn I thought I could just use particlePos() to get positions but it doesnt work with PFlow. Looks like I need to do some more reading about PFlow and maxscript integration.
  10 October 2012
Well got it working. Although I need to do completeRedraw() before looping thru particles, otherwise it doesn't find them. Any idea why is that?

 	delete objects
 	local sp = Sphere radius:50 segments:32
 	local pf=pf_source logosize:10 name:"pf" Quantity_Viewport:100
 	local rendParticles=renderParticles()
 	local pCount = 40
 	local evt = event()
 	local birthAction = birth amount:pCount emit_start:0 emit_stop:0 
 	local positionObjectAction  = position_object emitter_Objects:#(sp)  location:3 Random_Seed:(random 0 10000)
 	local speedBySurfaceAction = speed_by_surface surface_objects:#(sp) direction_type:0
 	local rotationAction = rotation direction:3 euler_y:90
 	local speedAction = speed speed:0
 	evt.appendAction birthAction 
 	evt.appendAction positionObjectAction 
 	evt.appendAction speedBySurfaceAction 
 	evt.appendAction rotationAction 
 	evt.appendAction speedAction 
 	pf.appendInitialActionList evt
 	for i=1 to pf.numParticles() do
 		local pos = pf.getParticlePosition i
 		local tm = pf.getParticleTM i
 		local t = teapot pos:pos radius:5 
 		t.transform = tm

Now I just gotta do some collision tests and maybe even create some slope test so user can decide if particles are placed on steep surfaces.
  10 October 2012
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.
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
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 12:16 AM.

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