本文介绍了Three.js StereoEffect 不能应用于 CSS3DRenderer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Chrome VR 网络应用.现在我拼命地想弄清楚如何将网站渲染到我的立体场景中,其中有一些网格.

I'm in the process of developing a chrome VR web app. Now I'm desperately trying to figure out how to render a website into my into my stereoscopic scene which has some meshes in it.

所以我有我的网格渲染器,效果很好.以下代码只是相关的片段:

So I have my renderer for the meshes, which works well. The following code is only the relevant snippets:

var renderer = new THREE.WebGLRenderer();

然后我有我的立体效果渲染器,它接收 webgl 渲染器:

Then i have my stereoeffect renderer which receives the webgl renderer:

var effect = new THREE.StereoEffect(renderer);

接下来是我创建网站渲染器,并将其应用于立体效果:

Next is that I create the website renderer, and apply it to the stereoeffect:

var rendererCSS = new THREE.CSS3DRenderer();
var effectHUD = new THREE.StereoEffect(rendererCSS);

然后我有正在渲染的场景:

Then I have scenes which are being rendered:

var scene = new THREE.Scene();
var sceneCSS = new THREE.Scene();
function render(dt) {
      effect.render(scene, camera);
      effectHUD.render( sceneCSS, camera );
    }

不,我收到的是这个:

我的网格的立体图像,但网站的非立体图像.问题是当我尝试将 css 渲染器添加到 StereoEffect 渲染器时,缺少 setViewport 函数(可能还有其他函数).
我已经尝试将网站对象添加到 webgl 渲染器,但它不想渲染我的网站,因此将网站对象添加到带有网格的场景中不起作用.

A stereoscopic image of my mesh, but a non stereoscopic image of the website. The problem is that the when I try to add the css renderer into the StereoEffect renderer, the setViewport function (among others, probably) are missing.
I've tried adding the website object to the webgl renderer, but it doesn't want to render my website, so adding the website object to the scene with the meshes doesn't work.

非常感谢任何帮助!

推荐答案

我遇到了同样的问题.似乎有一个 CSS Stereo 渲染器,但它已与所有示例一起被删除.这可能出于多种原因,因此请谨慎使用以下内容,或者直到它们重新引入兼容性:搜索后,我找到了他们演示的剩余副本,您可以从中挖掘代码并复制其 CSS3DstereoRenderer.js 文件.

I've been having the same problem.It appears there was a CSS Stereo renderer but it's been removed along with all examples. This could have been for any number of reasons so use the following with caution, or until they reintroduce compatibility:After searching I found a remaining copy of their demo from which you can mine the code and copy its CSS3DStereoRenderer.js file.

希望这会有所帮助.

这篇关于Three.js StereoEffect 不能应用于 CSS3DRenderer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 00:39