I’m creating an RTS and have a minimap (with unit icons) covering the entire map displayed in the top right corner, using a second camera. When pressing “M”, the minimap expands to cover the entire screen height vertically and scales proportionally horizontally. However, when expanding the minimap, the image gets very blurry. Images attached.
What I do to expand the minimap is that I resize the rect transform used to hold the image used to project the second cam image.
miniMapRect = miniMapView.GetComponent<RectTransform>();
miniMapRect.sizeDelta = new Vector2(Screen.height * 1.0909f, Screen.height);
Anyone know why this is and what I can do about it? Or am I going about this in the wrong way altogether?
I’d guess the blurriness comes from the resolution of the render texture to which the minimap camera is rendering. Ideally, you want your RenderTexture to have the about same pixel dimensions as the space where its output is shown.
You may want to either increase the RenderTexture dimensions permanently or maybe have two; a nice small one you use for most of the time and then a big one you switch to during your minimap expansion transition. Or alternatively, you could recreate the single RenderTexture when you shrink/expand, changing its dimensions on the fly.
Might also be some value in looking at the Filter Mode property of the RenderTexture asset. Bi/Tri-linear filtering will tend to soften the image while zooming in/out. Point filtering will produce a sharper, more pixelly result.