Masking with 2 images and an alpha mask image, is it posble ?

  • Hi.

    When I saw the "Masks" example of krpano 1.0.7 (https://krpano.com/examples/masks/), I think that it used 3 images:
    1 - the original image
    2 - a modified image, with xray effect aplicated for example
    3 - the mask image, a B&W image that indicates what you can see trough, black hide the image, white show the image, like the Photoshop masks

    But don´t work like that. Only are 2 images, the original image and a mask image. Krpano apply the selected effect to te original image in the mask zone.

    I want to do masking like the first way I write, 2 images (original in color and B&W for example) and a mask image that let see through.

    Can I do this ?

    Sorry about my english *unsure*

  • THX Michel, but I don´t want this effect.

    I want the mask always in the middle of the screen, like the Xray effect in https://krpano.com/examples/masks/ . But instead of apply the xray effect to the background image, I want the image you see behind be another image different, like this https://krpano.com/examples/108b8…tspot/mask.html the mountain image is masked, but in the example, the mountain image and the mask moves with the background image.

    Sorry, my english is poor, I can´t emplain

  • Hi lorth22,

    After many tries... I got this code that looks to do what you are looking for:

    The plugin[pic1] listens to onover and onout mouse action to make plugin[pic2].visible true or false...
    I hope this can help.

    Salut.

  • Hi,

    yes, that's possible and very easy

    I have prepared here an example:
    HTML: https://krpano.com/examples/maskedhotspot/index.html
    XML: https://krpano.com/examples/maskedhotspot/maskedhotspot.xml

    the "modified" part of the pano must be placed as distorted hotspot in pano,
    like here:
    Example/Tutorial - interactive area in the pano (aligned distorted hotspot)

    then the mask image must be included as <plugin> (note this image must have an alpha mask!)
    e.g.

    Code
    <plugin name="spotmask"
            url="spotmask.png"
            align="center"
            enabled="false"
            height="40%"
            width="prop"
            />

    and then the "mask" from the hotspot must be set to the mask plugin image,
    e.g.

    Code
    <hotspot name=".."
             ...
             mask="plugin[spotmask]"
             />

    that's all

    (if you can provide your images I can make the example with them)

    best regards,
    Klaus

  • Hi lorth22,

    After many tries... I got this code that looks to do what you are looking for:

    The plugin[pic1] listens to onover and onout mouse action to make plugin[pic2].visible true or false...
    I hope this can help.

    Salut.

    I´ll try it tomorrow.
    Reading the code seems to be I was looking for.

    THX *thumbsup* THX THX THX

  • Hi KLAUS,

    I have noticed something strange on the "maskedhostspot" example .... *confused*

    Open your example https://krpano.com/forum/wbb/../.…spot/index.html , zoom out a little to make more visible the mistake, then pan left or right... when you arrive between 65º (depending of the FOV) the "maskedhostspot" seems to "loose his mask" and becomes visible *attention*

    This happens only with Flash 10... If you toggle to Flash 9, this does not Happen....

    Salut.

  • Hi KLAUS,

    After more tries, I have noticed that, the mistake described above does not happens using fisheye view instead of normal view *attention*
    In the example below, using the context menu, you can switch between fisheye view and normal view to view what it is happening.
    I also noticed that distorted hospot does not apply correctly on Pannini projection...


    Hi lorth,

    I have made an example using your image cave1d.jpg as the Pano, a cropped image from your first uploaded image (image1 + image2 + mask = result) as the distorted hospot and the spotmask.png from the example made by Klaus (the car). I have proceeded as Klaus explain.
    Here is the result : http://andorra360.com/test/ForumKrpano/lorth22/

    Salut.

  • Hi,

    You ask me for the images I want to use.

    thanks great!

    I have noticed something strange on the "maskedhostspot" example .... *confused*

    Open your example https://krpano.com/examples/maskedhotspot/index.html , zoom out a little to make more visible the mistake, then pan left or right... when you arrive between 65º (depending of the FOV) the "maskedhostspot" seems to "loose his mask" and becomes visible *attention*

    I already know this problem,
    it's a bad flash behavior, when using a masks (or filter, e.g. sharpen in the HIGHSHARP mode),
    in this case Flash converts the underlaying object (the pano in this case) to an internally bitmap and then applies the mask (or the filter) on it,
    but Flash has a limit of 2880x2880 pixel for bitmaps, and if the object reaches this limit it will just NOT apply the mask (or the filter),

    now - why does it reach this limit of 2880 pixels, when using Flash10 (and no fisheye distortion), then there were very large triangles used (see them by pressing TAB), there are clipping offscreen of course, but Flash counts the "real" size for converting to bitmap,

    I know to solve this problem by manually clipping, but I still need to implement it,

    I also noticed that distorted hospot does not apply correctly on Pannini projection...

    yes, right, pannini projection can't be used for hotspots,
    hotspots can change dynamically (size, position, rotation) and that would require re-calculating of the pannini projection after every change and that would be too slow for sense full usage...


    I have made an example using your image cave1d.jpg as the Pano, a cropped image from your first uploaded image (image1 + image2 + mask = result) as the distorted hospot and the spotmask.png from the example made by Klaus (the car). I have proceeded as Klaus explain.
    Here is the result : http://andorra360.com/test/ForumKrpano/lorth22/

    wow, great example!

    best regards,
    Klaus

  • Hi Klaus and Michel

    I tried the solutions you give to me. But I can´t do work it.
    In the Klaus solution, the image1.jpg don´t move.
    In the Michel solution the modified image stay apears, but the mask don´t work.

    *cry*

    I think the Klaus solution is what I was looking for, but can´t make it works.
    Can you make the example using the images I upload ?

    http://img17.imageshack.us/img17/7056/cave1d.jpg


    http://img36.imageshack.us/img36/9549/cave2.jpg

    I think I have a mistake in the code, but I can,t find it.

    The Michel example works fine, but when I try to make the same don´t work.

  • Hi lorth22,

    Quote

    How do you know it for be in the correct place ?



    You can found a detailed explaination from KLAUS example below:
    Example/Tutorial - interactive area in the pano (aligned distorted hotspot)
    It is well explained (as always klaus do *thumbsup*... THE MASTER *rolleyes* )

    I am making a new example using your second image too ( cave2.jpg ).
    Many problems here *blink* *wacko* *confused* *cursing* *angry* *huh* *unsure* *cry* *whistling* *squint* *g*

    When I get it, I will post. *wink*

    Salut.

  • Hi lorth22,

    Here is the second example: http://andorra360.com/test/ForumKrpano/lorth22/index2.html

    I have used:

    Finally, I have added buttons to switch each hotspot ON / OFF and buttons to enable/disable a mask for each hotspot. With those buttons you can play around to see what is happening in different configurations. *smile* Also, there is the context menu for switching between different projections.

    For example:
    Try to enable all the cubes and the gravures button... You will notice that the pano goes really slow....
    Now, try to disable all the mask buttons of each cube... Now, the pano goes much better (It seems that masked hotspot takes a lot of CPU *sleeping* )


    Hi KLAUS,

    Doing the example above, I have noticed a few things: *rolleyes*

    • It seems that each distorted hotspot needs to have his own mask. *attention* even if the mask is the same mask for each hotspot. I have tried to mask each hotspots with the same plugin as mask but it does not work. ( in the example above I use the same mask file for each hotspot )
    • It seems that, when fisheye is used, distorted hotspots are not "well distorted"as they are when normal projection is used. *attention* You can notice this yourself on the example above: enable a cube button and disable his mask, then switch between normal view and fisheye view... In normal view the cube hotspot match perfectly with the background... In fisheye view the cube hotspot match near perfectly with the background but there is little differences. *wacko*

    That's all. *wink*

    Salut.

  • WOW Michel, that what I looking for.
    My mistake was using non cubic images, I was using a equirectangular image to do it.
    Another cuestion, do you speak spanish ? I saw you are from Andorra. I´m spanish and my english is poor.

    I´m going to do my own example and show to you

    THX *g*

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!