Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Make vuforia videoplayer match the height of the image target

Discussion in 'Vuforia' started by nicok123, Apr 25, 2018.

  1. nicok123

    nicok123

    Joined:
    Apr 25, 2018
    Posts:
    1
    Here's my scenario:

    I have an image target with size 1000 and height 667, and a video with resolution 1920 * 1080. For transparency the video is made twice as high and includes alpha channel values in the bottom half which is applied to the video by a shader.

    I have copied the videoplayer sample from the core samples, and have it load the videofile and apply the shader at runtime.

    My image targets scale is divided by 10, and therefor looks like this in the inspector:

    https://pasteboard.co/HieEa8i.png

    If I set the scale of the videoplane to 1, 1, 1 this works just fine, except it matches the width of the image target.

    https://pasteboard.co/HieFd3Z.png

    As you can see, the video matches the width of the video, and theres a parrt of the image target on top and bottom which isn't covered.

    What i want to accompolish is to stretch the video to fill the target vertically, and stretch the width to maintain the original aspect ratio (and thus, extending beyond the bounds of the image target)

    My understanding of scale in unity is very bad, even after reading several articles and documentation. Can anyone point me in the right direction? Also this needs to be done on the fly for multiple targets and videos with different aspect ratios, so just positioning it manually in editor won't cut it.