Git Product home page Git Product logo

Comments (2)

Cyanilux avatar Cyanilux commented on June 1, 2024 1

Hmm... I'd suggest URP's camera stacking, however that doesn't let you set the background at a lower resolution sadly. :(

Can do something with a 2 camera setup, though the transition between full resolution and the lower resolution is likely going to leave an obvious line/seam across the screen. Shouldn't be too difficult to setup though, Can adjust the clipping planes to those values to make sure each camera draws the correct parts. The Background Camera would output to a Render Texture object that's set to the lower resolution, using a (Forward) Renderer that has no features (as we wouldn't want to blit the texture to itself).

The Main Camera can then use another Forward Renderer that has the Blit applied, to apply that Render Texture object (source) to the screen (Camera Color destination). Would need to be in the Before Rendering Opaques event (so it's drawn in the background).

It also needs a material/shader to handle it, but it just needs to sample _MainTex and output it. (Can do that in shadergraph just with the Sample Texture 2D node). Also need to make sure the main camera doesn't draw the skybox or that would also draw on top. I'm sure there's a setting on the camera to change that.

Alternatively, if you don't want the transition that harsh, might be able to do something with the depth buffer. Could render the full scene at full resolution (one camera, one renderer). Downsample it somehow (blit the camera source into a low res render texture object? In the before post processing event. I think that would work?). Then use another blit, same event but using a material/shader which samples _MainTex for the full res, and the other downsampled texture (by passing it in with Shader.SetGlobalTexture or material.SetTexture, may have to edit the feature to do that), and returns a result based on an interpolation (lerp) of both, using the depth texture as the t input.

Haven't really tested these, but can't think of a reason why they wouldn't work right now.
Quite a bit of text so sorry, hope it helps though. Let me know if anything needs clarifying further.

from urp_blitrenderfeature.

laurentopia avatar laurentopia commented on June 1, 2024

Thanks Cyan.
I am trying to recreate the performance trick of Mario Odyssey where the foreground is kept crisp and the background gets rendered at a fraction of the resolution to save some pixel shader units from melting.
So #2 would give the effect but not the benefit of performance.
#1 I might test but ... I tried something earlier today, with a quad instead of using your Blit, the performance was notably worse than with a single full res camera. double culling is my guess as it's done on the cpu in URP. I doubt using blit would be of benefit so I'll leave it there.

from urp_blitrenderfeature.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.