Jump to content

Rendering real-size (&small) objects from Blender


Pawel W
 Share

Recommended Posts

Hello, 

 

Can someone please help me with setting correct model/scene for small scale object from Blender?

 

I'm trying to create 3d-product preview for image html5 image editor (the idea is so user can edit canvas on the left, and it gets updated on the right babylon 3d scene, and the products must be real world size).

 

 

The problem is that imported scene is realy small - object is very tiny, and zooming it creates too much movement

 

Object is just a simple cup and is ~ 15cm x 9 cm x 9cm.

 

You can check it - here is blender model:

https://www.dropbox.com/s/rj6bn142dkv4v6j/cup.blend?dl=0

 

 

Function I use to display scene:

 

 BABYLON.SceneLoader.Load("", "images/CUP/source/cup.babylon", this.sceneVars.engine, function (newScene) {
                    newScene.executeWhenReady(function () {
                        $scope.babylon.sceneVars.scene = newScene;
                        var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, 1.0, 1, new BABYLON.Vector3(0, 1, 0), newScene);
                             newScene.activeCamera = camera;
                             newScene.activeCamera.attachControl($scope.babylon.sceneVars.canvas);
                             newScene.clearColor = new BABYLON.Color4(1,0,0,0);
                        $scope.babylon.sceneVars.engine.runRenderLoop(function() {
                            newScene.render();
                        });
                    });
                }, function (progress) {
                });

 

 

Is there something wrong with camera position, or maybe with blender model?

 

 

Link to comment
Share on other sites

Yes, your cup is very small in Blender. But you can either try scaling up the model and testing again, or else simply move your camera closer in code. Also, to make things easy on you for coding, perhaps move the cup so it sits at 0,0,0 on the stage?

Link to comment
Share on other sites

Thank you!

 

I've put camera inside blender reallly close (almost covers the object), then set object's position to 0,0,0 rendered object and it worked!

I also had to change wheel precision and angular sensibility to fit small object. 

 

For those who get similar problems, here is my babylon camera params:

 

var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, 1.0, 0.2, new BABYLON.Vector3(0, 0, 0), newScene);
camera.angularSensibility = 700;
camera.wheelPrecision = 300;
 
Now cup is rendered properly and has real world dimensions :)
I'm having some problems with texturing mesh, but that is another subject I guess.
Thanks again!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...