Panoramic viewer for Three.js with multi-resolution image support

Is there a way to incorporate a three.js panorama viewer with multi-resolution images similar to pannellum? Check out pannellum's example here: .

You can find the current code using three.js here:(//codepen.io/w3core/pen/vEVWML).

  1. Starting from an equirectangular image to a panorama viewer.
  2. I encountered issues with high-resolution images taking a long time to render.
  3. Upon researching, I found solutions like pannellum and Kprano, which load multi-resolution images instead of single images.

Therefore, I attempted to load multi-resolution images instead of a single equirectangular image.

Here's the solution I tried:

  1. Converting a single equirectangular image to low-resolution 6-cube map images.

  2. Rendering these images similar to this sample. ()

    var materials = [
        loadTexture('px.jpg'), // right
        loadTexture('nx.jpg'), // left
        loadTexture('py.jpg'), // top
        loadTexture('ny.jpg'), // bottom
        loadTexture('pz.jpg'), // back
        loadTexture('nz.jpg')  // front
    ];
    mesh = new THREE.Mesh(new THREE.BoxGeometry(300, 300, 300, 7, 7, 7), materials);
    mesh.scale.x = -1;
    scene.add(mesh);
    
  3. If zooming into any cube map image, I need to render another set of medium-level resolution images.

Currently stuck at this point

How should I proceed with the following:

  1. How to render the next level resolution images when zooming.

In the sample below, there is an example of zooming into an image...

I have achieved zoom level 0, but I am struggling to render zoom levels 1, 2, 3, etc.

Zoom: 0 (Example of low-resolution cube map front image)

https://i.sstatic.net/JYuwr.jpg

Zoom: 1 (When zooming in, the next set of medium-level resolution tile front images should be rendered like below)

https://i.sstatic.net/crAiI.jpg

Zoom: 3 (Upon further zooming, the next set of high-level resolution tile front images should be rendered like below)https://i.sstatic.net/WtbLV.jpg

Zoom: 4 (When zooming in, the next set of very high-level resolution tile front images should be rendered like below)https://i.sstatic.net/oVOgU.jpg

Answer №1

After several months of hard work, I have finally solved the problem that has been on my mind. I am excited to share with you the threejs-based open-source package for a multiresolution panorama viewer. You can find it on GitHub: Avansel Viewer. Detailed documentation is available here.

To get started, simply install the package:

npm i avansel

Below is an example demonstrating how to use the package:

import { Avansel } from "avansel"

const container = document.querySelector('#avansel')

const params = [
    { tileSize: 374, size: 374, fallback: true },
    { tileSize: 512, size: 749 },
    { tileSize: 512, size: 1498 },
    { tileSize: 512, size: 2996 },
    { tileSize: 512, size: 5992 },
]

new Avansel(container)
    .multires(params, () => (s, l, x, y) => {
        l = parseInt(l) + 1
        return `/assets/images/multires-1/${l}/${s}${y}_${x}.jpg`
    }).start()

Check out the Demo multiresolution panorama to see it in action

If you encounter any issues or require adjustments to the script, feel free to reach out. I am more than willing to assist!

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

Is there a way to determine if a string is empty, even if it contains hard returns?

I am currently working on a function that checks if a string is empty or not, but it seems to be missing the detection of new lines. export const isStrEmpty = function(text: string): boolean { return !text || text.match(/^ *$/) !== null; }; I attempted ...

A guide to retrieving all image URLs when a checkbox is selected using Javascript

My goal is to extract only image URLs from the concatenated values of price and picture URL. However, when I check different images using checkboxes, it always displays the URL of the first selected image. When I try to split the value, all the prices and ...

The datepicker function is malfunctioning in a div that has been dynamically loaded through

I am experiencing an issue with loading a div populated by ajax. The datepicker does not seem to be called when the content is loaded this way. Initially, I had the datepicker loaded in the header of the main page, but even after trying to load it within ...

Is it possible to compare every element in an array with one another using an asynchronous process in NodeJS?

I am currently utilizing Resemble.js for image comparison within my web application. I have an array of image URLs that I need to compare with each other in order to calculate a unique score for each image. For example: [url1, url2, url3, url4] The minimu ...

Ways to handle Sessions in Node.js

I'm attempting to utilize a website within node.js. However, the site is prompting me to enable the storage of session cookies. I attempted to set up a cookie-jar, but I couldn't get it to work. Here is a simplified version of the code that is c ...

The "if" statement carries out the identical action each time it is executed

Despite my efforts to toggle the value of the turn variable every time the if statement runs, I keep encountering the same outcome. It appears that turn consistently evaluates as 2. Below is the code snippet in question: $(function() { var turn = 2; ...

Encountering a syntax error with the spread operator while attempting to deploy on Heroku

I'm encountering an error when attempting to deploy my app on Heroku: remote: SyntaxError: src/resolvers/Mutation.js: Unexpected token (21:16) remote: 19 | const user = await prisma.mutation.createUser({ remote: 20 | data: { r ...

how can JavaScript be used to retrieve an object based on a condition from an array of objects and an ArrayList

My JavaScript challenge involves working with an array of objects called arrobj and a list called prgList. The goal is to extract the names from arrobj based on the programs listed in prgList. If the program exists in arrobj, it should be displayed accor ...

Node.js app not rendering ejs file despite using res.render() method, no error being thrown

I am encountering an issue where, when sending an ejs templated file as a response to a HTTP request, the HTML and CSS render properly but the Javascript does not respond. Even though the Javascript sources are linked in the head of the ejs response, the f ...

Encountering an issue while following the Amadeus JavaScript beginner's guide

I have recently started working with Amadeus and encountered a roadblock at the initial stage. I am using the test URL (test.api.amadeus.com). Upon implementing the example code with my API key and API secret, I am receiving the following error: ClientErro ...

Utilizing ObjectLoader for loading JSON featuring a BufferGeometry with multiple materials is not successful

I have successfully crafted a sphere using multiple materials in the following manner: const materials = [ new THREE.MeshPhongMaterial({}); new THREE.ShaderMaterial({ visible: false}); ] const geometry = new THREE.SphereBufferGeometry(2,100,100); ...

Guide on sending files and data simultaneously from Angular to .NET Core

I'm currently working on an Angular 9 application and I am trying to incorporate a file upload feature. The user needs to input title, description, and upload only one file in .zip format. Upon clicking Submit, I intend to send the form data along wit ...

React form input values fail to refresh upon submission

After attempting to upload the form using React, I noticed that the states are not updating properly. They seem to update momentarily before reverting back to their original values. I am unsure of why this is happening. Take a look at this gif demonstrati ...

Inquiry from a newcomer: ASP.NET with jQuery

I am working on a webform with a file upload button that has some specific requirements. Whenever the file is uploaded using the button, I need the C# code behind to execute first before any jquery functions are called. <script> $(document.read ...

An error has occurred in NodeJS: Value undefined is out of the acceptable range for an unspecified property in the options

I am currently leveraging worker_threads in nodejs to handle the task of reading multiple files and processing the rows for subsequent insertion into a database (using oracle-db). The volume of data I deal with is substantial, typically exceeding one mill ...

"Utilizing Bootstrap Tour for Easy Navigation: Automatically Scroll Back to the Top with

I have a Bootstrap tour set up with code that is meant to capture the user pressing the end tour button and scroll them back to the top of the screen. However, currently the code runs when a new popover loads instead of when the end tour button is clicke ...

Vuetify's paginated server-side datatable does not support client-side sorting

The Challenge The issue I am facing revolves around using a server-side paginated datatable. Specifically, when utilizing the Vuetify data tables component and attempting to perform client-side sorting due to using a public API that I did not develop, the ...

A step-by-step guide on converting JSON data from JavaScript to C# variables

Hey there! I have a JavaScript snippet where I am sending an array to my C# file in JSON format. var r=['maths','computer','physics'] $.post("Global.aspx", { opt: "postpost", post: w.val(),tags:JSON.stringify(r) }, function ...

Swap out a module with a different one in a node.js environment

In the scenario where a node.js application consists of numerous files referencing a particular module (like underscore), and there is a need to replace that module with another (such as lodash), the typical approach involves globally replacing the names a ...

Asynchronous operations and recursive functions in the world of Node.js

When working with express and mongoose, I frequently find myself needing to perform batch operations on collections. However, the typical approach involves callbacks in nodejs concurrency coding, which can be cumbersome. // given a collection C var i = 0 ...