Thank you very much.I’m having a problem with the WebGLRenderTarget that doesn’t show up when I create it
this.cameraPara = {
"fov": 90,
"aspect": this.container.offsetWidth / this.container.offsetHeight,
"near": 1,
"far": 1000
};
this.RTScene = new THREE.Scene();
this.RTcamera = new THREE.PerspectiveCamera(_this.cameraPara.fov, _this.cameraPara.aspect,
_this.cameraPara.near, _this.cameraPara.far);
this.RTcamera.position.set(0.1, 1, 1);;
var geometry = new THREE.PlaneGeometry(384, 192, 3, 3);
const texture = new THREE.VideoTexture(video);
texture.maxFilter = THREE.NearestFilter;
texture.minFilter = THREE.NearestFilter;
const material = new THREE.MeshLambertMaterial({ map: texture, side: THREE.DoubleSide });
var mesh = new THREE.Mesh(geometry, material);
mesh.position.z = 200
this.RTScene.add(mesh);
const RenderTarget = this.RenderTarget = new THREE.WebGLRenderTarget(
3840,
1920,
);
var scene = this.scene;
var camera = this.camera;
const geometry = new THREE.SphereGeometry(
30,
32,
32,
);
geometry.scale(-1, 1, 1)
var RenderTargettexture = this.RenderTarget.texture;
const material = new THREE.MeshBasicMaterial({ map: RenderTargettexture, side: THREE.DoubleSide });
material.map.needUpdate = true;
var mesh = new THREE.Mesh(geometry, material);
mesh.name = "vrliveBox";
this.VRObject.add(mesh);
this.scene.add(mesh);
this.renderer.render(scene, camera);
render() {
var width = this.container.offsetWidth;
var height = this.container.offsetHeight;
var scene = this.scene
var camera = this.camera
this.renderer.setSize(width, height);
var _this = this;
if (this.RenderTarget !== null) {
this.renderer.setRenderTarget(_this.RenderTarget);
this.renderer.setClearColor(0xffddff);
this.renderer.clear();
this.renderer.render(_this.RTScene, _this.RTcamera)
}
this.renderer.setRenderTarget(null);
this.renderer.render(scene, camera);
}
I don’t know if there’s something wrong with the code, but it’s black in the display
I want the video to render on the SphereGeometry
If you need to provide other comments please say, I do not know WebGLRenderTarget, please forgive me
Thank you very much