Share

invalid_index

Bifrost geometry, such as mesh and strands, use unsigned 32 bit integers as indexes, which allows for about four billion indices. Many geometry algorithms revolve around finding or computing such indices, and in those algorithms it can be useful to mark a value as not having been found or computed yet. This can be done using a separate array of booleans, but often for simplicity or performance only one array is used but one value is reserved as an "invalid index".

This is known as a "sentry" value - a value in an array of integers that does not represent a regular value, but instead represents the value is invalid or that there is no value. If you used zero for that special value, it would mean that zero couldn't represent a valid value.

A very commonly used sentry value is the highest possible value in the used type. This means the number of values you can index is only reduced by one. This node can be used as a constant to set or compare values, and is easier to read and less error prone than the numeric constant.

The invalid index value is to 2^32 - 1, or 4,294,967,295, which is the highest possible unsigned 32 bit integer.

Was this information helpful?