Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL Mirror Example Artifacts #11969

Closed
WestLangley opened this issue Aug 17, 2017 · 5 comments
Closed

WebGL Mirror Example Artifacts #11969

WestLangley opened this issue Aug 17, 2017 · 5 comments
Labels

Comments

@WestLangley
Copy link
Collaborator

Artifacts may be reproduced by zooming in and moving the camera a bit.

https://threejs.org/examples/webgl_mirror.html

screen shot 2017-08-16 at 8 53 26 pm

Three.js version
  • [ x ] Dev
  • [ x ] r86
Browser
  • [ x ] Chrome
OS
  • [ x ] macOS
@RemusMar
Copy link
Contributor

Indeed.
Also see this topic: #11885
At the end I get the feeling the Mirror is not properly implemented.

@Mugen87 Mugen87 added the Bug label Aug 17, 2017
@vanruesc
Copy link
Contributor

The main camera's aspect ratio is never copied to the mirror camera.

// "examples/Mirror.js" (lines 142-146)
mirrorCamera.near = camera.near;
mirrorCamera.far = camera.far;
mirrorCamera.updateMatrixWorld();
mirrorCamera.updateProjectionMatrix();

Should be changed to:

mirrorCamera.updateMatrixWorld();
mirrorCamera.projectionMatrix.copy(camera.projectionMatrix);

I'll send a PR for this later!

Another problem with the mirror (and the planar ocean) is that it doesn't seem to work when thelogarithmicDepthBuffer is enabled. Oblique near plane clipping messes with depth and I never found a solution for this. I wish WebGL had glClipPlane 😞

@mrdoob mrdoob closed this as completed in a9f0ab3 Aug 18, 2017
@mrdoob
Copy link
Owner

mrdoob commented Aug 18, 2017

@vanruesc I was messing with the code so I implemented it directly. Many thanks!

@WestLangley
Copy link
Collaborator Author

@mrdoob If you are still messing around, I think there is room for simplification...

//mirrorCamera.up.set( 0, - 1, 0 );
//mirrorCamera.up.applyMatrix4( rotationMatrix );
//mirrorCamera.up.reflect( normal ).negate();

mirrorCamera.up.set( 0, 1, 0 ).applyMatrix4( rotationMatrix ).reflect( normal );

@mrdoob
Copy link
Owner

mrdoob commented Aug 18, 2017

@WestLangley Thanks!

ofrohn pushed a commit to ofrohn/three.js that referenced this issue Jun 17, 2018
ofrohn pushed a commit to ofrohn/three.js that referenced this issue Jun 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants