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

Render Textures appear zoomed in

Discussion in 'Editor & General Support' started by Tomnnn, Mar 9, 2015.

  1. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Couldn't really find anything on this in the docs, but this is a small issue I've run into several times now.

    There is a lot more showed in the camera preview than the render texture, and putting the perspective up to 80 still doesn't show everything. Is there a way to adjust this? The second image shows the real issue with what is visible in the preview and missing in the texture. I can't really move the camera because it's already against a corner.

    Thanks for any suggestions.
     

    Attached Files:

  2. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    More information...

    I could move the camera back and increase the near clipping plane if it was static, but this is a security camera that moves. I could try having it rotate around the center of some point where the camera should be, but there has to be a proper way to deal with this. Debugging is going to be a lot more difficult since the render texture and camera previews are significantly different.
     
  3. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,364
    I've notice that adjusting the clip view offset x,y doesn't update camera preview only the render texture. Could this be it?

    Also, looks like things are getting clipped a bit wrong. Because really you'd want the clipping plane to be angled to the wall but this isn't possible in the settings. Might have to fake it unless there's a way to do a clipping plane at an angle.
     
  4. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Well, it's a security camera. So the 'monitor' plane is going to face the player and the camera will always be facing 30 degrees down on the x axis. If it wasn't a moving camera I could move the near clipping distance up and just pull the camera back until more stuff was in view, but that's going to not work or work very awkwardly with a rotating camera.

    Things being clipped wrong is kinda the whole issue :p There's nothing I can find to edit to fix this except moving the actual camera back - and that's a really bad fix that doesn't even work for this application. I've played with all kinds of numbers to try to see a difference. Adjusting the viewport makes the render texture view repeat... that doesn't help, and there aren't really any other settings to work with. Messing with the field of view is also definitely not viable as I would have to move it up to like 100 for the render texture to match what the camera preview is at like 60.
     
  5. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,364
    I think probably the camera should be behind the wall a bit. Even though real cameras aren't behind the wall, they have lenses in them which change the focal point to a point behind the physical camera.
     
  6. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    This is how I solved the issue before with a static camera, but now my solution is going to get a little awkward with rotating around a center point instead of just turning a camera. Looks like debugging is also out the window now since the camera preview is going to be worthless information ._.
     
  7. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Sorry for being dumb.

    Render Texture size did fix the issue, it just didn't update visually unless the game was run (which seems obvious now).Thanks @yoonitee.

    /thread
     
  8. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    you could just use a regular camera without the scripts on it and just add like a fish eye to it LOL.
    Doesn't look that bad actually, that's what I did with my little project game I was making.
     
  9. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,364
    Maybe submit this as a bug to Unity?
     
  10. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    The only bug-esque part of this is that even while the game was running, adjusting the render texture size didn't update. You have to actual stop the game, adjust the size, then run it to see the change. I'm sure there's a JIT compilation related reason for this :D haha

    Or some internal engine function that updates render textures on 'Start' or 'Awake' only.