Shader」タグアーカイブ

Unityで滝のシェーダー

Unityのシェーダーで滝の表現を試してみました。

waterfall

参考にさせてもらったのはこちらのblogです。

Unity シェーダーチュートリアル  滝を作ってみる – Tsumiki Tech Times|積木製作
http://tsumikiseisaku.com/blog/shader-tutorial-waterfall/

Textureの作り方で雰囲気も変わってくるかなと思います。

シェーダーを書くときのfloat/half/fixedの使い分け

シェーダーを書くときのfloathalffixedの使い分けについて

float

通常のプログラミング言語のfloatと同じ32ビット

  • ワールド空間の位置
  • テクスチャ座標

half

一般に16ビット

  • ベクトル
  • オブジェクト空間位置
  • HDRカラー

fixed

一般的に11ビット

  • テクスチャデータ

十分な精度になっているかどうかの検証は実機上で試してみる方が良いそうです。

リンク

シェーダーを書く場合のパフォーマンスのヒント – Unity マニュアル
https://docs.unity3d.com/ja/current/Manual/SL-ShaderPerformance.html

シェーダーのデータタイプと精度 – Unity マニュアル
https://docs.unity3d.com/ja/current/Manual/SL-DataTypesAndPrecision.html

Too many texture interpolators would be used for ForwardBase pass

Unityのシェーダーで

Shader error in '':
Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line xx

のようなエラーが出る場合は

#pragma target 4.0

を追加すると動くようになることがあるみたいです。

リンク

Terrain Transparency – Too many text interpolators – Unity Answers
https://answers.unity.com/questions/1077032/terrain-transparency-too-many-text-interpolators.html