Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 806
Yang Avatar asked Nov 01 '12 09:11

Yang


1 Answers

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

like image 196
Neil Avatar answered Oct 05 '22 09:10

Neil