Git Product home page Git Product logo

a-frame-volumetric-video-component's Introduction

A-Frame-Volumetric-Video-Component

Video screen capture

Description / Rationale

This is an A-Frame component for volumetric videos, which is powered by Volograms. The creation of the component was inspired from similar works of Remy Mellet Volograms.js, A-Frame Volograms and Volograms' playback library vol_libs. The main difference with Remy Mellet's A-Frame component is that this component is based on vologram web player using three.js, and the vol_geom library compiled to WASM.

Instructions

In order to use the component attach "vologram-component" to an A-frame entity. The component has the following attributes:

  • headerUrl: { type: "string", default: "vologram/header.vols" } - the URL/link to header.vols file as generated by Volu App of Volograms.
  • sequenceUrl: { type: "string", default: "vologram/sequence_0.vols" } - the URL/link to sequence_0.vols file as generated by by Volu App of Volograms.
  • videoUrl: { type: "string", default: "vologram/texture_2048_h264.mp4" } - the URL/link to video texture file as generated by by Volu App of Volograms.
  • vologramFps: {type: "float", default: 30.0} - frames per second of the vologram file.

The code below shows the sample implementation of the component:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <Title>A-Frame Component: Volumetric Video</Title>
    <script src='https://aframe.io/releases/1.4.2/aframe.min.js'></script>
    <script src="js/vologram-component.js"></script>
    <style>
        #button-container {
            position: fixed;
            bottom: 0;
            width: 300px;
            left: 50%;
            transform: translateX(-50%);
            margin-bottom: 5%;
            width: 200px;
            text-align: center;
            z-index: 3;
        }
        #load-vologram,
        #play-vologram,
        #pause-vologram {
            font-size: 20px;
        }
    </style>
</head>
<body>
    <div id="button-container">
        <input type="button" id="load-vologram" value="Load">
        <input type="button" id="play-vologram" value="Play">
        <input type="button" id="pause-vologram" value="Pause">
    </div>

    <a-scene>
        <a-entity id="vologram"
            vologram-component="headerUrl: vologram/header.vols; sequenceUrl: vologram/sequence_0.vols; videoUrl: vologram/texture_2048_h264.mp4; vologramFps: 30.0"
            position="0 0 -3"></a-entity>
        <a-plane position='0 0 -4' rotation='-90 0 0' width='4' height='4' color='#7BC8A4'></a-plane>
        <a-sky color='#ECECEC'></a-sky>
    </a-scene>
</body>
</html>

Please note that component has three buttons which do the following: load vologram and plays video; plays vologram video; pauses vologram video.

Exporting Volograms from Volu app

Volu is the application by Volograms, which is only available for IOS devices at present. It is possible to generate volumetric videos of persons by using this app (it is free) and export related files (it is also free) for using in different development environments. In order to export own vologram, consisting of 3 files (header.vols, sequence_0.vols - sequence of meshes, texture_1024_h264.mp4 - video with texture), which are used in this component, do the following:

  1. Register free acount and generate own vologram.
  2. In the "Edit Vologram" menu (please note that you can only edit own vologram; example volograms do not have such an option), use "Export" button to export vologram. Make sure to save it as .zip file in the local system.
  3. Download/copy .zip file to your PC and unzip it. Take resulting 3 files and put them inside vologram folder or any other place you want (make sure that the URL reflects that).

Limitations

The component uses requestVideoFrameCallback() extension, which is needed for synchronous video frame fetching. However this callback is not supported on all browsers yet. In my tests it worked well with the following browsers: Safari (IOS), Samsung (Android). Firefox (Android) does not work well (although texture gets updated mesh remains the same). Chrome (Android) unfortunately does not work yet (although desktop Chrome browser works well with it).

Texture rendering

Sometimes texture is not rendered well on the mesh (some glitches emerge). Slight change of fps can solve the issue. For example, making fps 30.02 solves the problem.

Future Updates

  • Multiple volograms
  • Code optimization

Tech Stack

The project is powered by AFrame and Three.js. Sample vologram was taken from vol_libs repository.

Demo

See demo of the component here: Demo
See demo of the component in AR: Click here, target

a-frame-volumetric-video-component's People

Contributors

akbartus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  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.