How would I create a mask for a sub material within a layered material?

I would like to create a mask of a sub material that is part of a layered material. I tried assigning the sub material a Material ID Channel and create a CMasking element based on that channel #, but it’s not masking the sub material.

Hi,
you can try with CTexmap render element, using the map of the corresponding sub material mask.

Bye
M.