Convolution question DLS 4 week 2

If I have an image 32X32X3 and a filter 3X3X3, how do I know if the first filter is for the red, second for the green and the third for the blue. I fully understand how that works, What if the filter is instead as vertical, horizontal and diagonal. How do we, or the system knows how to multiply the filter for convolution?

Then, part 2 is for the same image, using a 3X3X5 filter, the Nc for the filter is 5 while the Nc for the image is 3. What is the math to produce the output with an Nc of 5?

Traditionally, the order of the color planes in the examples is Red (0), Green (1), Blue (2).
The filters are learned, so you don’t necessarily know exactly what they’re going to do in advance.