Search Unity

Camera clearFlags/cullingMask bug on Mac

Discussion in 'Scripting' started by Zelek, Dec 18, 2014.

  1. Zelek

    Zelek

    Joined:
    Jun 12, 2010
    Posts:
    87
    In order to pause the camera rendering, I am setting the "clearFlags" to "CameraClearFlags.Nothing" and the "cullingMask" to 0. On Windows, this works exactly as expected. On Mac, however, the image flickers very noticeably.

    I have a very small test project attached, where a cube continuously moves back and forth. You can click the left mouse button to toggle the two camera settings back and forth. If you're on Windows, it will pause the rendering as expected. On Mac (standalone or web, but not in the editor) the cube will noticeably jitter.

    There's a web demo here:
    http://codecommode.com/unity/CameraTest.html

    Does anyone have a guess as to what might be happening, or how I might be able to work around it? I am using this code to freeze the image on screen and then apply some effects using a full-screen shader.
     

    Attached Files:

  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That seems like undefined behavior to me, rather than a bug. You're telling the camera not to clear, and then not defining what it's actually supposed to draw. So what happens would vary depending on platform, drivers, etc. A defined way to freeze the image would be to use rendertextures along with Camera.Render, since that way you're explicitly telling the camera what to draw.

    --Eric
     
  3. Zelek

    Zelek

    Joined:
    Jun 12, 2010
    Posts:
    87
    Thanks for the clarification. Could you give me some guidance on how to go about this with RenderTextures?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Render the scene to a texture, which you can put on a screen-size quad. (Which is then rendered by another camera.)

    --Eric