Shader + Scaling problem.

Hi, I drew a picture to illustrate a problem I’m currently having.

https://i.postimg.cc/dtZcfy0N/Question.jpg

Basically, I know how to deal with 1 RenderTarget2D “canvas” and scale the resolution at the end of the draw call to meet end user’s screen size. But I don’t know how to deal with a second RenderTarget2D that uses shader and scale that alongside RenderTarget2D “canvas”.
Keep in mind the shader will change in intensity depending on user input, so as a result, I couldn’t afford use a custom function to merge pixels together 60 times / second and then scale it the user’s resolution.

(I’m self-taught, so do excuse my inability to communicate as precisely)

Sorry if I’m not understanding what you want here. It sounds like you want to draw some things normally, but then you want to draw some other things with a shader applied to them. Is this correct?

If so, I figure you’ve got two options…

  1. Use a second render target with a transparent background. Draw to it as normal with your shader. When presenting to the screen, draw both as you are, scaled the same way.
  2. Draw your shader layer directly to the screen, scaling as appropriate. You can set a matrix parameter on your sprite batch begin call.

There’s probably other ways, but that’s what I can think of at the moment :slight_smile:

Thanks - this RenderTarget class is quite new to me and had some misconception about it. Didn’t know you can lay it on top of one another.

1 Like