recently I fall in the world of blender and started working on creating syntethic data that needs to be segmented. My first approach was the following: an object (mesh) with index 0 index and objects above it with an index between 0 and 255 for each type of object. Using compositing I can pass the index as a scale of grey and generate a BW image I can use to do segmentation with openCV.
But I would like to do this in the same object. Imagine you have a mesh (a road) with a material called asphalt, which has lines and everything on it.
I would like to pass an index to these lines, so I can segment them too. Those are my tries:
1st idea is to give a material for lines, and another material for the road, so each of them has a material index and I can use compositing.
Other idea is to consider them different objects and use the approach I already used for objects above the plane.
Another way I'm not considering using texture index (from my knowledge, this doesn't exist)
The other approach is using two objects (1 for lines, 1 for objects).
This is the actual material, where lines, asphalt and water puddles are mixed via mix nodes. Can you recommend me what is the best approach if you have previous experience?
Thanks in advance.
Which is the best