- Home /
Rendering an HD PNG off-screen?
I am creating a photo booth application where users can: select various options (background and text to be included on the final photo), take their picture, and receive their customized post-card via email as a PNG file.
.
Right now, to capture the image, I am grabbing the portion of the screen where the final result appears using ReadPixels() and EncodeToPNG(). This method, however, limits the resolution of the photo to the size it appears on the screen.
.
I would like to try and render the image at a larger scale so I can send the users a higher resolution photo, however I can't seem to figure out all the necessary steps.
.
I have attempted to re-construct their post-card in code by passing in the background sprite, their selected foreground, the webcam render texture, and their selected text, then positioning the elements accordingly. What I'm having trouble with is:
(1) grabbing the pixels from the webcam RenderTexture and
(2) figuring out how to render dynamic text (i.e. text they selected) into the array of pixels at a certain position
.
I'm assuming the best and simplest way to do this is to use the method I am currently using (which is using ReadPixels() on the visible screen to capture the postcard) since it doesn't require reconstructing the entire post-card from scratch, pixel-by-pixel. However, if I want to capture the post-card at a higher resolution than the visible application itself, I do not know how to proceed.
.
Is there an easier way to capture the post-card as a PNG while still maintaining the postcard's native resolution (i.e. the post-card's elements are higher resolution than the screen but are scaled down to fit on it)?