Reflector as mirror, Need help!

Hi everyone,
I am trying to use the render target of the reflector as envmap rendertarget in panel as mirror, but its showing just dark and nohting. I dont want to use cubeCamera as mirror because it uses too much proformance and runs very luggy and buggy.
Reflector as a very good mirror but its on scene as an seperate Object and i don want to use it as and seperate Obj.

thanks in Advance

		let geometry = threeMesh.geometry
		let verticalMirror = new THREE.Reflector(geometry, {
			textureWidth: window.innerWidth * window.devicePixelRatio,
			textureHeight: window.innerHeight * window.devicePixelRatio,
		});
		verticalMirror.position.copy(centerPoint);
		verticalMirror.position.z += 10;
		this.material.envMap = verticalMirror.getRenderTarget().texture;

I’m afraid what you are trying to achieve does not work.

Environment maps have to be in the cube map, equirectangular or cubeUV (PBR only) formats. You can’t assign an ordinary texture. Not event from a render target.

Thanks for replying But, I did it with cube camera and it makes very slow and is magnifying the target. I want to use reflector as mirror just like cubeCamera.
btw. I am working on many kinds of mirrors, which has many kinds of properties like color and opacity even texture in it. I need your Help Mugen87. I searched alot in google and I see you overall :slight_smile:

var cubeCamera = new THREE.CubeCamera(1, 1000, 512);
		cubeCamera.position.set(centerPoint.x, centerPoint.y / 1.2, (centerPoint.z));


		this.material.envMap = cubeCamera.renderTarget.texture;
		this.material.combine = THREE.MixOperation;
		threeMesh.userData.mirrorCamera = cubeCamera;

So what is the solution? should I make the renderTarget a cubetarget or something like this.
The Threejs website has a lack of Documentation. Nothing found When I search like Mirror, or Reflector or Envmap to see the options.

regards,

I can only tell you that using Reflector is not an option if you need an environment map. Both things are technically incompatible.

You have to work with a reflection probe which is in three.js a cube camera.

what Mugen87 is saying, in other words, is that if you want to use reflector’s texture as environment map in a built-in material, you will have to replace its environment mapping logic with that of a reflector. since this is not something that people normally do, he does not recommend it :sweat_smile: but if you are really determined, look up onBeforeCompile examlpes.

that would be because you are placing the cube camera incorrectly. it is supposed to go behind the mirror, where your actual camera reflection would be.

The cube camera has to be placed at the object’s position that has the environment map applied. The idea is to keep the reflector in the scene but use the result of the cube camera for the reflections on the sphere.

how many times do I need to show you this fiddle before you accept that you are wrong :pensive: