Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace equirectangular to multiRes in tours #1200

Open
aliMurtaja opened this issue Jan 4, 2024 · 6 comments
Open

replace equirectangular to multiRes in tours #1200

aliMurtaja opened this issue Jan 4, 2024 · 6 comments
Labels

Comments

@aliMurtaja
Copy link

aliMurtaja commented Jan 4, 2024

Hello Matthew Petroff

I want to replace equirectangular to multiRes.

here's my current code which is working with equirectangular::

let scenes = getListOfExperienceScenes(virtualTourExperience.tourImages); // will load the scenes

setviewer(window.pannellum.viewer(panoramaRef.current, {
    "draggable": true,
    "disableKeyboardCtrl": true,
    "type": "equirectangular",
    "autoLoad": true, 
    "firstScene": virtualTourExperience.tourImages[0].experienceID, // same as first element of `scenes`
    "showControls": false,
    "compass": true,
    "orientationOnByDefault": true,
    "scenes": scenes,
    "sceneFadeDuration": 2000
}));


const getListOfExperienceScenes= (experiencs)=>{

    let dummy = [];
    let mainObje= {};

    dummy= experiencs.map(element => {

    let obje= { 
        [String(element.experienceID)]: {
                "title": element.roomName,
                "type": "equirectangular",
                "panorama": THREE_SIXY_IMG_SHOW_BASE_URL+element.fileUrl, // 360 img --> https://xrtoursdevassets.blob.core.windows.net/2659b7e4-0038-4516-8f26-81e099f6f749/VirtualTours/208/99d5459a-37e5-406b-8c89-82d6e464948a.jpg
                "hotSpots": []  // --> here hotSpot will be added dynamically
            }
        } 
        return obje;
    });
    
    dummy.forEach(element => {
        let abc = element;
        mainObje= {...mainObje, ...abc}
    });
    
    return mainObje;
    
}

I want to replace above code wrote using equirectangular to multiRes

I tried something like below, but didn't work

setviewer(window.pannellum.viewer(panoramaRef.current, {
    
    let scenes = getListOfExperienceScenes(virtualTourExperience.tourImages);

    "firstScene": virtualTourExperience.tourImages[0].experienceID,
    "scenes": scenes,
    "sceneFadeDuration": 2000,

}));

const getListOfExperienceScenes= (experiencs)=>{

    let dummy = [];
    let mainObje= {};

    dummy= experiencs.map(element => {

    let obje= { 
        [String(element.experienceID)]: {
            "title": element.roomName,
            "type": "multires",
            "hotSpots": [],
            "multiRes": {
                "basePath": "",
                "path": "/%l/%s%y_%x",
                "fallbackPath": "/fallback/%s",
                "extension": "jpg",
                "tileResolution": 512,
                "maxLevel": 3,
                "cubeResolution": 1296
            }
        }
        } 
        return obje;
    });
    
    dummy.forEach(element => {
        let abc = element;
        mainObje= {...mainObje, ...abc}
    });
    
    return mainObje;
    
}

It gave me this result (screentshoot attached)
image

image

Thanks in advance

@mpetroff
Copy link
Owner

mpetroff commented Jan 7, 2024

You need to provide a basePath to the root of the multires tile directory for each image. You're not providing one, so it's trying to load the same images for every scene, starting from the root of your site.

@aliMurtaja
Copy link
Author

aliMurtaja commented Jan 8, 2024

Ok but I don't have tile's directory, I have only one 360 Image which I need to load using multiRes.
360 Image :: https://xrtoursdevassets.blob.core.windows.net/2659b7e4-0038-4516-8f26-81e099f6f749/VirtualTours/208/99d5459a-37e5-406b-8c89-82d6e464948a.jpg

I thing I can't load image using multiRes, the reason I only have one Image not tile's directory, right ??...

@luishcq
Copy link

luishcq commented Jan 8, 2024 via email

@aliMurtaja
Copy link
Author

aliMurtaja commented Jan 11, 2024

Thanks @luishcq for response.
I got it...

But I don't want to use other library and directory for tiles.
Now, Simply I want to show fallback UI whenever image is too big.
So is there any way to show Fallback UI in that case ??...

@aliMurtaja
Copy link
Author

hello @mpetroff @luishcq hope you saw my previous query.
#1200 (comment)

please let me know for the same....

@mpetroff
Copy link
Owner

Now, Simply I want to show fallback UI whenever image is too big.

Pannellum will display an error message if the image is too big.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants