Particles for Scattering

Autodesk Maya (Plugin developed by JimStar)

Moderator: JimStar

User avatar
cyrillweiss
Licensed Customer
Posts: 91
Joined: Wed Jun 02, 2010 2:52 pm

Hi

For Scattering some vegetation (Trees, Gras, ect.) I would like to use particles instances as suggested by TBFX:
http://render.otoy.com/forum/viewtopic.php?f=28&t=37902

Now, how to get the particles over the ground? I see three possibilities about that:

- use the object as an emitter "emit particles from object", without any force. That way I've got the particles on the hole area, but may have to delete some particles, which are too much
- use an emitter and let the particles fall on to the object (high friction)
- set the object live to use the particle tool for painting on to it. But for a random distribution the painting gets volumetric, which isn't what I want and the live object hasn't got influence on that.

Or is there a script, which might spread the particles on to the object? (kind of spraying the particles randomly on to the object)

Best regards
Cyrill
HW01:WIN10x64/X79/i7-3930K/64gb/GPU:1xTitan X, GTX 1080ti, SW:Maya2018/2019, Cinema 4D R20

HW02:WIN10x64/Z370/i7-8700K/64gb/GPU:1xTitan X, GTX 1080ti SW:Maya2018/2019, Cinema 4D R20

etc. ...
User avatar
ivankio
Licensed Customer
Posts: 103
Joined: Thu Nov 14, 2013 11:39 pm
Location: Curitiba - Brazil
Contact:

This can be a not so short matter. I really recommend this DVD:
http://www.thegnomonworkshop.com/store/ ... uZprxBTvHU

Although longer than a forum answer, it is still a considerably short time to watch, but prepared me for issues I didn't even had in mind from start (like we want to spread trees straight up, grass patches according to surface normal).

Nothing like TBFX's composition, but in my test with Octane I managed this: http://www.animaokio.com/imgs/grama (scroll to play). Spent more time modeling the patches. The spreading gets really easy.

If you are not up to get the DVD, ask again and I'll try to summarize.
GTX 1080 8gb, GTX 970 4gb, I5 4590, Z97-E, 32gb RAM, Win 10 64bits, Octane for Maya
User avatar
ivankio
Licensed Customer
Posts: 103
Joined: Thu Nov 14, 2013 11:39 pm
Location: Curitiba - Brazil
Contact:

Well, I guess it does fit in a forum answer :P

I assume you know how to:
A- emit from object;
B- map emission if wanted;
C- setup an instancer.
Extra tip: set the emitter rate very high (1000000 particles/sec) and tune the particles MAX COUNT to achieve a good density already in the first frame.

Now to setup the particles... (everything not commented out should go in your particle creation expression, if you do not want the particles to be rotated along surface normal, edit accordingly).

Code: Select all

///////////////////////////////////////////
// Preliminary setup

// Load plugin nearestPointOnMesh (installed with Maya, just disabled by default)

// Set INSTANCER rotation order to YXZ

// add particle attributes:
// rotationPP			vector		map to rotation
// randomRotationY		float
// aimDir			vector		map to aim Direction
// aimUp			vector		map to aim Axis
// customScale			vector		map to Scale
// customID			float		map to objectID


///////////////////////////////////////////
// Particle's creation expression
// !!!!!! remember to replace bellow "particleShape1" and "pPlane1" properly. pPlane1 is emitting surface.

// Set the orient axis for the instance
particleShape1.aimUp = <<0,1,0>>;

// random rotation for Y axis
particleShape1.randomRotationY = rand(360);

//// Orient to normal for grass patches. Most plants you'll want growing according to world up.
// get surface normal at particle position (needs the plugin to be loaded)
vector $p = particleShape1.position;
vector $normal = `nearestPointOnMesh -ip ($p.x) ($p.y) ($p.z) -normal -q pPlane1`;
// orient the instance
particleShape1.aimDir = $normal;

// solve each angle, convert to degrees
float $rotX = rad_to_deg( atan2( ($normal.z), ($normal.y) ) );
float $rotZ = rad_to_deg( asin( -($normal.x) ) );

// assign random rotation in Y
particleShape1.rotationPP = << $rotX, particleShape1.randomRotationY, $rotZ >>;

// random scale if you will, set the values
particleShape1.customScale = rand(1,3);

// number of instance sources to assign (if 4 sources, use max of 3.999)
particleShape1.customID = rand(0, 3.999);
Unfortunately Maya particles does not prevent very close overlap. You can't delete a maya individual particle from it's particle array but you can move it through component editor or set it's visibility to off.
GTX 1080 8gb, GTX 970 4gb, I5 4590, Z97-E, 32gb RAM, Win 10 64bits, Octane for Maya
User avatar
TBFX
Licensed Customer
Posts: 501
Joined: Sun Dec 11, 2011 9:43 pm
Location: Wellington, New Zealand

ivankio wrote:Unfortunately Maya particles does not prevent very close overlap. You can't delete a maya individual particle from it's particle array but you can move it through component editor or set it's visibility to off.
Hi cyrillweiss,

Yes just follow ivankio's description it is almost identical to my method. I also use nParticles rather than the plain variety as this allows me to turn on particle self collisions and set the particle size to help avoid the overlapping mentioned above.

Also remember to set particle emission speed to 0 and turn of gravity so the particles will stay on the surface.

T.
Win10 x64|i7-9750H 2.6 GHz|32 GB RAM | RTX2080 max Q 8GB
User avatar
ivankio
Licensed Customer
Posts: 103
Joined: Thu Nov 14, 2013 11:39 pm
Location: Curitiba - Brazil
Contact:

Wow, thanks for the tip, TBFX! It gets much more efficient instance count wise. I'm also being more in control of boundaries, but still not fully happy about it.

Do you mind sharing your thoughts about the patches you use? I made them circular with a falloff of density and height to blend well, but I'm having to choose between weak silhouettes or grass showing on top of boundary floor (using scale from 0.75 to 1.25).
nParticlesGrass.jpg
GTX 1080 8gb, GTX 970 4gb, I5 4590, Z97-E, 32gb RAM, Win 10 64bits, Octane for Maya
User avatar
TBFX
Licensed Customer
Posts: 501
Joined: Sun Dec 11, 2011 9:43 pm
Location: Wellington, New Zealand

ivankio wrote:Do you mind sharing your thoughts about the patches you use? I made them circular with a falloff of density and height to blend well, but I'm having to choose between weak silhouettes or grass showing on top of boundary floor (using scale from 0.75 to 1.25).
My grass patches were circular with just a little falloff, probably a bit less than yours, I also used temporary animated collision geo to push errant particles into place for cleaner boundaries and then reset the initial state.
Also, I was never getting the camera down close to any boundaries.

T.
Win10 x64|i7-9750H 2.6 GHz|32 GB RAM | RTX2080 max Q 8GB
abstractmedia
Licensed Customer
Posts: 71
Joined: Sat Jul 13, 2013 6:12 pm

Wow. This is awesome stuff, guys! :D
abstractmedia
Licensed Customer
Posts: 71
Joined: Sat Jul 13, 2013 6:12 pm

ivankio wrote:Wow, thanks for the tip, TBFX! It gets much more efficient instance count wise. I'm also being more in control of boundaries, but still not fully happy about it.

Do you mind sharing your thoughts about the patches you use? I made them circular with a falloff of density and height to blend well, but I'm having to choose between weak silhouettes or grass showing on top of boundary floor (using scale from 0.75 to 1.25).
nParticlesGrass.jpg
After reading this, and the other post and watching the Gnomon dvd Ivankio suggested. I decided to give it all a try over the weekend, and I have a couple questions.

I saw the image that had 52 billion polygons by TBFX in the other thread on this subject and was curious.
Is there something specific you are doing to keep your render time low with so many polygons?

Currently in my scene with just under 26 million polys my render is loading quickly into the GPU. But the image here was going to take 3 hours for 3000 samples.

Image

I am running on a 6gb Titan, i7 3930, with 32gb RAM.
User avatar
TBFX
Licensed Customer
Posts: 501
Joined: Sun Dec 11, 2011 9:43 pm
Location: Wellington, New Zealand

abstractmedia wrote:I saw the image that had 52 billion polygons by TBFX in the other thread on this subject and was curious.Is there something specific you are doing to keep your render time low with so many polygons?
I'm not doing anything that special but I am rendering on 4x GTX580's which should be between 2 and 3 times faster than a single Titan plus my frames were only rendered to 1000 samples. So that would bring your 3 hours a frame down to around the same times I quoted for mine. Once you get to a certain complexity the render times don't change much as you add more in any given lighting scenario.

That scene was rendered using Path Tracing with Max Depth 4, caustic blur 0.1 and I also reduced the amount of specular on the grass shader to reduce noise as it was really not needed in such a wide shot. The scene was lit by the HDRI sky you see in the render (which conveniently had the sun behind some bright cloud) and a single plane emitter light set far enough back to act as the sun (although this scene was set up back before Octane had importance sampling for environments so it would now work with an HDRI that had the sun visible without the need for the emitter light).

T.
Win10 x64|i7-9750H 2.6 GHz|32 GB RAM | RTX2080 max Q 8GB
abstractmedia
Licensed Customer
Posts: 71
Joined: Sat Jul 13, 2013 6:12 pm

Alright! I appreciate the reply!
Post Reply

Return to “Autodesk Maya”