これは、いわゆる “command buffers” で、Unity の Unity のレンダリングパイプライン を拡張することができます。 コマンドバッファがレンダリングコマンド(“set render target, draw mesh, …”)のリストを保持し、 カメラがレンダリング中にさまざまなポイントで実行するように設定することができます。
例えば、すべての通常のオブジェクトが完了した後、Deferred Shading レンダリングパス G バッファに追加するいくつかのオブジェクトをレンダリングできます。
カメラがどのように Unity においてシーンを生成するかという高水準での概要を以下に示します。 緑のドットで示された各ポイントでコマンドを実行するために、コマンドバッファを追加することができます。
詳細は、CommandBuffer scripting class と CameraEvent enum を参照してください。
コマンドバッファはイメージエフェクトの代わりとしてもいいですし、イメージエフェクトと一緒に使用することができます。
コマンドバッファで可能なテクニックのいくつかをデモンストレーションするサンプルプロジェクト RenderingCommandBuffers.zip.
このシーンは “blurry refraction” テクニックを示しています。
opaque オブジェクトとスカイボックスがレンダリングされた後、現在のイメージはテンポラリ レンダーターゲットにコピーされ、ぼかしを行い、グローバルシェーダープロパティーを設定します。 屈折をシミュレーションするために、法線マップに基づき、UV 座標をオフセットして、 glass オブジェクトのシェイダーは、そのぼやけるイメージをシミュレートしてみます。
もっとカスタムなこと(この場合、ぼかし)ができる以外は、ShaderLab: GrabPass が行うことに似ています。
このシーンは、“custom deferred lights” の実装を示しています: sphere-shaped lights と tube-shaped lights
定期に deferred shading light が行われた後、 照明を計算して、それをライティングバッファに加えるシェーダーで、 球はカスタム光ごとに描かれています。
このシーンは “deferred decals”の基本的な実装を示しています。
考え方は次のとおりです: G-buffer が行われた後、デカール(ボックス)の各 “shape” を描き、 G-buffer の内容を変更します。これはライティングを積み重ねる代わりに G-buffer のテクスチャを変更すること以外、ライティングが deferred shading で行う方法と非常によく似ています。
各デカールは、ここでボックスとして実装され、箱の容積内の任意の形状に影響を 受けます。
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.