question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Orthographic camera?

See original GitHub issue

Hi!

I am using this piece of code to change the view from Perspective to Orthographic and back:

function toggleCamera() {
    if (camera instanceof THREE.PerspectiveCamera) {
        camera = new THREE.OrthographicCamera(window.innerWidth / -16, window.innerWidth / 16, window.innerHeight / 16, window.innerHeight / -16, -200, 500);
        camera.position.set(0, 0, 500);
        camera.name = 'Camera';
        camera.up.set(0,0,1);
        camera.lookAt(scene.position);
    } else {
        camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 5000);
        camera.position.set(0, -1500/2, 1000/2);
        camera.up.set(0,0,1);
        camera.lookAt(scene.position);
        camera.name = 'Camera';
    }
	// the orbit controls to rotate the camera
	controls = new THREE.OrbitControls(camera, container);
	controls.enableDamping = true;
	controls.dampingFactor = 0.25;
	controls.rotateSpeed = 1.0;	     
}

I obtain the following: perspectivecamera orthographiccamera

where one can see that the orthographic has lines all around.

Is that a bug or me misusing the API?

BR M

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
spitecommented, Nov 15, 2016

You’re using it right, it’s probably a problem with the shader math. I never thought of testing it with an OrthographicCamera, so definitely some things are different. I’ll check it out.

1reaction
gaitatcommented, Feb 24, 2017

Is there a correlation between lineWidth for a perspective camera and lineWidth for an orthographic camera?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with orthographic camera · Issue #20314 · mrdoob/three.js
Keep in mind that when using OrbitControls with an orthographic camera, the zoom is no dolly. Meaning the camera does not move along...
Read more >
Orthographic Camera Issue - Unity Forum
Orthographic camera setup in my game. Camera settings ... I think issue occurs while Clipping Planes - Near is set to negative number....
Read more >
Orthographic view problems - camera position - Rhino
Hi I have to render some elevations, but everytime I load the view is always in a different position. I set the camera...
Read more >
ThreeJS raycasting problem with an Orthographic camera in ...
Also, the near value of your orthographic camera is invalid. From the documentation: The valid range is between 0 and the current value...
Read more >
problem with orthographic camera - LuxCoreRender Forums
problem with orthographic camera ... Hi, I've a simple scene: a box with open top, roughly a quarter of the top covered by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found