Skip to content

The reflection of Reflector is stretched when the camera has view offset #30587

@ProgramEverything

Description

@ProgramEverything

Description

I am using the Reflector to render the reflection on a mesh. When the camera isn't set with the view offset, everything's ok. But when the camera is set with a quite large view offset, as the object being reflected is on the edge of the view, the reflection is stretched.

Reproduction steps

  1. setup a scene with a perspective camera
  2. set the view offset of the perspective camera with
camera.setViewOffset(
    window.innerWidth,
    window.innerHeight,
    offset.x,
    offset.y,
    window.innerWidth,
    window.innerHeight
  );
  1. when the offset.x is quite large, the object being reflected is on the edge of the view, the reflection is stretched

Code

please see the codes in the live example

Live example

the following example uses the original reflector, you can see the strech when the offset x is set around 500


I think the problem is related to the view offset of the reflector camera. I comment the

virtualCamera.projectionMatrix.copy( camera.projectionMatrix );

in the source code of Reflector.js. Then the stretch is disappeared in some cases. When the camera is dollyed in , it appeared again. I don't know if this is helpful.

Screenshots

the original reflector
Image

my reflector, solves the stretch only in some certain cases, as below
Image
when the camera is dollyed in , it appeared again, even without the view offset.
Image

Version

r172

Device

No response

Browser

No response

OS

No response

another guy also notices the same problem, link is here: Using Camera.setViewOffset with Reflector stretches the reflected texture in three.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions