Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Stretching Window

Discussion in 'Editor & General Support' started by rellayrrah, Feb 10, 2021.

  1. rellayrrah

    rellayrrah

    Joined:
    Feb 8, 2021
    Posts:
    4
    How do you stretch a camera view to output full screen. Keyword is stretch. I see many posts on how to avoid it on macs, but I'm on a PC and want to intentionally do it.

    I have a camera (generated by a cubemap for fisheye projection) outputting at 2160x2160 (square). I want to stretch that to a fullscreen at 3840x2160 when going into fullscreen mode or maximizing the window. I actually want the video to stretch to the full width. That will lead to a deformation (which I want), but the special lens in my projector will counteract it.

    So, how do I force the game window to stretch when going fullscreen?

    Thanks.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
  3. rellayrrah

    rellayrrah

    Joined:
    Feb 8, 2021
    Posts:
    4
    I appreciate your reply Kurt. Unfortunately, it didn't do the trick for me. It did however, make me realize I was not asking the question correctly.

    My game is not using a camera in the conventional sense. Rather, I have a script rendering the image from a cubemap. There is a material derived from a custom shader.

    Is there a way to stretch a view post-rendering? The current result is accurate (a perfect fisheye circle), but I'm needing to stretch that horizontally to match the optical characteristic of my projection lens.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
    Pretty sure you could do this with a final-copy-to-full-screen-quad shader approach, just having it run the surface distort function you are using.
     
  5. rellayrrah

    rellayrrah

    Joined:
    Feb 8, 2021
    Posts:
    4
    Sounds interesting. I'll admit... I'm somewhat new to the inner-workings of Unity. Most of my time spent has been doing basic scenes and such. Therefore, I'm not really following the approach you suggested. I searched a little, but got lost.

    My script is outputting a rendertexture. I thought I could just scale that, but learned that is a no, no. Now, I'm lost. Any process steps you can lead me to that helps understand your suggested approach would be appreciated.

    Thanks Kurt.
     
  6. rellayrrah

    rellayrrah

    Joined:
    Feb 8, 2021
    Posts:
    4
    Think I found a path. The scale functionality of Blit let me stretch the rendertexture. It will somewhat lock in the ratio of screens I'm running on, but that is okay for my application.

    Thanks Kurt. Your suggestions led me down the right path.
     
    Kurt-Dekker likes this.