How to assign id to brep

Hello again, forum. Trying to make animation in grasshopper + vray next. Cant figure out how to assign two or more different materials to breps. Because of the new elements constantly appearing and disappearing, material id is changing, how can i fix that?
i want to achieve same result as here, but with a few materials:

what i have now:

here is grasshopper definition and rhino file:
ddd.3dm (2.2 MB) (32.0 KB)

i can not attach hdri map, sorry