x


camera view independent of resolution

hi, i was wondering how to make my second camera, that shows interface controls in the top-right corner of the screen, resolution independent.

i have these values set in the inspector:

Normalized Viewport Rect: X:0.8 Y:0.0 Width:1 Height:1

but when i start the player and make game screen bigger, it messes up the view of the second camera. how to make it consistent?

more ▼

asked Jul 12 '10 at 04:40 PM

pretender gravatar image

pretender
497 121 134 145

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Well you should probably change the width and height to .2, .2, because you're rendering a lot of it off screen with your X position at .8.

Using that method should make it resolution independent, if by resolution independent you mean it's the same percentage of the screen regardless of resolution.

However, a better way to do it might be to render that camera to a texture and render that texture on some geometry that has a fixed aspect ratio, so you don't have issues with rendering the game at different aspect ratios changing the aspect ratio of your interface controls.

more ▼

answered Jul 12 '10 at 04:50 PM

Tetrad gravatar image

Tetrad
7.2k 27 37 89

That would only work with Pro, and seems relatively resource-intensive when you could just change the X and width of the viewport rect to compensate for different aspect ratios.

Jul 12 '10 at 07:13 PM Eric5h5

Well there are other benefits to that, like being able to render to a non-axis-aligned rectangle.

Jul 12 '10 at 07:30 PM Tetrad
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2992
x378
x74
x14

asked: Jul 12 '10 at 04:40 PM

Seen: 2443 times

Last Updated: Jul 12 '10 at 04:40 PM