Version: 2021.1
言語: 日本語
public void RecalculateNormals (Rendering.MeshUpdateFlags flags= MeshUpdateFlags.Default);

パラメーター

flags Flags controlling the function behavior, see MeshUpdateFlags.

説明

三角形と頂点からメッシュの法線を再計算します

頂点を変更した後、変更を反映させるために法線を更新することがしばしば必要です。法線はすべての共有される頂点によって計算されます。

インポートされたメッシュは、すべての頂点を共有しないことがあります。たとえば UV のシーム(継ぎ目)の頂点は2 つの頂点に分割されます。そのため、RecalculateNormals 関数は UV シームで滑らかでない法線を作成します。

Note that RecalculateNormals does not generate tangents automatically, to do that use RecalculateTangents.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { Mesh mesh = GetComponent<MeshFilter>().mesh; mesh.RecalculateNormals(); } }

RecalculateNormals converts Mesh vertex position data to VertexAttributeFormat.Float32 format, if the format is different.

See Also: RecalculateTangents.