Create Screenshot Using Render Target ignores hardware scaling level

apparently CreateScreenshotUsingRenderTarget is ignoring engine.setHardwareScalingLevel(20);
i want to render the scene at 2x the canvas resolution to improve aliasing, but the resulting screenshot needs to be a desired resolution (width , height).

a work-around i found is to double the screenshot resolution but that does not meet our criteria. the correct behaviour will be to have CreateScreenshotUsingRenderTarget respect HardwareScaling

am I miss-understanding something?


update: i can get the render width and height of the canvas and pass that to the screenshot tool as such and as expected HWScaling multiplies this resolution.

var rwidth= engine.getRenderWidth();
var rheight= engine.getRenderHeight();
Tools.CreateScreenshotUsingRenderTarget(engine, camera, {rwidth,rheight},undefined);

but again that gives me an image at the larger resolution. I guess what im trying to do is have the internal canvas be the higher resolution but then downsample to a lower resolution for image export. basically im using hardwarescaling to get better antialiasing but want the output png image to be half the size

This is really interesting but I do not think it is currently supported. It would require to render into an intermediate RTT first. @Evgeni_Popov any ideas to do this one easily ?

I think adding a simple pass post process could do ? but I like how this could potentially enhance screenshots ?

I agree, here is a PR that goes along these lines:

It adds finalWidth and finalHeight parameters that allow you to set different dimensions than the ones used to render the scene.

1 Like

i see this has been merged 3 hours ago! could you please make a new patch version as it would be much more straight forward for us to use. eg: ^5.53.1?

quick update. with the new patch 5.53.1 i’ve been able to get amazing quality renderings from my screenshots due to the ability to supersample the image. This is a great addition to the toolset and thank you all for being so responsive on literally a moments notice. What makes this software so powerful is not just capability but the community and great support.

here is a quick pg to validate everything working:


I have a follow up question regarding downsampling the final image. Is there any control over the kind of filtering we can use for the downsampling? I need to look at the PR and see exactly where this occurs but figured id pose the question anyway :slight_smile:

I think it’s currently hard coded to be bilinear. Maybe we can add another parameter for this? @Evgeni_Popov

I suppose we could add the parameter, but I wonder why anyone would want to use NEAREST instead of BILINEAR when subsampling the image? I think almost 100% of people will want to use BILINEAR…

You might want trilinear if you generate mip maps ??? but sounds weird to draw that big ???