Yang
Yang

Reputation: 9972

How to render the same scene with different cameras in three.js?

I had a scene set up and I want two cameras watch the same scene at a different angle, front & back. I tried something like this:

renderer.setViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT/2);
renderer.render(scene, camera);

renderer.setViewport(0, SCREEN_HEIGHT/2, SCREEN_WIDTH, SCREEN_HEIGHT/2);
renderer.render(scene, testcamera);

But the 2nd view which is back never showed up. Any idea why?

Upvotes: 6

Views: 5209

Answers (1)

Neil
Neil

Reputation: 8121

A couple of examples I have bookmarked, there is an interesting post using a render manager:

http://bkcore.com/blog/3d/webgl-three-js-extension-rendermanager.html

And also in the three.js examples:

http://mrdoob.github.com/three.js/examples/webgl_multiple_views.html

Upvotes: 4

Related Questions