Export lights, cameras, etc from Blender

I’d like to know if the Three.js exporter for Blender is able to export lights and cameras, as he does with materials and textures.

Clearly, I can export a textured material created in Blender, which I can load successfully in my Three.js app. Now I’d also like to export the cameras and lights I’ve set in my Blender project. The best thing would be that I export all this stuff and then access it in my JavaScript code just like when I instantiate camera and lights in a normal way.

Is this possible ?

Thanks

Author: Fantashit

1 thought on “Export lights, cameras, etc from Blender

  1. Enable scene exporting.
    screen shot 2015-04-08 at 8 31 29 am

    Once you use ObjectLoader() to parse the json and get the scene object you will need to iterate over children and locate the camera and set that as the active camera for the renderer.

    for ( var i = 0; i < scene.children.length; i ++ ) {
    
       child = scene.children[ i ];
    
        // either do an instanceof() too look for a class
        if ( child instanceof THREE.PerspectiveCamera ) {
            ...
    
        // or search by name
        if ( child.name === 'shotCam' ) {
            ...
    
    ...
    

Comments are closed.