Method to get Smooth Pixel Perfect on 3d rendering

Many thanks for having a look at it.

Yeah, I think screen space widgets are on a different buffer than viewport widgets, I found this request from a few years ago Zorder of WidgetComponent to bring it in front of UMG Widget and seems like there is nothing much to do on that front for the time being.

I have been playing around with the Shared Layers but I think they only bundle together other widget components, excluding viewport widgets.

I have tried as well using world space after your last comment. I got it working, facing the camera is not an issue since you can do it pretty easily by modifying the material applied to the widget in the widget component. More info here Widget component in world space to face camera The issue then becomes that you are downscaling the widget, which is a behaviour that I don’t want because the widgets would be already using pixel-art and it would generate a tug-of-war between the downscale and the art itself.

The other workaround would be to use only viewport widgets and simulate the behaviour of a screen space widget by projecting a world position into the screen, it would be cumbersome but doable as well.

Another workaround (I haven’t thought much about it tbh) would be to try to render the screen capture as a widget component in screen space instead of as a viewport widget, maybe including the component into the player character or another actor that follows the player character. In this way, it would be possible to have the screen capture under the rest of the screen space widgets and obviously under the viewport widgets. It sounds crazy in my head but I think it might work.

To provide some more feedback about the system:

  • I wasn’t familiar myself with the Scene Capture Component 2D, so it would have been nice to mention that you can change the Capture Source in the Scene Capture Component 2D. Your example has it set to “SceneColor (HDR) in RGB, Inv Opacity in A” but in my case, I needed a Final Color since I have some more postprocess running.

  • In the example project (UE 5 version), I have noticed jiggling on the skybox, if you move the character close to the side edge of the scene and you move up and down you will notice it in the skyline. I am not sure from where is it coming or if it is just something from the skybox itself.

  • In the example project (UE 5 version), the controls of the character (Input system) were completely messed up, instead of AWSD it was AZQD or something like that. Nothing important but annoying at first.

  • I would include an ON/OFF toggle in your example project, not just for the pixel-perfect algorithm but for the whole effect, you can connect it to a key if you want or just expose another boolean, I think it would be a nice addition to have.

  • Finally and this is probably the biggest inconvenience for me at the moment, the system needs a way to modify the resolution dynamically. The final output resolution doesn’t need to be exposed to the final user (the virtual or downscaled resolution, the one that you have in the Canvas Render Target) but the resolution of the image in the widget must be connected to the viewport and/or screen resolutions somehow. While playing the game in the editor it should be possible to maximize and restore the window size without issues. If I have time I will try to explore it a bit more.

Hope this helps to improve it even further but so far I think it is a nice system.

1 Like