Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Render Settings "Render Graph Mode"

Discussion in 'Project Tiny' started by Sarkahn, Nov 24, 2020.

  1. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    Hello, I've been messing around with the camera and I noticed that the viewport outside the camera doesn't get cleared when using "Scaled Render Buffer" (which it defaults to in the Tiny2D project).

    Setting it to "Direct To Front Buffer" made it work how I was expecting - it clears the viewport color outside the camera to DisplayInfo.backgroundBorderColor. Is this expected behaviour? What are the differences between the three "Render Graph Mode" settings?

    Direct to Front Buffer:
    directtobuffer.gif

    Scaled Buffer:
    scaledbuffer.gif
     
  2. sebastianm_unity

    sebastianm_unity

    Unity Technologies

    Joined:
    May 3, 2018
    Posts:
    21
    Just to clarify: You only see issues if you are setting the Camera.ViewportRect to something smaller than a full rect?

    This is specifically useful only when you have multiple cameras rendering to the screen.
    If you leave parts of the screen un-rendered things are pretty undefined.

    I would consider it working fine in Direct mode a bug, because it means we are doing an unnecessary clear there.

    I also logged a bug to check for the case where less than the full rect is rendered by all cameras and to insert an extra clear in that case.
     
  3. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    Correct, in order to avoid rendering artifacts with pixels I am resizing the camera rect to my target pixel resolution and scaling up based on screen size, meaning there are borders around the outside of the render area.

    When I saw that the DisplayInfo component has a "backgroundColor" property I assumed this meant that by design Tiny would always clear the background outside the camera rect, which appears to be what is happening (and is what I want to happen) as in my first gif, is that not how it's meant to work?
     
    Last edited: Dec 9, 2020
  4. sebastianm_unity

    sebastianm_unity

    Unity Technologies

    Joined:
    May 3, 2018
    Posts:
    21
    Let me explain the 3 render modes a bit:

    (1) Direct: This mode is not recommended in general, as you will loose SRGB blitting on some platforms (web) so it only can work well in Gamma mode. It also does will not support upcoming exposure control. It is highest performance but quite limited. Cameras are rendered directly to the WebGL canvas / window backbuffer.

    (2) Fixed Render Buffer: Specify a fixed size (and aspect ratio) to render into. If the window/canvas size is different a final blit step resizes the render buffer to the canvas/window size, with a uniform scale. If the aspect ratio of your render buffer is different than the aspect of the window, you get empty bars either on the side or top. Those bars color is set with the DisplayInfo.BackgroundBorderColor value!

    (3) Scaled Render Buffer: The render buffer is the same size as the window/canvas, up to a maximum (RenderGraphConfig.RenderBufferMaxSize). If the size of the window is larger than the max size in either dimension, it is uniformly scaled down. This is now the recommended mode for most use cases.

    Tip: You can also check the singleton RenderGraphState to get the exact current size of the render buffer, regardless of mode.
     
    Sarkahn likes this.