三.js 在不同场景/div 中使用相机纹理 [英] three.js use camera texture in different scenes/ div

查看:48
本文介绍了三.js 在不同场景/div 中使用相机纹理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在将相机渲染到纹理并将纹理放在平面网格上.这是有效的,在场景中记录了纹理.

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.

将相同的网格放入在 div 中运行的不同场景时,网格显示出来,没有纹理.同样,当我将纹理放在网格上时,网格是在 div 场景中创建的.

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.

当我将网格放入主场景和 div 场景的两个场景中时,网格仅显示在主场景中,相机从其中拍摄照片,而不管哪个先添加到它的"场景中.

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.

提前致谢.

推荐答案

所以我在找到你的问题之前问了一个类似的问题和一个友好的用户 ther 回答了我的问题.(我还不能给他点赞,但作为回答问题的人,我相信他应该得到一些)

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)

三.js 渲染目标纹理不会在不同的场景中绘制

总而言之,解决方案是使用相同的渲染器来渲染场景以及您想要查看的相机.

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

这篇关于三.js 在不同场景/div 中使用相机纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆