tilo tilo - 1 month ago 13
Javascript Question

Threejs remove previous rendered scene

I created a renderer scene in threejs. When I load a model for the second time, I want to remove the previous rendered scene from th canvas. Is there any possible solution in threejs???

Answer

You can clear the canvas using

[WebGLRenderer].context.clear(16640); // 16640 is (COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT)
// Replace [WebGLRenderer] with your instance of the renderer