Search Unity

Pixel Perfect or Upscaled Render Texture with 2D Camera Stacking

Discussion in 'Universal Render Pipeline' started by Lyncks, Aug 10, 2020.

  1. Lyncks

    Lyncks

    Joined:
    Dec 7, 2018
    Posts:
    9
    The main question: Is there any way to get the Upscale Render Texture from the Pixel Perfect Camera script to work on the Base camera in a camera stack?

    Our 2D pixel game makes use of camera stacking to easily handle parallax using layers. The old Pixel Perfect Camera seemed to work fine with the old camera system - at the very least the Upscale Render Texture part worked which was good for correctly pixelating rotations, particle effects and UI.

    The current Pixel Perfect Camera script says it doesn't work with camera stacks, which is unfortunate. We could probably live without the camera snapping/rounding as long as the Upscale Render Texture part worked on the final output of the Base Camera.

    I thought maybe I could get this to work with a ScriptableRenderPass, but apparently those aren't supported by the 2D Renderer yet.

    Are there any plans to make the Pixel Perfect Camera work with camera stacking? Or is there some other way that we should be dealing with parallax and the UI to make them pixel perfect and rendered and upscaled? If that's never going to be a feature.
     
  2. Agent000

    Agent000

    Joined:
    Feb 12, 2015
    Posts:
    9
    I also just ran into this issue today. Would be very helpful!
     
  3. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    The main reason Pixel Perfect Camera in a camera stack isn't supported right now, is the fact that several camera properties have to be altered to ensure pixel perfectness. There isn't a way to do that elegantly for all the cameras in a stack. The other reason is I'm not sure about the use cases for that. So please tell me more about your motivations of using Pixel Perfect Camera with camera stacking.
     
  4. The_Cloaked

    The_Cloaked

    Joined:
    Jan 31, 2019
    Posts:
    1
    I'm not sure about other people, but I would like to apply a lens distortion post-processing effect without disturbing the Upscale Render Texturing, and it seems like camera stacking is the only approach.
     
    IZcreswell likes this.
  5. Lyncks

    Lyncks

    Joined:
    Dec 7, 2018
    Posts:
    9
    For us the camera stacking is an efficient way for us to layer things for parallax but we still want the final output to be pixel-perfect or at the very least rendered at the correct resolution including sprite rotation and particles.

    It was possible to have stacked cameras in the old pipeline but also have pixel perfect scripts on them that seemed to work well enough for our purposes.

    Does this mean using camera stacking for parallax in 2D pixel games isn't the intended method?
     
    IZcreswell likes this.
  6. IZcreswell

    IZcreswell

    Joined:
    Dec 1, 2018
    Posts:
    12
    Hi I am having the same problem. I want to be a able to use bloom and camera shake without those getting effected by upscale render texture. Is there a way I could use the old pixel perfect camera? any help is appreciated :)
     
  7. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
    I wouldn't use URP if you need any custom or complex rendering. It's pretty awful and doesn't have feature parity with built-in. Just go back to the built-in renderer and use the old Pixel Perfect Camera. Works fine.
     
  8. nemo10

    nemo10

    Joined:
    Jul 25, 2017
    Posts:
    6
    Removing the old post text: Hey, what I tried wasn't working but I thought it was!

    So... why *can't* we use a pixel perfect camera in a camera stack?

    Consider that we can't use pixel perfect camera in a stack, but a bunch of shader features don't work on screen overlay UI, so we need a UI camera, but what if we don't want to apply pixel perfect camera's settings to the UI camera?

    I assume I'm going to have to target the pixel perfect camera's output to a render texture and then put that in a screen-filling UI or a quad? This is kind of a ridiculous solution.
     
    Last edited: Sep 30, 2020
    kukurenaiz likes this.
  9. nemo10

    nemo10

    Joined:
    Jul 25, 2017
    Posts:
    6
    See my post above. But also... what's the process for collecting/providing feedback for stuff like this?

    I'm curious if it was assumed that there wasn't a good use case for pixel perfect with camera stacking, or if the plan was always to release without it and then patch it in later.

    At any rate, it's doubly frustrating that the URP microsite documentation for pixel perfect camera copies the text from the main site's pixel perfect camera documentation without any caveat that it doesn't work with camera stacking. That should IMO be in a section of warnings at the top of the page.
     
  10. kukurenaiz

    kukurenaiz

    Joined:
    Sep 12, 2017
    Posts:
    57
    I'm on the same situation as nemo10, I have an UI Camera to render the inventory that appears on top of the character + every text like Damage Numbers and Signs, I'm currently setting to every canvas to Screen Space - Overlay. If Camera Stacking is not supposed to support this kind of scenario, I just fell into a noob trap, cause I've always thought that Camera Stacking was made for this kind of situation.
     
    Last edited: Dec 23, 2020
    TheShadowKnight13 likes this.
  11. Teedo145

    Teedo145

    Joined:
    Apr 14, 2014
    Posts:
    23
  12. DuelystRes

    DuelystRes

    Joined:
    Oct 6, 2020
    Posts:
    12
    If can't stack the camera, then the upscaled render texture will affect the display of the text, and the small size text cannot be displayed and cleared. Please think of a way to render only the main camera. Thank you
     
  13. DuelystRes

    DuelystRes

    Joined:
    Oct 6, 2020
    Posts:
    12
    Is there any other way to display text normally when upscaled render texture is turned on?
    This is very important to me, I hope to get an answer, will consider the problem of camera stacking, or not, I need to think about what to do next.
     
  14. DuelystRes

    DuelystRes

    Joined:
    Oct 6, 2020
    Posts:
    12
    I feel very sad,I looked through the forum and found no solution.
    This issue was raised in August 2020,There has been no answer so far.
    Pixel Perfect and Upscaled Render Texture ,It's a fantastic and easy-to-use feature.However, if the text cannot be displayed properly, this function will be rarely used.
    We don't need all cameras to use this function. We only need one camera to use it, and the others are not needed for display Pixel Perfect.
    I hope you can consider this situation. Thank you.
    I'm sorry to disturb you many times.
     
  15. kukurenaiz

    kukurenaiz

    Joined:
    Sep 12, 2017
    Posts:
    57
    You can have your canvases as Screen Space - Overlay. I think you can setup the pixel perfectness manually, rendering the output of your camera to a lower resolution Render Texture, and overlaying that yourself, not sure.
     
    Last edited: Dec 23, 2020
  16. DuelystRes

    DuelystRes

    Joined:
    Oct 6, 2020
    Posts:
    12
    Sorry, my current knowledge cannot understand the method you provided. I have not touched the canvas in the 2d game I made, and it will take a while to learn.
    My materials are all pixels, but the shader may not be pixels after some requirements.
    Upscaled Render Texture can solve the problem very well, so I hope Unity can let go of the camera stacking limit, and only need one camera to use Pixel Perfect.
    But the developer did not respond to me. Is it during the Christmas holidays?
     
  17. kukurenaiz

    kukurenaiz

    Joined:
    Sep 12, 2017
    Posts:
    57
    In your canvas, set the render mode to Screen Space - Overlay, this makes your canvas independent of the camera.
    upload_2021-1-6_13-27-36.png
     
  18. DuelystRes

    DuelystRes

    Joined:
    Oct 6, 2020
    Posts:
    12
    20210112133138.png

    It didn’t work, did I do it wrong?