I am rendering a secondary camera to a texture /renderTarget so I can read pixels. This works fine but i want to reduce the size of the texture because the whole process is a bit heavy on the FPS. Howver, when I reduce the texture size by half for example, only the bottom left half of the cameras projected pixel are read rather than downsampling the camera viewport to half the size. I want to be counting pixels from a low res image of the camera view.
My code:
//color buffer - texture to use for render target
this.colorBuffer = new pc.Texture(this.app.graphicsDevice, {
width: this.app.graphicsDevice.width/2,
height: this.app.graphicsDevice.height/2,
format: pc.PIXELFORMAT_R8_G8_B8_A8
});
//render target - rectangular rendering surface.
this.renderTargetTexture = new pc.RenderTarget({
colorBuffer: this.colorBuffer,
depth: false
});
this.myCamera.renderTarget=this.renderTargetTexture;