Creating interactive visuals using black circles in a 360 video with the help of three

I am facing an issue with my 360 video player created using three.js. The player works perfectly when the video ratio is 1:2, however, for videos with a ratio of 9:16, I see two black circles appearing on the top and bottom of the sphere.

Below are the core elements of the code:

var container, mesh;

    container = document.getElementById( 'container' );

    camera = new THREE.PerspectiveCamera( 75, 0.5, 1, 1100 );
    camera.target = new THREE.Vector3( 0, 0, 0 );

    scene = new THREE.Scene();

    var geometry = new THREE.SphereGeometry( 500, 60, 40 );
    geometry.scale( - 1, 1, 1 );

    var video = document.createElement( 'video' );
    video.width = 1280;
    video.height = 720;
    video.autoplay = true;
    video.loop = true;
    video.src = "56a8fd62e4b0834c57810c6f_1280x720_v2.mp4";

    var texture = new THREE.VideoTexture( video );
    texture.minFilter = THREE.LinearFilter;

    var material   = new THREE.MeshBasicMaterial( { map : texture } );

    mesh = new THREE.Mesh( geometry, material );

    scene.add( mesh );

    renderer = new THREE.WebGLRenderer();
    renderer.setPixelRatio( window.devicePixelRatio );
    renderer.setSize( 1280, 720 );
    container.appendChild( renderer.domElement );

I have attached a screenshot showing the issue with the top "black hole," similar one appears at the bottom

I am seeking assistance to resolve this problem without having to modify the three.js mapping function. Any help or suggestions would be greatly appreciated!

Thank you!

Answer №1

My test successfully passed all requirements. To access the test files, please click here. Please note that the test is optimized for Mozilla browser due to cross-domain restrictions in Chrome. Included in the test are a video file, an html page, and a webgl.basics javascript file. If your video appears distorted with black circles instead of black bars when viewed at 16:9 ratio, don't worry - this can be resolved by defining the video as a texture to the sphere: https://i.sstatic.net/HyUeX.png

For further details on how everything is defined, feel free to check out my webgl.basics.js file!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Accordion-inspired animation implemented on an Angular component using a selection of different templates

Currently, I am developing a production app with a card-style layout. All filters (such as date pickers) and visualizers (like tables and charts) are enclosed within a "Card" component. Additionally, there are two child components that inherit from this cl ...

What is the best way to use checkboxes in VueJS to apply filters on a loop and display specific results?

I'm struggling with implementing filters using checkboxes on a list of results and could really use some assistance. Currently, only the 'All' option is working for applying any filtering logic. Here is how my HTML looks like with the filt ...

Oops! Looks like the table you're trying to reference hasn't been defined yet

Whenever I attempt to create a table using the Google Visualization API, with PHP & MySQL in the background, I encounter this error message. The database connection is established without issues Generating JSON from the PHP array works correctly The JSON ...

What is the best way to find the average time in Typescript?

I am dealing with an object that contains the following properties: numberOfReturns: number = 0; returns_explanations: string [] = []; departure_time: string = ''; arrival_time: string = ''; The departure_time property hold ...

Uh-oh: create-react-app installation has been canceled

As per the guidelines provided in Reactjs documentation: To start a new project, you must have Node version >= 8.10 and npm version >= 5.6 installed on your system. Use the following command to create a project: npx create-react-app my-app My envir ...

"Despite successfully clicking on the menu with Selenium WebDriver, no action or change occurs on the webpage

Currently, I am in the process of writing a selenium C# test script for an older "infragistics" webpage, which I must admit, is not something I am very familiar with. The challenge I am facing is that the page does not provide many options for referencing ...

Angular with Leaflet and Leaflet AwesomeMarkers error: "Attempting to access 'icon' property of undefined"

I'm attempting to integrate Leaflet Awesome Markers into my Angular 10 project to incorporate Font Awesome icons in my Leaflet markers. However, I'm running into an error when trying to create a L.AwesomeMarker. https://i.sstatic.net/7o81y.png ...

Discovering the correct location within a complex JSON or array to perform updates using JavaScript (either AngularJS or vanilla JavaScript

I am currently facing a challenge where I need to search for a specific value within my complex JSON array and then update the corresponding object. Here is a snippet of my JSON array: var myArray = [{ "id": 5424, "description": "x ...

Tips for extracting variables from a querystring in Express?

I am trying to retrieve values sent to the server: "/stuff?a=a&b=b&c=c" Can you please advise me on how to extract these values using express? So far, I have attempted... app.get( "/stuff?:a&:b&:c", function( req, res ){}); ...but unfo ...

Access the input field value with PHP and store it in a variable

I previously looked into this issue, but the solution provided in the accepted answer did not resolve it for me: How to get input field value using PHP Below is an excerpt from my result.php file: ... <th> <form name="form" action= ...

Using Javascript to create bold text within a string

I have noticed that many people are asking about this issue, but it seems like a clear and simple answer is hard to come by. Currently, I am working with Vue and trying to display text from an object in a component. My goal is to highlight the price port ...

Which is better for toggling between images/icons: a switch statement or a ternary operator?

I have a unique challenge where I am dealing with a dynamic list of thumbnails. Some of the items in this list are images, while others need to be represented by icons. My goal is to display either an image or an icon based on the contentType of each item. ...

The rate limit feature in NextJS does not function properly when used with middleware

Currently, I have implemented a rate limit using the lru-cache based on the official example provided by Vercel, and it is functioning flawlessly. My intention was to consolidate the try-catch block in a Middleware to handle all routes, instead of duplica ...

Utilizing JQuery and AJAX to fetch a specific variable

Hey there, I'm new to jQuery and AJAX. I've been attempting to pass a value from page 2 to page 1 using this script, but it doesn't seem to be working properly. Check out the script: function prova() { var parametro = $("#nome_priv ...

What is preventing me from utilizing require in vue-router's routes.js file?

Vue-router typically requires the standard setup as outlined below: In main.js, the routes.js file is required and it usually contains code similar to this: //routes.js import Register from './components/Register' import Login from './comp ...

Show the React component once the typewriter effect animation is complete

Hello there, I am looking to showcase my social links once the Typewriter effect finishes typing out a sentence in TypeScript. As someone new to React, I'm not quite sure how to make it happen though. Take a look at the code snippet below: ` import ...

How does this particular save method function within the context of mongoose, without explicitly mentioning the specific database

Starting off, I have a main workspace folder called "Projects" Inside this folder, there are 2 subfolders: Models: 1) Something-model => const mongoose = require("mongoose"); const Schema = mongoose.Schema; const Something-Schema = new Schema({ n ...

Immersive 360-degree video player with global coordinates

I've developed a 360 video player using three.js, and I'm utilizing raycasting to determine the 3D world coordinates whenever I click the mouse. I have been able to successfully retrieve these coordinates. Is there a method to map these 3D world ...

Sending an Angular scope variable to JavaScript

I am working with an angular scope variable that is being used in ng-repeat. My goal is to create a chart that starts from a specific date, ends at another date, and includes a marker for the current day. I am utilizing loader.js for drawing the charts in ...

Guide to transferring shortcode parameter values to Javascript/Ajax interactions

I have developed a custom contact form shortcode that is processed using ajax. The shortcode includes a parameter to specify the email address where the messages should be sent. This allows me to use different email accounts depending on the specific form. ...