The model is not clear in orthogonal camera

I’ve already set engine.setHardwareScalingLevel(0.4), but when I set camera.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA, The model becomes extremely small。

I want to make the model bigger. How do I do that?

I tested it at palyground. Link:https://playground.babylonjs.com/#UKNERM#403。

var createScene = function () {
var scene = new BABYLON.Scene(engine);
engine.setHardwareScalingLevel(0.4);

//Adding a light
var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);

//Adding an Arc Rotate Camera
var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, false);

camera.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA;
// camera.orthoTop = 10
// camera.orthoBottom = 10
// camera.orthoLeft = 10
// camera.orthoRight = 10


// The first parameter can be used to specify which mesh to import. Here we import all meshes
BABYLON.SceneLoader.ImportMesh("", "scenes/", "skull.babylon", scene, function (newMeshes) {
    // Set the target of the camera to the first imported mesh
    camera.target = newMeshes[0];
});

// Move the light with the camera
scene.registerBeforeRender(function () {
    light.position = camera.position;
});

return scene;

}

Hello and welcome to the Babylon community! You have to specify orthoBottom and orthoLeft in negative values: PGDemo | Babylon.js Playground (babylonjs.com)

Or instead of using hard coded values, you could use the model size as a basis: PGDemo | Babylon.js Playground (babylonjs.com) :slight_smile:

1 Like

Thanks for your advice. I’ll give it a try :grin:

If you want to avoid distortions, you can take into account the screen aspect ratio:

1 Like

One thing I like to do when working with orthographic is set up a Pixel to Unit ratio then decided how many units the scene would naturally like to show. I just did this in a PG funny enough last night.

From there you can also add a “zoom” variable or just change the “targetUnits”. This can either be for the height or the width or whichever you decide to be your ground truth (you can even go fancier and switch between the two depending on current ratios of the scene)

Starts on line 85