メッシュ用に独自の ライトマップ UV を生成することも、Unity が自動的に生成することもできます。
任意のコンテンツ作成ソフトウェアで独自のライトマップ UV を作成できます。ライトマップ UV をメッシュの 2 番目の UV チャンネルに配置する必要があります。
ライトマップ用に適切に設定された UV セットは、以下のルールに従う必要があります。
Model Import Settings を使用して、モデルのライトマップ UV を自動的に生成するように設定できます。
これらは、Generate Lightmap UVs を有効にすると、 Model Import Settings の Model タブに表示される設定です。
プロパティ | 説明 |
---|---|
Hard Angle | 隣接する三角形間の角度 (単位は度)。Unityはそれを鋭い切れ目と見なし、継ぎ目を作成します。これを 0 と 180 の間の値に設定できます。これはデフォルトで 88 度に設定されています。 これを 180 度に設定すると、Unity はすべてのエッジが滑らかであると見なし、これは有機的なモデルでは現実的です。デフォルト値 (88度) は機械的なモデルには現実的です。 |
Pack Margin | The margin between neighboring charts (in pixels), assuming the Mesh takes up the entire 1024x1024 lightmap. You can set this to a value between 1 and 64. A larger value increases the margin, but also increases the amount of space the chart needs. This is set to 4 pixels by default. For more information, see Pack Margin. |
Angle Error | ソースジオメトリの角度から UV 角度の可能な最大偏差 (0–100%)。これはデフォルトで 8% に設定されています。 これにより、UV 空間の三角形と元のジオメトリの三角形との違いを制御します。通常、ライトマップを適用するときにアーティファクトを避けるため、これはかなり低くする必要があります。 |
Area Error | ソースジオメトリの領域から UV 領域の可能な最大偏差 (0–100%)。これは、デフォルトでは 15% に設定されています。 これにより、相対的な三角形領域を維持する度合いを制御します。値を大きくするとチャートを少なくすることができますが、三角形の解像度が変わる可能性があります。そのため、発生する歪みがライトマップの品質を損なわないことを確認してください。 |
フィルタリングを可能にするために、ライトマップは、チャート境界近くのライティング情報 (単位はテクセル) を含んでいます。そのため、常にチャート間にいくらかのマージンを加えて、ライトマップを適用するときにライトのにじみを回避します。
ライトマップの解像度は、ライトマップのテクセル解像度を定義します。ライトマッパーは、ライトマップ内のいくつかのチャートテクセルを広げてエッジが黒くなることを避けます。そのため、メッシュの UV チャートは、ライトのにじみを避けるために、その間に少なくとも 2 テクセルの間隔を空ける必要があります。Pack Margin 設定を使用して、ジオメトリの UV チャート間に十分なマージンがあることを確認します。
ライトマップの UV 空間では、UV オーバーラップや偶発的なライトのにじみを避けるために、チャート間のパディングは少なくとも 2 テクセルである必要があります。この画像では、黒いスペースはチャート間のスペースを表します。
以下のスクリーンショットは解像度が同じですが、UV が異なります。最初の画像の Angle Error は高く設定され、結果に意図しないアーティファクトが含まれています。2 番目の画像ではデフォルトの Angle Error (8%) が設定されています。メッシュがより多くの三角形を持つと、角度の歪みにより形状を著しく歪ませます。
以下の画像では、同じパラメーターを持つ 2 つのスポットライトがシリンダーの側面を照らしています。その右側面は Area Error の値が高く、そのため、三角形が歪み、解像度が低くなり、ライトにアーティファクトが発生しています。
プログレッシブライトマッパーは 2018.1 で追加 NewIn20181
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.