How To get 2D Snapshot [like panoramic] of whole 3D Three.js Scene?

拟墨画扇 提交于 2019-12-25 07:28:30

问题


How To get 2d Snapshot of Three.js 3D Scene ?? I need to get 2D Snapshot of my 3D scene like a panoramic image.(Full 360 snapshot)

Demo Used:- http://patcat.com/demos/VRWeatherParticles/

I tried this solution :- 1.How do you save an image from a Three.js canvas? 2. Three.js: How can I make a 2D SnapShot of a Scene as a JPG Image?

When i do (what mentioned in Link 2):-

renderer = new THREE.WebGLRenderer({
preserveDrawingBuffer: true
});

var strMime = "image/jpeg";
imgData = renderer.domElement.toDataURL(strMime);
imgData1 = renderer.domElement.toDataURL();

I am getting the String base64, but i am not able to decode (used online tools [http://codebeautify.org/base64-to-image-converter]) it properly. Only Black Image is coming up.

Please let me know how to get :- 2D Snapshot of my 3d scene like a panoramic image.

NOTE:- Similar Question should have worked, but it is not working for me.


回答1:


Solution is suggested to me by Gman . I am shearing it with community for their benefit.

"CubemapToEquirectangular" library helps as in getting panoramic image of 3D scene.

Link:- https://github.com/spite/THREE.CubemapToEquirectangular

Demo Solution:- https://www.clicktorelease.com/tools/CubemapToEquirectangular/index-managed.html

Thanks and Regards

Kautuk Sahni



来源:https://stackoverflow.com/questions/38896297/how-to-get-2d-snapshot-like-panoramic-of-whole-3d-three-js-scene

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!