はじめに 今回はShaderGraphでオブジェクトやカメラの方向によって色が変わるシェーダーを作成していきます。 環境は Unity 2021.3.25f1です Universal Render Pipeline を使用しています。 ノード作成 View DirectionノードのXとYを加算したものをFractionノードで0~1で繰り返すことでオブジェクトの向きによっていい感じにグラデーションするようになります。 横向きを変えた時だけ色を変えたいときは View DirectionノードのXのみを使用することで横向きを変えた時だけ色を変えることもできます。(縦向きはYのみを使用すればいい) 完成