Blender Git Loki

Git Commits -> Revision 98db4cc

Revision 98db4cc by Jacques Lucke (master)
February 12, 2021, 16:44 (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: 98db4cc6391df8c8b21516bbdbc0af8f493a15b3
Parent Commit: ccea44e
Lines Changed: +82, -8

4 Modified Paths:

/source/blender/blenkernel/BKE_geometry_set.h (+1, -1) (Diff)
/source/blender/blenkernel/BKE_geometry_set.hh (+9, -0) (Diff)
/source/blender/blenkernel/intern/geometry_set.cc (+66, -3) (Diff)
/source/blender/blenkernel/intern/object_dupli.c (+6, -4) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021