1

I'm using perspective camera and want to make distant object visual size like close objects.

I check distance from close and distant objects

function getDistance(mesh1, mesh2) {
    var dx = mesh1.position.x - mesh2.position.x;
    var dy = mesh1.position.y - mesh2.position.y;
    var dz = mesh1.position.z - mesh2.position.z;
    return Math.sqrt(dx*dx+dy*dy+dz*dz);
}

and check every loop:

var diff = (getDistance(camera, mesh5) - getDistance(camera, mesh1)) / (getDistance(camera, mesh5) + getDistance(camera, mesh1)) * 100;
console.log(diff);
mesh5.scale.set(diff, diff, 1);

But size is not equivalent.

skywind
  • 892
  • 6
  • 22
  • 44

0 Answers0