Goal. Have access to a random number in range [0-1] per particle per frame in a Cycles Render Node. Particle System is used. Multiple particles per frame.

Question. How can Blender drivers/other achieve that goal?

Current State. Partial Success. Blender driver which is invoked once per frame. Python Random random.uniform is used. Input Value Node has the driver. So the random number per frame is achieved, not per particle per frame.

To emphasize there are many particles per frame. If there are 40 particles and 30 frames then

1200 = (30 * 40) random numbers should be generated.

enter image description here

Thank You.

version 2.74 (sub 0), branch b'master', commit date b'2015-03-31' b'13:39', hash b'000dfc0', b'Release' build date: b'2015-03-31', b'15:46:51' platform: b'Windows:32bit'

  • $\begingroup$ All particles share the same material, so they share the same random number. This is by design and will not work how you want it. You need to exploit something that is unique for each particle - like position or alive_time - and feed it into your script as a seed to generate unique random for each particle. $\endgroup$ – Jaroslav Jerryno Novotny Sep 25 '15 at 15:54
  • $\begingroup$ what would be 1200 random values be used for, knowing this might help give a better answer $\endgroup$ – zeffii Sep 25 '15 at 15:55
  • $\begingroup$ @Jerryno is there a document which anyone can read which explains the [by design] you mentioned? Can you provide the link? Also I am not quite sure we are understanding each other clearly at this point. So are you stating that the value node will always be evaluated only once per frame? $\endgroup$ – atomicbezierslinger Sep 25 '15 at 16:13
  • $\begingroup$ @zeffi. I want to change some color property randomly. For example I may want to change the color of fraction of moving particles from blue to white for one frame. Such as tossing a fair coin. Of course there are visual approximations using modulo. I was unpleasantly surprised that some [random] function is not offered in the math functions. Perhaps I need to see the next version of Blender. $\endgroup$ – atomicbezierslinger Sep 25 '15 at 16:29
  • $\begingroup$ Yes I am stating that a Value node will have the exact same value for each object/particle this material is assigned to. The node is shared between all instances this one material is assigned to. Nodes that give different values in the same material per object/particle are for example Attribute, Geometry or Particle_Info,.. $\endgroup$ – Jaroslav Jerryno Novotny Sep 25 '15 at 16:46

You can use the particle info node to achieve this:

enter image description here

Where 1000 is the total number of particles.

If your particles do not have a random distribution, then this doesn't work so well. In that case, you could try mapping the index to a procedural texture, e.g. like this:

enter image description here

  • $\begingroup$ Thank You. The isolated particle info index is most emphatically not a random number from the perspective of the question. Beautiful image. $\endgroup$ – atomicbezierslinger Sep 25 '15 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.