Create Multiple States with Patches and 3D Distorted Hotspot Images
Learn how to create multiple states with a Mouse Over effect. We do this by converting an image patch into a point hotspot.
This mouse over effect uses patches to create multiple states of a scene.
In our examples, we show a scene with doors closed and when the mouse rolls over those doors, they show an image with the doors open. To do this, we create 2 versions of the panorama and use only the bits of the panorama that should change. In our case, the doors. This way, you don’t need to use multiple nodes to create this effect which keeps the project light.
There are multiple ways to create a hover effect. The way explained here is using an external image loader which is a good solution for viewing on mobile, especially if there are multiple roll-over images. This way they only get loaded when needed, preventing the mobile browser from crashing.
Use the Project Files to see how the final project will look, or to follow along.
Create the Mouse-Over Effect
- Take two panoramas of a scene. For example, one with doors open (
Garden_roll) and the other with them closed (
Garden_up). One of these images will be used as a donor to extract the areas of interactivity.
- Add them both to Pano2VR. Decide which image will be the main scene and which you’ll extract from. Our example will use scene with the doors closed as the main scene and we’ll extract the open doors from the other scene.
- Select the node to extract from. We’re using Doors Open.
- Open Patch Mode. Add a patch over the area to extract. Make the patch a little larger than the area to be extracted.
- For the patch’s image format, choose PNG as this is a web friendly format.
- Open List View. Right-click the patch and select, Copy.
- Select starting scene (doors closed). And paste the patch to the list view of this image. Right-click in the list view and choose Paste.
- Remove the open door scene from the Tour Browser as this is no longer needed.
- Select the Patch and in the patch settings, select Point Hotspot for Convert. This is how we create the interactivity.
★ Tip: In Viewer context menu, select “Reload Image” this removes the patch. But when you select the hotspot, it shows again.
- Add a Web Output and generate the output. Now the open doors will show. But we still have to make it interactive.
- In the Skin Editor, add a Hotspot Template.
- Click Add Custom Image Element in the Hotspot Template parameters. This is what will be showing the point hotspot image and is added as a child of the hotspot template.
- Set the Alpha to
.01. 0 would be hidden and inactive and .01 is still invisible but active.
- Add a Logic Block. Trigger > Mouse Over; Comparison > = ; Value > true; Alpha = 1. Enable transitions to .5 second.
- Select Hand Cursor.
- Save skin.
Blend the Patch
As the project is now, the patch seams are visible. This can be fixed in your image editing tool. Open the patch image in your editor and add a Layer Mask and feather mask the edges. Save the image and it will update in Pano2VR.
Keep the Doors Open
Currently, the doors open when the mouse enters and they close when the mouse leaves. But you might want to keep the doors open and add tour node to go inside, for instance.
- Remove the Alpha logic block that was added to the External Image Loader element.
- Add an action. Source = Mouse Click; Action = Alpha; Type = Toggle Element Alpha; Alpha = 1, Transition Time = .5.
- Save the output.
Add Button to Open and Close the Doors
- Add a Text box. Give it some text, like, Open All.
- Add a variable.
vis_image; Type = true/false; Init Value = false.
- Add an Alpha Logic Block to the External Image Loader. Trigger = vis_image; Comparison = =; Value = true; Alpha = 1. Enable Transition =.5.
- Add an action to the text box. Source = Mouse Click; Action = Set Variable Value; vis_image; not.