How to render scene with perspective and other with orthographic by the same renderer

Am facing a very tough issue which is

I intended to render some objects with perspective view and some others with orthographic view at the same canvas by the same webglRenderer

So I initialised 2 scenes , a perspective camera and
Orthographic camera

Then I initialised a webglRenderer

Any objects I want to render as perspective view I added to the first scene
And any objects I want to render as orthographic I added to the other scene

At the render function I wrote

WebGLRenderer.render(pScene,pCamera);
WebGLRenderer.render(oScene,oCamera);

But always only one scene appears which is the last rendered one

What should I do to make the two scenes appear together???

Please help…

  1. Make sure you’re setting renderer.autoclear = false; as outlined in the docs
  2. You’ll have to manually call clear() at the beginning of the frame, but not in between renders:
WebGLRenderer.clear();
WebGLRenderer.render(pScene,pCamera);
WebGLRenderer.render(oScene,oCamera);
1 Like

Isn’t it more correct to set the flag to false in @HeshamSaleh’s scenario?

Why is this necessary?

1 Like

Haha! I knew I was making a mistake by posting at 2am. Thanks for catching that, I edited my answer.

3 Likes