three.js use camera texture in different scenes/ div

混江龙づ霸主 提交于 2019-12-25 07:01:06

问题


at the moment, I am rendering a camera to a texture and put the texture on a plane mesh. This works, in the scene the texture was recorded from.

When putting the same mesh into a different scene, which is running in a div, the mesh shows up, without texture. Same, when I put the texture on a mesh, which is created in the div- scene.

The mesh seems to have a texture, because it is black and not red, as initialized. When leaving away the texture, it does show up in red.

When I put the mesh into both scenes, which is the main scene and the div-scene, the mesh only shows in the main scene, the camera takes its shots from, regardless which one addad first into "its" scene.

Please be so kind and tell me, how I can use this texture, in a different scene.

Thanks in advance.


回答1:


I don't quite understand what are you doing. But you can save your image as a canvas and create new texture from it.




回答2:


So I've asked a similar question before finding your question and a friendly user by the name of ther answered my question. (I wasn't able to upvote him yet but as someone who answered a question I believe he deserves some)

THREE.js Render target texture will not draw in a different scene

In summary, the solution was to use the same renderer to render the scenes along with the camera you'd like to view through.



来源:https://stackoverflow.com/questions/32441264/three-js-use-camera-texture-in-different-scenes-div

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