Blender Git Commit Log

Git Commits -> Revision fd2888d

Revision fd2888d by Jacques Lucke (pygpu_extensions)
February 12, 2021, 21:54 (GMT)
Fix T84899: instance ids are not unique in common cases

Ids stored in the `id` attribute cannot be assumed to be unique. While they
might be unique in some cases, this is not something that can be guaranteed
in general. For some use cases (e.g. generating "stable randomness" on points)
uniqueness is not important. To support features like motion blur, unique ids
are important though.

This patch implements a simple algorithm that turns non-unique ids into
unique ones. It might fail to do so under very unlikely circumstances, in
which it returns non-unique ids instead of possibly going into an endless
loop.

Here are some requirements I set for the algorithm:
* Ids that are unique already, must not be changed.
* The same input should generate the same output.
* Handle cases when all ids are different and when all ids are the same
equally well (in expected linear time).
* Small changes in the input id array should ideally only have a small
impact on the output id array.

The reported bug happened because cycles found multiple objects with
the same id and thought that it was a single object that moved on every
check.

Differential Revision: https://developer.blender.org/D10402

Commit Details:

Full Hash: fd2888d5a0c23d3ae69b3c038b02a5ac8be8e0d4
Parent Commit: e75f938
Committed By: Germano Cavalcante
Lines Changed: +82, -8

By: Miika HämäläinenLast update: Nov-07-2014 14:18 MiikaHweb | 2003-2021