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

Camera near and far not working #27310

Closed
kffami opened this issue Dec 5, 2023 · 0 comments
Closed

Camera near and far not working #27310

kffami opened this issue Dec 5, 2023 · 0 comments

Comments

@kffami
Copy link

kffami commented Dec 5, 2023

Description

I want to use three to create a costumed character, and I need to see the character's face, but when I zoom in on the character, the character's face disappears. I guess it's a problem with the near and far settings of the camera. I modified the near and far parameters of the camera but the character's face cannot be displayed, and the screen even goes black. In Unity or Maya, whenever this kind of problem occurs, setting the near and far parameters of the camera can solve it. However, in threejs, it does not solve my problem. I think this is a bug.
cs

Reproduction steps

1.When I use the mouse wheel to zoom out, the character's face is displayed.
2.When I use the mouse wheel to zoom in, the character's face is not displayed.

Code

const scene = new THREE.Scene();

const defaultMap = {
x: 20,
y: 20,
z: 20,
}

let whRate=window.innerWidth/window.innerHeight;
const camera = new THREE.PerspectiveCamera(70, whRate, 1, 1000);
camera.position.set( 0, 10, 20 );

var lights = [];
lights[0] = new THREE.PointLight(0xffffff,1.5, 50, 0);
lights[0].position.set(0, 180, -200);
scene.add(lights[0]);

loader.load('/src/models/dHuman_g.glb', function(obj){
let mesh = obj.scene.children[0];
mesh.material=new THREE.MeshBasicMaterial( { color: 0x00ff00 ,side:THREE.DoubleSide} );
mesh.position.set(0, -20, 0);
mesh.scale.set(1, 1, 1);
mesh.scale.setScalar(10);
scene.add(mesh);
})

const render = () => {
renderer.render(scene, camera);
requestAnimationFrame(render);
}
render();

Live example

I think the above description makes it clear what the problem is.

Screenshots

No response

Version

node v20.8.0;npm v10.1.0;

Device

No response

Browser

Firefox

OS

Windows

@kffami kffami closed this as completed Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant