Given a primitive node(could be a box, ball, cylinder, etc.) and a material, how to make the material cover part of the node just like the picture above?
Are there any existing examples in whichever 3D engines for me to check? Any ideas would be appreciated, thanks, guys.

The answer to this question is quite simple. The easiest and almost the best way to solve this problem is using shaders. There are concepts like "mix shader" in Blender, which can mix two shaders, and by defining a rule can the shader decide which texture to get color from.
ref: https://docs.blender.org/manual/en/latest/render/shader_nodes/shader/mix.html
mix shader in Blender