Take a look at this example. BeginnerExample step3 + step15
From the Collection of examples from discourse.threejs.org