回答編集履歴

1

頂点カラー版を追記

2017/12/19 10:32

投稿

Bongo
Bongo

スコア10807

test CHANGED
@@ -93,3 +93,67 @@
93
93
  faceColor = GetColor(sd, faceColor, outlineColor, outline, softness);
94
94
 
95
95
  ```
96
+
97
+
98
+
99
+ [追記]
100
+
101
+ FaceのColorは通常の動作と同様にFaceのTextureと乗算し、これとFONT SETTINGSのColor (Vertex)を乗算&スクリーン合成したパターンを追記します(コード的には大して違いはないですが...)。こちらの方が四隅に別々の色を設定してグラデーションにした場合にも対応できて便利そうですね。
102
+
103
+
104
+
105
+ ```HLSL
106
+
107
+ float scale = input.param.y;
108
+
109
+ float bias = input.param.z;
110
+
111
+ float weight = input.param.w;
112
+
113
+ float sd = (bias - c) * scale;
114
+
115
+
116
+
117
+ float outline = (_OutlineWidth * _ScaleRatioA) * scale;
118
+
119
+ float softness = (_OutlineSoftness * _ScaleRatioA) * scale;
120
+
121
+
122
+
123
+ half4 outlineColor = _OutlineColor;
124
+
125
+ half4 texColor = tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y) * _FaceColor; // texColorは基本色とテクスチャ色の積とする
126
+
127
+
128
+
129
+ // 頂点色とtexColorを乗算&スクリーン合成
130
+
131
+ half3 screenColor = saturate((input.color.rgb - 0.5) * 2.0);
132
+
133
+ half3 multiplyColor = saturate(input.color.rgb * 2.0);
134
+
135
+ half3 modifiedTexColor = texColor.rgb * multiplyColor;
136
+
137
+
138
+
139
+ modifiedTexColor = modifiedTexColor + screenColor - modifiedTexColor * screenColor;
140
+
141
+
142
+
143
+ half4 faceColor = half4(modifiedTexColor, texColor.a); // 合成結果をfaceColorとする
144
+
145
+
146
+
147
+ outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y);
148
+
149
+
150
+
151
+ faceColor = GetColor(sd, faceColor, outlineColor, outline, softness);
152
+
153
+ ```
154
+
155
+
156
+
157
+ インスペクタの設定
158
+
159
+ ![プレビュー](c0dfb5a1fb7cbf91285594cb9b2a4ba7.gif)