Whenever I use .optimize() on a node, it comes back without shadows. I can easily set back the shadow mode, but is this supposed to happen?
Yes. Actually the optimize() creates a new geometry with default shadows behavior (which is Off).
@nehon So should I group geometries into different nodes with different shadow modes, optimize each of them, and then set their shadow modes?
Well you can set the shadow mode only once after the optimization.