Displays a rounded background in the unity3d. There are two ways, one is to display on the GUI, which is usually used on the UI. The other is shown by the 3D plane, which is used in the game scene, such as a small map of the game.
1. GUI Display
Add a background image, add a picture, respectively, is a transparent background, black round and black five corners, PNG pictures.
Add a panel, and then add an image under the panel
Add the picture background to the image
Add a mask component to a panel
Add the circle to the panel
This time, you can see a circular background map.
If you add a five-point shape to a panel, you see a five-angle background.
2. Plane method
This method is suitable for making small maps.
First add a shader
Change a name.
Double-click to edit content later
Shader "Custom/mask" {Properties{_maintex ("Main Texture", 2D) = "White" {}_mask ("Mask Texture", 2D) = "White" {}}subshader {Lighting onzwrite offblend srcalpha oneminussrcalpha Pass {settexture [_mask] {combine texture}settexture [_maintex] {Co Mbine texture,previous}}}}
In PS inside make a black bottom, Bai. Save As TGA format
Locate the imported TGA file
Reset properties as follows
Add a plane to the scene and drag the background onto the plane
Select the resulting material
Change the shader property to Custom/mask
Set the mask texture property to mask, and this time in the editor it becomes round.
The camera's clear flages property needs to be set to depth only
Run the preview and you'll see the round background. When used, you need a dual camera, a display background, a display content.
Unity3d show round or irregular backgrounds