# Babylon - fundamental Camera and Light problem from Blendr scene

**URL:** <https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424>\
**Category:** Questions\
**Created:** [September 2, 2019, 4:58pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424 "2019-09-02T16:58:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Wong](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kevin_wong/32/4271_2.png) [@Kevin\_Wong](https://forum.babylonjs.com/u/Kevin_Wong)\
**Post date:** [September 2, 2019, 4:58pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/1 "2019-09-02T16:58:38Z")

</div>

Hi All,

I’m new to BabylonJS. MY code below is based off the babylon js tutorials.

I’ve created a scene in blender 2.8 and exported into .babylon format, using the blendr2babylon exporter 6.2.0

I’m trying to get babylon to make use of the camera and lights that i created in blendr.

I’ve managed to load my .ba﻿bylon scene file using LoadAssetContainer.

U will notice i create an Arc camera first, because that was part of tutorial code. The only way i could find to make use of the Blendr camera was to explicitly set the active camera, but i realize it loses the “Arc” capabilty, and it results in a fixed camera which doesn’t move.

scene.activeCamera = container.cameras[0];

Questions:

- Could someone show me how to make proper use of Blendr Camera thorugh code or settings? My camera type in Blendr is Universal which i thought would automatically be able to “move” around in babylon using the keys.

- Could someone show me how to make use of Blendr lights? I have a “Sun” light in blendr which i understand is supposed to be converted to “directional” in babylon, but when rendering the babylon scene, its obvious my “sun” is not there, as its darkish and the trees don’t cast shadows?

Kevin

> var canvas = document.getElementById(“renderCanvas”); // Get the canvas element  
> var engine = new BABYLON.Engine(canvas, true); // Generate the BABYLON 3D engine
> 
> var createScene = function () {
> 
> ```
> // Create the scene space
> var scene = new BABYLON.Scene(engine);
> 
> var camera = new BABYLON.ArcRotateCamera("BabylonCamera", 0,0,5, new BABYLON.Vector3(0,0,0), scene);
> camera.attachControl(canvas, true);
> 
> // Add lights to the ﻿scene
> var light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
> var light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 6, -1), scene);
> 
> ```
> 
> BABYLON.SceneLoader.LoadAssetContainer(“assets/”, “NatureScene.babylon”, scene, function (container) {  
> var meshes = container.meshes;  
> var materials = container.materials;
> 
> ```
> if(container.cameras[0]){
>   	
> scene.removeCamera(camera)
> scene.activeCamera = container.cameras[0];
> 
> }
> 
> // Adds all elements to the scene
> container.addAllToScene();
> 
> ```
> 
> });
> 
> ```
> return scene;
> 
> ```
> 
> };  
> /\*\*\*\*\*\*\* End of the create scene function \*\*\*\*\*\*/
> 
> var scene = createScene(); //Call the createScene function
> 
> // Register a render loop to repeatedly render the scene  
> engine.runRenderLoop(function () {  
> scene.render();
> 
> });

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 2, 2019, 5:01pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/2 "2019-09-02T17:01:19Z")

</div>

Maybe @JCPalmer can help as he is the mastermind behind the blender exporter 🙂

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 2, 2019, 5:01pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/3 "2019-09-02T17:01:41Z")

</div>

and by the way Welcome to the forum !!!

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [September 2, 2019, 5:25pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/4 "2019-09-02T17:25:20Z")

</div>

On the camera, ditch the one in code. Whether you do it in a callback, or like this, just attach it.

```javascript
const canvas = document.getElementById("renderCanvas");
const engine = new BABYLON.Engine(canvas, true);

BABYLON.SceneLoader.Append(url, "armature.babylon", scene);
scene.executeWhenReady(function () {
   // Attach camera to canvas inputs
    scene.activeCamera.attachControl(canvas);

    // Once the scene is loaded, register a render loop
    engine.runRenderLoop(function() {
        scene.render();
    });
});

```

To use an exported ArcRotate camera, in addition to setting the type in the exporter properties, you need to add a `track to` constraint on the camera. This is done different in 2.80. Set the target to the mesh you want. It does not matter for export, but you probably want change the `To` to Z, so if you did test views in blender, the camera is not pointing to the ground.

Shadows are not automatically transferred. You need to check the `Receives Shadows` or `Casts Shadows` on the appropriate meshes, exporter properties. The light must also have a shadow generator set in the exporter propeties for lights. FYI, when you export in PBR, shadows can be very faint, depending on your environment texture & its intensity. Switching to a STD materials export can give you an sanity check.

---

<div class="post-metadata">

**Author:** ![Kevin\_Wong](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kevin_wong/32/4271_2.png) [@Kevin\_Wong](https://forum.babylonjs.com/u/Kevin_Wong)\
**Post date:** [September 3, 2019, 6:40pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/5 "2019-09-03T18:40:31Z")

</div>

Thank you Sebavan! Glad to be part of the community!

---

<div class="post-metadata">

**Author:** ![Kevin\_Wong](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kevin_wong/32/4271_2.png) [@Kevin\_Wong](https://forum.babylonjs.com/u/Kevin_Wong)\
**Post date:** [September 4, 2019, 5:24am UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/6 "2019-09-04T05:24:15Z")

</div>

Thank you JCPalmer, that seems to work for the camera and code is much simpler. I will start to troubleshoot the lights / shadows. Thank you!!!

---

<div class="post-metadata">

**Author:** ![Kevin\_Wong](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kevin_wong/32/4271_2.png) [@Kevin\_Wong](https://forum.babylonjs.com/u/Kevin_Wong)\
**Post date:** [September 7, 2019, 4:55pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/7 "2019-09-07T16:55:34Z")

</div>

Hi JCPalmer,

I’m reading the docs here  
[https://doc.babylonjs.com/resources/blender#cameras](https://doc.babylonjs.com/resources/blender#cameras)  
[https://doc.babylonjs.com/resources/blender\_tips#arcrotate](https://doc.babylonjs.com/resources/blender_tips#arcrotate)

One thing stated in the 2nd link is that Babylon and Blender do alot of things differently.

With that said:

1. while in using your code i got the camera from Blender to ‘work’ in Babylon, I don’t get the other settings carried across such as Field of View

2. My blender light settings (intensity, shadows), don’t seem to be carried across, screenshot in Blender vs Babylon below. Are basic settings like intensity not carrying across? is there something i need to do in code?

Screenshots showing light intensity and camera FOV not carrying across from Blender to Babylon

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/d/d17f23caeda1a2a9c0f3928efd00b798bf804b1b.jpeg)

---

<div class="post-metadata">

**Author:** ![Kevin\_Wong](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kevin_wong/32/4271_2.png) [@Kevin\_Wong](https://forum.babylonjs.com/u/Kevin_Wong)\
**Post date:** [September 9, 2019, 1:22am UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/8 "2019-09-09T01:22:03Z")

</div>

@JCPalmer or anyone would you be able to provide some guidance around this? 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 9, 2019, 4:59pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/9 "2019-09-09T16:59:36Z")

</div>

maybe @Vinc3r

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [September 9, 2019, 7:38pm UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/10 "2019-09-09T19:38:38Z")

</div>

FOV is transferred. Never seen what you are showing for lights. They are not lights created in 2.80. Old lights from scenes prior to 2.80 have different properties.

---

<div class="post-metadata">

**Author:** ![Vinc3r](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vinc3r/32/25340_2.png) [@Vinc3r](https://forum.babylonjs.com/u/Vinc3r)\
**Post date:** [September 10, 2019, 7:58am UTC](https://forum.babylonjs.com/t/babylon-fundamental-camera-and-light-problem-from-blendr-scene/5424/11 "2019-09-10T07:58:41Z")

</div>

Erf, first at all, Blender Exporter doc’ should be update about 2.8. It could be a nice idea to share very basic Blender example scenes by the way isn’t it ? (I have to say that since I’m using a lot gltf now, I haven’t yet test .babylon exporter on 2.8…)
