I’m just wonder if my question is possible in playcanvas.
Normally, a camera created in studio,it has the same render target width and height as the screen.
The problem is if I want to take a screen capture with different resolution, it always create the buffer which has the same resolution with the screen.
RenderTargetControl.prototype = pc.extend(RenderTargetControl.prototype, {
render: function (inputTarget, outputTarget, rect) {
var device = this.device;
var scope = device.scope;
this.downloadTexture.downloadTexture(inputTarget.colorBuffer, "test", false, true);
const colorBuffer = new pc.Texture(device, {
width: 512,
height: 512,
format: pc.PIXELFORMAT_RGBA8,
cubemap: true,
mipmaps: true,
minFilter: pc.FILTER_LINEAR_MIPMAP_LINEAR,
magFilter: pc.FILTER_LINEAR
});
// Resize the output render target
inputTarget.colorBuffer = colorBuffer;
console.log("1st check for Input Target : ", inputTarget, inputTarget.colorBuffer.width, inputTarget.colorBuffer.height);
inputTarget.colorBuffer._width = 512;
inputTarget.colorBuffer._height = 512;
console.log("2nd check for Input Target : ", inputTarget, inputTarget.colorBuffer.width, inputTarget.colorBuffer.height);
// outputTarget.colorBuffer = colorBuffer;
outputTarget.colorBuffer._width = 512;
outputTarget.colorBuffer._height = 512;
console.log("Output Target : ", outputTarget);
scope.resolve("uColorBuffer").setValue(inputTarget.colorBuffer);
pc.drawFullscreenQuad(device, outputTarget, this.vertexBuffer, this.shader, rect);
}
});
I’ve tried to set up the render target resolution manually, but it still render the first frame with screen resolution.
Any consequent rendering (like following posteffect or multi sampling rendering), will render the resized resolution.
The problem is it just resize the initial buffer with the new resolution which led image ugly.
So, what I want to do is to have a camera with fixed (customized) resolution from the beginning.
Is it possible?