Mesh Components
Material

Meshes

Switch to Scripting

Meshes make up a large part of your 3D worlds. Aside from ProBuilder and some Asset storeA growing library of free and commercial assets created by Unity and members of the community. Offers a wide variety of assets, from textures, models and animations to whole Project examples, tutorials and Editor extensions. More info
See in Glossary
plugins, Unity does not include modeling tools. Unity does however have great interactivity with most 3D modeling software. Unity supports triangulated or quadrangulated polygon Meshes. You must convert Nurbs, Nurms, and Subdiv surfaces to polygons.

Textures

Unity follows a specific search plan to automatically look for the Textures used by a MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary
on import. First, the importer looks for a sub-folder called Textures within the same folder as the Mesh or in any parent folder. If this fails, Unity performs an exhaustive search of all Textures in the Project. Although slightly slower, the main disadvantage of the exhaustive search is that there could be two or more Textures in the Project with the same name. In this case, it is not guaranteed that Unity can find the right one.

Place your textures in a Textures folder at or above the assets level
Place your textures in a Textures folder at or above the asset’s level

Material Generation and Assignment

Enable Import Materials on the Material tab of the Import Settings window
Enable Import Materials on the Material tab of the Import Settings window

For each imported Material Unity if you disable Import Materials, then it assigns the Default-Diffuse Material.

If you enable Import Materials and choose Use Embedded Materials from the Location drop-down menu, Unity uses the following strategy:

  1. Unity picks a name for the Unity Material based on the Naming setting.
  2. Unity looks for an existing Material with that name. The scope of the Material search is defined by the Search setting.
  3. If Unity uses any existing Material it finds for the imported SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
    See in Glossary
    . If it didn’t find a matching Material, it generates a new Material.

Colliders

Unity uses two main types of collidersAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary
: Mesh CollidersA free-form collider component which accepts a mesh reference to define its collision surface shape. More info
See in Glossary
and Primitive Colliders. Mesh colliders are components that use imported Mesh data and Unity can use them for environment collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a rigidbody component and is in motion. More info
See in Glossary
. When you enable Generate Colliders on the Model tab, Unity automatically adds a Mesh collider when the Mesh is added to the Scene so that the physics system considers it solid.

If you are moving the GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
around (a car for example), you cannot use Mesh colliders. Instead, you will have to use Primitive colliders. In this case you should disable the Generate Colliders setting.

Animations

You can import animations from a Model fileA file containing a 3D data, which may include definitions for meshes, bones, animation, materials and textures. More info
See in Glossary
. Follow the guidelines for exporting FBX files from your 3D modeling software before importing it into Unity.

Normal mapping and characters

If you have a character with a normal mapA type of Bump Map texture that allows you to add surface detail such as bumps, grooves, and scratches to a model which catch the light as if they are represented by real geometry. More info
See in Glossary
that was generated from a high-polygon version of the Model, you should import the game-quality version with a Smoothing Angle of 180 degrees. This prevents odd-looking seams in lighting due to tangent splitting. If the seams are still present with these settings, choose Calculate Legacy With Split Tangents from the TangentsOne of two handles that controls the shape of the animation curve before and after a key. Tangents appear when a key is selected in the Curves view, or when a key is selected in the Curve Editor.
See in Glossary
drop-down menu.

If you are converting a greyscale image into a normal map, you don’t need to worry about this.

Blend shapes

Unity has support for blend shapes (also called morph-targets or vertex level animation). Unity can import blend shapes from .FBX (blend shapes and controlling animation) and .dae (only blend shapes) exported 3D files. Unity blend shapes support vertex level animation on vertices, normals and tangents. Skin and blend shapes can affect Meshes at the same time. All imported Meshes with blend shapes use SkinnedMeshRenderer (no matter whether or not it has skin). Unity imports blend shape animation as part of regular animation: it animates blend shape weights on the SkinnedMeshRenderer.

There are two ways to import blend shapes with normals:

  • Choose Import from the NormalsThe direction perpendicular to the surface of a mesh, represented by a Vector. Unity uses normals to determine object orientation and apply shading. More info
    See in Glossary
    drop-down menu. This means that Unity uses the same logic for calculating normals on a Mesh and blend shapes.
  • Export smoothing groups information to the source file. This way, Unity calculates normals from smoothing groups for Mesh and blend shapes.

If you want tangents on your blend shapes, then choose Import from the Tangents drop-down menu.

Hints

  • Merge your Meshes together as much as possible. They should share Materials and Textures as much as possible. This has a huge performance benefit.

  • If you need to set up your GameObjects further in Unity (adding physics, scripts or other components), make sure you name your GameObjects properly in your 3D application. Working with names like pCube17 or Box42 can be very difficult.

  • Center your Meshes on the world origin in your 3D modeling application. This makes it easier to place them in Unity.

  • If a Mesh does not have vertex colors, Unity automatically adds an array of all-white vertex colors to the Mesh the first time Unity renders it.

  • The Unity Editor shows too many vertices or triangles (compared to the original Model in your 3D modeling application).

    This is correct. What you are looking at is the number of vertices/triangles actually being sent to the GPU for renderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
    See in Glossary
    . In addition to the case where the Material requires them to be sent twice, other things like hard-normals and non-contiguous UVs increase vertex/triangle counts significantly compared to what a 3D modeling application tells you. Triangles need to be contiguous in both 3D and UV space to form a strip, so when you have UV seams, degenerate triangles have to be made to form strips, which bumps up the count.


对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答