Bake or Freeze particle expression to create a forest


Hi, I’m using particle instances to dress a background mountain prop.

To get random rotation and scale, I use an expression at Runtime before Dynamics.
This get’s me the desired look.
However, every time I re-open my scene, it generates a New random seed, so the trees are never in the same scale or rotation. This gives me issues with renderpasses or re-renders, as things shift.

Am I able to freeze or make the random rotation and scale the same every time?
Can I hook them up with a noise map and Control them by using that?
I don’t want to use x-gen, I’m on Maya 2015, and using redshift3D as my renderer, and the pipeline with x-gen is not optimal.
I’ve tried to export the instances to geometry instances, but it’s to many, and bugs the system Down.
If I could use my simple particle setup, but get the same results every time, it would be brilliant.

This is my current expression;
nParticleMountainLowVegShape.indexPP = nParticleMountainLowVegShape.particleId%3;
nParticleMountainLowVegShape.RandomRotationPP = <<rand(25),rand(360),rand(25)>>;
nParticleMountainLowVegShape.RandomScalePP = rand(0.6,1.5);

Would anyone be able to give me a direction to move in in layman terms?

Thank you!
Roger Gihlemoen!



I believe you can add a “seed” function to your expression to get the same random result multiple times.

Google, " Maya Reproduce Randomness"


Hi Cavedog.
Good idea, I’ve given it a few hours now, but it returns one value for all my channels, I read somewhere in the Maya documentation that it’ has a different behaviour in particle systems that on an Object.
So I’ll keep looking, still not sucsess.



To freeze your particles, cache them and “Set Initial State”.

Is there any reason you aren’t just using Environment System to handle all of this? It’s very nice.


Freeze initial state will not affect the script.
Thanks for the link to the environment system.
I found the answer to my question however, adn it goes like this:

if (particleId == 0)
seed (12345);

Add this to the beginning of the script, that will generate the same random pattern every time.
To get a different pattern, change the seed number.