Animate visibility of random objects in collection so there's only one visible at a time?

Hey all,

Title says it all but let me give you an example =) :

Let’s say I have 10 objects in a collection and I want to do an animation that randomly hides all but one object of this collection.
So if my animation is 50 frames I may have the object 1 may appear on frame 2, 5, 12, 23, 24, 34 and 40 for example etc.

Thanks a lot.


you could do it shader-based, here is an example (play animation) :
shader_toggle_visibility_at_random.blend (935.3 KB)



1 Like

WoW that was fast and perfect for my need ! So I’m marking this as a solution but I have a question =)

I tried adding a 6th cube with a new mat (duplicate of one of yours) and changed the number of object to 6 in the shader but it looks like this new cube is always visible when the fifth one is visible. What am I doing wrong ?

Thanks a lot anyway !

1 Like

I forgot to add that this works with the object ID. It’s a property you have to set on each object in properties->relations, so for a sixth object you should set it to 5 (starts on zero)
If you want to add a bias (say you want object no.3 to be more frequently visible than the others) you can remap the noise texture with a curve node and draw a little plateau around x=3.

Thanks a lot that works like a charm !
You’re my rock star :wink:

1 Like