Let
$$
f(x)=3ax^2-6x^3
$$
and, for each real number $a$, let $M(a)$ be the greatest value of $f(x)$ in the interval
$$
-\tfrac13\leqslant x\leqslant1.
$$
Determine $M(a)$ for $a\geqslant0$. [The formula for $M(a)$ is different in different ranges of $a$; you will need to identify three ranges.]