A rigid body sim where at the end all objects textures make out a picture? Im not sure how to explain this, I've seen the effect done online multiple times.

For example, a bunch of balls simulated to fall on the ground, and once they settle if you look at the top of them all, its like they're perfectly organized to make out an image or word on their materials.

I guess the effect could be similar to this one

https://www.youtube.com/watch?v=S5WAswaJRjw
The trick is simple: this is 'bake to the future'!

 

Once the simulation baked, go to the last frame and you'll know how to color the balls.

Here (but this is just an example as the materials could be totally different), I've assigned the object pass index knowing the positions at the last frame and used it to drive the color.