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

Removing pixels after increasing frustrum size

Discussion in 'Scripting' started by lucasvdtogt, Jul 26, 2016.

  1. lucasvdtogt

    lucasvdtogt

    Joined:
    Jul 26, 2016
    Posts:
    3
    Hi all, I am creating a program that can create high resolution screenshots by taking many screengrabs of small sections of the screen and then stitching those images together into a single very large image. This is working quite well. However, this technique creates some artifacts from the ambient occlusion at the edges of some sections. I'm trying to solve this by making each section overlap a certain amount with it's surrounding sections, and cutting away this overlap later. This way the ambient occlusion calculations don't stop at the edges of the sections. The problem I am facing is that I don't know how to calculate the amount of pixels that need to be cut away (from the overlapping areas) when I increase my frustrum size by a certain amount (maybe some percentage). So how could I go about calculating this amount of pixels that need to be removed if I know how much larger the viewing frustrum became?

    I enlarge my viewing frustrum by calculating the left, right, bottom and top properties from my current frustrum and multiplying those properties by some factor.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,375
    It kinda sounds like you're on the right track. Try increasing the view size by 10% in each direction, and make it so you can fiddle with that number until the problem goes away.

    If you say 100x100 squares, increased by 10% in size, you would make 110x110 pixel renders, and take the interior 100x100, leaving a 5-pixel crust all around, right?? Those sound like pretty straightforward calculations, at least for a first try.
     
  3. lucasvdtogt

    lucasvdtogt

    Joined:
    Jul 26, 2016
    Posts:
    3
    I have tried to do it like this, but it didn't seem to work. When I measured the amount of pixels needed to be cut away in paint .NET at an overscan of 20%, the amount of pixels that overlapped was more like 36% on the horizontal direction and 28% on the vertical side. So it seems that the calculations are not that simple.
     
    Last edited: Jul 27, 2016