目次
カリング (Culling)
Back
:表面のみレンダリングする (デフォルト)Front
:裏面のみレンダリングするOff
:両面をレンダリングする
参考:
カリング制御可能な標準シェーダーを作る | Kludge Factory
Culling と Depth Testing | Unity 2018.4 マニュアル [公式]
透過/半透明シェーダー
参考:
Unity フラグメントシェーダーで背景を透過してみる | マカロン
スタンダードシェーダーで モデルを綺麗に半透明表示する – Qiita
3D モデルの半透明をキレイに表示するシェーダを実装する | コガネブログ
Unlit Shader の要素を全て解説 | アマガミナブログ
デプスバッファ/デプステスト (Depth Testing)
参考:
Culling と Depth Testing | Unity 2018.4 マニュアル [公式]
キューブマップ
参考:
シェーダーでキューブマップを描画するには | 3DCG school
ワールド座標系
参考:
_CameraDepthTexture と screenPos からワールド座標を復元する | 黒鳥のメモ
Replaced Shaders
Replacement Shader タグ
- Opaque
- Transparent
- TransparentCutout
- Background
- Overlay
- TreeOpaque
- TreeTransparentCutout
- TreeBillboard
- Grass
- GrassBillboard
参考:
Replaced Shaders でのレンダリング | Unity 2019.4 マニュアル [公式]
何も描画しないシェーダーを作る
Shader "Custom/Void"
{
SubShader
{
ColorMask 0 Zwrite Off
Pass {}
}
}
Code language: Arduino (arduino)
参考:
何もしない透明な Unity シェーダー/不要パーツを消す | 佐藤敏
すりガラス風
参考:
すりガラスの軽量表現 | Tsumiki Tech Times
トーンマップを適用する
参考:
ポストプロセスを使わずにトーンマッピングをする | Tsumiki Tech Times
global keywords exceeded エラー
現象:
シェーダーキーワードを制限以上に使用しているため一部のキーワードが無視される旨のエラーが発生する。
Maximum number (256) of shader global keywords exceeded, keyword _XXX will be ignored. You will have to delete some shaders or make them use less keywords.
対処法:
- 使用していないシェーダーあるいはキーワードをプロジェクトから取り除く。
- グローバルキーワードの代わりにローカルキーワードを使用する。
- キーワードを固定化 (ベイク) する。
- 「Shader Control」アセットを使って対処する。
参考:
Maximum number (256) of shader keywords exceeded – Unity Forum
Maximum number (256) of shader global keywords exceeded – Unity Forum
Maximum number (256) of shader keywords exceeded and materials are pink – Unity Forum
The “Maximum number (256) of shaders” error – Unity Forum
Shader keyword limit – Unity Forum
Maximum number (256) of shader global keywords exceeded, keyword Unity – Stack Overflow
発光
参考:
サンプラー
参考:
tex2D でミップマップをサンプリングする際に端にノイズが出る | しゅみぷろ
サンプラー状態の利用 | Unity 2019.4 マニュアル [公式]
TEXCOORD
参考:
使用する TEXCOORD をマテリアルから指定できるようにする | LIGHT11
Particle System の Custom Vertex Streams と Custom Data の使い方まとめ | LIGHT11
Blend
参考:
Blend – ShaderLab コマンド | Unity マニュアル [公式]
Offset
深度オフセット/深度バイアスを設定する。
参考:
Offset – ShaderLab コマンド | Unity マニュアル [公式]
Texture Combiners
参考:
Texture Combiners を理解する | Unity な日々
Texture Combiners | Unity 2019.4 マニュアル [公式]
テッセレーション (Tessellation)
DirectX 11 Watertight Adaptive Tessellation
頂点アニメーションテクスチャ/VAT シェーダー
参考:
Unity のシェーダー開発方法のまとめと備忘録/頂点アニメーションテクスチャ (VAT) シェーダー – Qiita
ディザリング
_DitherMaskLOD2D
参考:
ビルトインのディザ抜き用テクスチャを取得する | LIGHT11
スクリーンスペースブーリアン
参考:
Unity でスクリーンスペースのブーリアン演算をやってみた | 凹みTips
GLSL を移植する
参考:
Unity に GLSL (サーフェスシェーダー) を書く方法 | すだちキャンパス
パフォーマンス
旧シェーダーのパフォーマンス
およそ次の順序で描画負荷が高くなる。
- Unlit
- VertexLit
- Diffuse
- Normal mapped
- Specular
- Normal Mapped Specular
- Parallax Normal mapped
- Parallax Normal Mapped Specular
参考:
Unity シェーダーのパフォーマンス | Unity マニュアル [公式]
シェーダーを書く場合のパフォーマンスのヒント | Unity マニュアル [公式]
アルファテスト (Alpha Testing)
**LEGACY**
参考:
旧 Alpha Testing | Unity 2019.4 マニュアル [公式]
カラーマスク (ColorMask)
参考:
Pass | Unity 2019.4 マニュアル [公式]
旧シェーダー
Standard Shader が導入される以前に使用されていた各用途毎に個別に記述されたシェーダー。
ファミリー
法線シェーダー
透明シェーダー
参考:
Shader Tutorials (Ronja)
リンク:
リポジトリ:
ronja-tutorials/ShaderTutorials: Unity Shader Tutorials – GitHub
参考: