Adapting Window Tutorial to work on walls

Options

Hello,
I'm relatively new to Lens Studio, and still have lots to learn, I'm sure!
I am trying to adapt the Window tutorial to be placed on a wall. I currently have a 3d model imported (of a room I 3d scanned) and is occluded correctly (here's that project exported). However, I want it to spawn on a wall (not the floor), or at least be able to be dragged onto it.

I have been looking at the depth template today. However, I can't seem to merge the two together. I've tried bringing in all the scripts from depth into window, but cannot get them reconciled.

Does anyone have any advice on how to adapt the Window tutorial to work on walls?

Answers

  • Bakari Mustafa
    Bakari Mustafa Posts: 178 🔥🔥🔥
    Options

    To adapt the Window tutorial to work on a wall, you will need to modify the script that is used to place the window on the floor instead place it on the wall.

    One way you could do this is by using the depth map generated by the device's camera to detect the position of the wall in the scene. The depth map is a grayscale image that represents the distance of each pixel from the camera, with brighter pixels representing objects that are closer to the camera and darker pixels representing objects that are further away.

    To use the depth map to place the window on the wall, you can follow these steps:

    1. Add a Depth component to your scene: Drag a Depth component from the Object Library onto the root object of your scene. This will generate a depth map for the scene.
    2. Get the depth map: In the script that is used to place the window, use the "Depth" output of the Depth component to get a grayscale image that represents the depth of the scene.
    3. Find the position of the wall: Use the depth map to find the position of the wall in the scene. You can do this by searching for the pixels in the depth map that correspond to the wall and using their depth values to determine the position of the wall in 3D space.
    4. Place the window on the wall: Once you have determined the position of the wall, use this information to place the window on the wall. You can do this by setting the position of the window object to the desired position on the wall.