Terrain & Light & Camera

时间:2023-07-29 14:47:02

Terrain Engine

1、When you press F, wherever your mouse is positioned will be moved to the center of the Scene View. This allows you to touch up an area, and quickly zoom over to a different area and change something else. If your mouse is not hovering over an area of the Terrain when you press the F key, the entire Terrain will be centered in your Scene View.

  当鼠标指向Terrain中某一位置时按F按,则会将该块地图剧中显示。如果鼠标没有指向Terrain时,则将整块Terrain居中显示。

2、HeightMap

  Heightmap, 高度图。通常Heightmap高度图储存成Gray Scale Image也就是常说灰度图。越白该点就越高,纯黑表示最低点,纯点表示最高点。8

  位灰度图有256阶。16位灰度图有65536阶。如果依然精度不够用的话(例如绘制大型场景),那么可以使用标准的RGB位图来储存高度图,那么精度就是256的3次方=16777216阶。同理还可以再升为RGBA。Heightmap可以用3D软件(Unity的地形也可以)来绘制,或者Photoshop里的插件。

3、There are four types of lights in Unity:

  • Directional lights are placed infinitely far away and affect everything in the scene, like the sun.
  • Point lights shine from a location equally in all directions, like a light bulb.
  • Spot lights shine from a point in a direction and only illuminate objects within a cone - like the headlights of a car.
  • Area lights (only available for lightmap baking) shine in all directions to one side of a rectangular section of a plane.

4、What's light cookie?

  The alpha channel of this texture is used as a mask that determines how bright the light is at different places. If the light is aSpot or a Directional light, this must be a 2D texture. If the light is a Point light, it must be a Cubemap.

5、多个Camera无法同步各自的SkyBox,所以当有多个Camera时,必须把SkyBox赋给场景,才能使得多个SkyBox同步。

6、默认具有最大深度的Camera成为主Camera。可以按如下试切换Camera:

     if(GUILayout.Button("投射侧面",GUILayout.Height(50)))
{
//关闭Camera1与Camera2
Camera1.active = false;
Camera2.active = false;
//打开Camera0
Camera0.active = true;
}