12. The maximum value of the function $y=\sin ^{2} x(1+\cos x)$ is $\qquad$
12. $\frac{32}{27}$.
$$
y=(1-\cos x)(1+\cos x)(1+\cos x)=(2-2 \cos x)(1+\cos x)(1+\cos x) \cdot \frac{1}{2} \text {, and } 2-
$$
$2 \cos x \geqslant 0,1+\cos x \geqslant 0$, so $y \leqslant \frac{1}{2}\left[\frac{(2-2 \cos x)+(1+\cos x)+(1+\cos x)}{3}\right]^{3}=\left(\frac{4}{3}\right)^{3}$.
$\frac{1}{2}=\frac{32}{27}$, when and only when $1+\cos x=2-2 \cos x$, i.e., $\cos x=\frac{1}{3}$, $y$ achieves its maximum value of $\frac{32}{27}$.