Unity basic operations

Basic Operations

Combination of objects

1. From the combined object needs a selected as the parent object, other objects as child objects, i.e., the sub-drag the object to a parent, the parent object can be the operation to achieve the overall operation, the following effects.

2. In the combination of the object, the coordinates of the parent object is the combination of the coordinates, the coordinates of the child objects of the child objects, said relative position (relative position) of the parent object.

3. In practice, generally reset the child objects at Transform.

4. The use of techniques:

In order to avoid changes in demand factors in the development process, easy to change the model, you can create an empty game object, as a parent, then the need to combine objects as children, the combination of behavioral binding on the parent object, so, If you need to replace the model is much more convenient.

Material Material

  1. It refers to the texture, color, texture, smoothness, transparency and reflectance, the luminance of the object and the like.
  2. Shader shader: specialized rendering 3D (2D) graphic image; Shader standard may be provided, different standards, different properties inside. The default is standard.
  3. Texture: Additional maps texture to the surface of the object.
  4. Set the material combination of:

         Create a material mt_gameObj in the project, as shown below.

        

       In the following interface material disposed related attributes.

       

        In combination, a set made of mt_gameObj, can. When provided by a parent object, a parent object which need to add a Mesh Renderer grid renderer.

  1. Set texture (map):

           Drag pictures directly to an object, the system will automatically generate a material (reflectivity before image).

       

 

Rendering mode ( Rendering Mode )

  1. Physical shader (PBS): can create realistic environments under different light effects, follow certain physical laws.
  2. Rendering modes:

      Opaque : opaque, the default option.

     Transparent : transparent, a translucent transparent objects; such as glass.

      Cutout:镂空,用于完全透明或完全不同的物体,如栅栏,是在一个平面上镂空实现的。

      Fade:渐变,用于需要渐入渐出的物体。

 

     设置好相关模式之后,需要更改颜色下的A的值(透明通道)。

     

 

材质的本质

       材质是Shader的实例,是一段嵌入到渲染管线中的程序,控制GPU运算图像效果的算法。

      Shader接收一个值,这个值就是材质Material所设置的各种属性,而材质中可以设置Shader。

      GameObject-->Mesh Renderer-->Material-->Color,反应了实际编程中如何操作一个对象的颜色。

 

 

Shader与材质

  1. 如何将外界导入的Shader给某个对象,需要做个材质,把Shader拖拽到材质上,然后把材质拖拽到对象上即可。

 

摄像机(Camera

 

  1. 向玩家捕获和显示世界,有捕获范围,相机数量不受限制。
  2. 组件:

    1. Transform:变换组件
    2. Camera:捕获显示世界
    3. GUILayer
    4. Flare Layer
    5. Audio Listener:音频监听器,接收场景输入的音频Audio Source 并通过计算机播放声音。

            

 

    3.Canera属性

          

 

  1. Clear Flags:

          天空盒(SkyBox):围绕整个场景的包装器,用于模拟天空的材质,种类有6 SidedProcedural

     2.   6 Sided天空盒的做法:

            一种方法是创建一个材质m,设置shader为skybox-->6 Siderd,设置留个面的图片,然后在摄像机面板上添加组件SkyBox,  然后设置为材质m;

           另一种更好的方法是,通过窗口(windos)-->渲染-->照明设置来选择天空盒材质,这个设置效果比第一中真实,可作为反射源将天空色彩反射到场景中。

            

 

    3. Procedural天空盒

       

 

4.摄像机属性介绍

       

  1. Culling Mask(剔除遮罩)

         1)添加一个图层my_layer

           

          2) 添加一个对象,设置其图层为my_layer,此时物体摄像机可见;

          3)设置Culling Mask中的my_layer图层,取消打钩,此时该物体摄像机不可见(这就是Culling Mask的作用),该不可见物               体系统不做渲染和操作;

 

     2.Projection(投影)

  1. 透视:用于做3D,具有近大远小;
    1. 视野:用于设置镜头(视野)的远近;
  2. 正交:做2D,忽略了远近视感;

   3.  Clipping Planes(剪裁面):设置摄像机的可视的远近;

        

 

   4. Viewport Rect:可以做小地图或后视镜等

       

         W=1,表示高度100%显示,w=0.5,表示高度显示一半,其他的同理;

 

    5.  Depth

      对于多个摄像机,其在渲染顺序上的位置,通过depth来设置,具有较低深度的摄像机将在具有较高深度 的摄像机之前渲染。

 

附:
本文章学习至bilibili-没有文明的文明-史上最全Unity3D教程

 

发布了89 篇原创文章 · 获赞 8 · 访问量 8867

Guess you like

Origin blog.csdn.net/TxyITxs/article/details/104032601
Recommended