This makes it possible to create variation among multiple objects using the same material, for example differently colored rocks in a riverbed, color variation in wooden planks on a floor, etc.
I have added an objectID entry to the hitPoint struct and three new textures to access it.
You can see the changes in this commit on the new_math_textures branch.
The textures are:
- Color - object ID converted to a color
- Normalized - object ID converted to a float number in range 0..1
- Raw - the raw object ID, in range 0 to 0xffffff
Note that I have not written the OpenCL versions of these textures yet.
This stuff will probably not make it into v2.1.
Results so far:
All objects in this image use the same material: All floor tiles use the same material:
Problems:
- The object ID is not stable over multiple frames if objects are added/removed between frames or if their order changes. See the attached gif for an example (the particle system adds objects).
- When the DuplicateObjects functions of LuxCore are used, the object ID is copied. For particle systems in Blender, it would be useful if we could pass a boolean to the functions to choose if object IDs should be copied or if new IDs should be generated for the duplicates.