Unityには、Standard Assets パッケージ 内にいくつかのウォータープレハブ (必要なシェーダー、スクリプト、アートアセットを含む) が含まれています。別々の昼間と夜間の水のプレハブが提供されています。
このドキュメントで説明する水の反射は、VR では利用できないので注意してください。
既存の水のプレハブの 1 つをシーンに置きます。 Standard Assets がインストール されていることを確認します。
プレハブは、ウォーターに楕円状のメッシュを使用します。別の メッシュ を使用したい場合は、メッシュをウォーターオブジェクトの Mesh Filter に変更するだけで簡単に使用できます。
シンプルなウォーターは、スクリプトの平面上メッシュへの追加とウォーターシェーダーの使用が必要です。
反射/屈折ウォーターをゼロからセットアップするにも、同様の手順が必要です。
これらのプロパティーは、Reflective および Refractive ウォーターシェーダーで使用します。その大半は、Simple ウォーターシェーダーでも使用されます。
プロパティー | 機能 |
---|---|
Wave scale | ウォーターの法線マップのスケーリング。この値が小さいほど、ウォーターは大きく揺れます。 |
Reflection/refraction distort | 波の法線マップで歪ませる反射および屈折の程度。 |
Refraction color | 屈折に対する追加の色合い。 |
Environment reflection/refraction | リアルタイムの反射および屈折に対するテクスチャをレンダリングします。 |
Normalmap | 波の形状を定義します。最後の波は、これら 2 つの法線マップを結合することで生成され、それぞれが、異なる方向、スケール、速度でスクロールします。2 つ目の法線マップは、1 つ目の法線マップの半分の大きさです。 |
Wave speed | 1 つ目の法線マップ (1 番、2 番) と 2 つ目の法線マップの (3 番、4 番) のスクロール速度 |
Fresnel | フレネル効果をコントロールするアルファチャンネルのあるテクスチャ。表示角度に基づく、反射と屈折の表示量。 |
残りのプロパティーは、Reflective および Refractive シェーダー自体によって使用されませんが、ユーザーのビデオカードがサポートしておらず、よりシンプルなシェーダーにフォールバックする必要がある場合は設定する必要があります。
プロパティー | 機能 |
---|---|
Reflective color/cube and fresnel | 表示角度に基づいた、ウォーターの色 (RGB) およびフレネル効果 (A) を定義するテクスチャ。 |
Horizon color | 水平線でのウォーターの色。Simple ウォーターシェーダーでのみ使用されます。 |
Fallback texture | もっと見た目のよいシェーダーを実行できない場合に、非常に古いビデオカードでウォーターを表すテクスチャ。 |
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.