[ad_1]
If you need your picture-in-picture view to occupy a hard and fast, screen-aligned rectangle, it’s also possible to obtain this impact and not using a render texture by utilizing the digicam’s viewport rect.
Take your digicam that renders the “foremost” scene view and set its Depth parameter to one thing like 0.
Then take your picture-in-picture digicam and set its Depth to a higher worth, like 1, so it renders after the principle digicam has completed drawing.
Set this PiP digicam’s viewport rect to occupy only a nook of the display, one thing like:
x: 0 w: 0.25
y: 0 h: 0.25
These values are measured in relative coordinates, so “0” is the underside/left nook of the display, and “1” is the highest/proper or full width/peak.
You can set these values in a script if you wish to adapt the dimensions and place of the PiP window to reply to adjustments within the dimension of the sport window.
The benefit of rendering to a render texture is you are not restricted to blitting the picture on to the display — you may show that render texture in perspective, or map it to a digital monitor that exists as a 3D mannequin in your recreation world, or mission it onto your geometry like a slide present, or render it distorted, translucent, or with arbitrary shader results.
The draw back of rendering to a render texture is that it is barely dearer to avoid wasting after which pattern that texture than to only dump pixels on to the body buffer in a single go. You might also must do some work to match the feel decision to the show dimension, in any other case you may render extra pixels to the feel than you in the end show, or observe sampling artifacts the place the grid of the feel’s texels is mismatched to the grid of the display’s pixels.
[ad_2]