Giter Site home page Giter Site logo

n1ckfg / three.sixdof Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juniorxsound/three.sixdof

0.0 1.0 0.0 14.64 MB

๐ŸŒ Plugin for rendering 6DOF equirectangular 360 images and videos with depthmaps

Home Page: https://juniorxsound.github.io/THREE.SixDOF

License: MIT License

JavaScript 15.58% TypeScript 57.99% GLSL 26.43%

three.sixdof's Introduction

THREE.6DoF


Plugin for rendering 6DoF equirectangular 360 images and video with depthmaps ๐ŸŒ


Getting started โ€ข Examples โ€ข API โ€ข Thanks

Getting started

To quickly get started include the latest three-6dof.js after including three.js in your project. Next create your 6DoF viewer like

// Create the loader
var loadingManager = new THREE.LoadingManager();
var textureLoader = new THREE.TextureLoader(loadingManager);

// Load the textures
var colorTexture, depthTexture;
textureLoader.load('360_color_image.jpg', texture => { colorTexture = texture });
textureLoader.load('360_depth_image.jpg', texture => { depthTexture = texture });

// On finish loading create the viewer with the textures
loadingManager.onLoad = () => {
    sixDofViewer = new SixDOF.Viewer(colorTexture, depthTexture);
    scene.add(sixDofViewer);
}

Using with ES6

If you are using yarn with ES6 you can also

yarn add https://github.com/juniorxsound/THREE.SixDOF

You can import the plugin by simply

import { 
    Viewer,
    TextureType,
    MeshDensity, 
    Style
} from 'three-6dof'

Examples

API

When creating a viewer you pass the following parameters

const instance = new Viewer(
    colorTexture, // Or top bottom texture
    depthTexture, // Optionally
    {
        'type': TextureType.SEPERATE, // For seperate depth and texture (for single top bottom use TextureType.TOP_BOTTOM)
        'style': Style.WIRE, // Chooses the rendering style (defaults to Style.MESH)
        'density': MeshDensity.EXTRA_HIGH // Chooses geometry tesselation level
        'displacement': 4.0, // Defaults to 4.0
        'radius' : 6 // Defaults to 6
    }
)

For a full list of options see the constants.ts file.

  • instance.texture - get the THREE.Texture

  • instance.depth - get the THREE.Texture depth map (null if none)

  • instance.displacement - get or set the displacement amount

  • instance.pointSize - get or set the point size when rendering points

  • instance.opacity - get or set the material's opacity

  • instance.config - returns the current config object

  • instance.toggleDepthDebug(state) - toggle color and depth rendering (useful for debugging)


Thanks

To krpano and Kandao for the depth panoramas.

three.sixdof's People

Contributors

juniorxsound avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.