Repository navigation
Draw_Shape
haw2fregel edited this page Mar 21, 2025
·
4 revisions
Draw_Shapeシェイプを描画します |
![]() |
|---|
Draw描画カラーを制御します |
![]() |
|
|---|---|---|
| 操作例 | ![]() |
|
Draw Color描画カラーを制御します |
Draw *= DrawColor | ![]() |
ShapeShape形状を調整します |
![]() |
|
|---|---|---|
| 操作例 | ![]() |
|
Shape TypeShapeの生成方法を変更します Distance Power:Pivotからの距離計算でShapeを生成します Polygon:多角形頂点からの距離計算でShapeを生成します |
Distance Power float dist = lengthN(uv - _ShapeCenter, _ShapeDistancePower) * 2; dist = saturate(dist); int samplePoint = (int) (dist * 511); samplePoint = clamp(samplePoint, 0, 511); float drawColor1 = _ShapeCurveArray[samplePoint]; float drawColor2 = _ShapeCurveArray[min(511, samplePoint + 1)]; float drawColor = lerp(drawColor1, drawColor2, frac(dist * 511)); return drawColor; Polygon p -= _ShapeCenter; p.x = p.x == 0 ? EPSILON : p.x; p.y = p.y == 0 ? EPSILON : p.y; float arctan2 = atan2(p.x, p.y) + PI; float r = PI * 2.0 / float(_PolygonCount); float dist = cos(floor(0.5 + arctan2 / r) * r - arctan2) * max(length(p) - _PolygonBump, EPSILON) / (1.0 - _PolygonBump); int samplePoint = (int) (dist * 511); samplePoint = clamp(samplePoint, 0, 511); float drawColor1 = _ShapeCurveArray[samplePoint]; float drawColor2 = _ShapeCurveArray[min(511, samplePoint + 1)]; float drawColor = lerp(drawColor1, drawColor2, frac(dist * 511)); return drawColor; |
![]() |
CurveCurveを利用してShapeのグラデーションを調整します |
![]() |
|
CenterShapeの中心点を変更します |
![]() |
|
Power距離計算の累乗値を変更します Shapeの形状が変わります |
float2 tmp = pow(abs(p) + 0.0001, Power); return pow(tmp.x + tmp.y, 1.0 / Power); |
![]() |
Polygon Count多角形Shapeの角数を変更します |
![]() |
|
BumpShapeの膨張度合を調整します +にすると膨らみ、-にすると凹んでいきます |
![]() |
UVDeformUVを変形します |
![]() |
|
|---|---|---|
| 操作例 | ![]() |
|
Pivot変形の原点を変更します これ単体では変化はありません |
![]() |
|
TileUVのサイズを変更します |
return (uv - _UVPivot) * _UVScale + _UVPivot; | ![]() |
RotateUVを回転します |
float rotate = value * (3.1415926f / 180.0f); float2 result = uv - center;<brfloat s = sin(rotate);<brfloat c = cos(rotate); float2x2 rMatrix = float2x2(c, -s, s, c);<brrMatrix *= 0.5; rMatrix += 0.5; rMatrix = rMatrix * 2 - 1; result.xy = mul(result.xy, rMatrix); result += center; return result; |
![]() |
BendUVを傾けます Pivotから遠いほどズレます |
return uv + float2(abs(uv.y - _UVPivot.x) * _UVBend.x, abs(uv.x - _UVPivot.y) * _UVBend.y); | ![]() |
Polar極座標に変換します |
float2 delta = uv - float2(0.5, 0.5) delta.x = delta.x == 0 ? EPSILON : delta.x delta.y = delta.y == 0 ? EPSILON : delta.y float radius = lengthN(delta, 2) * 2 float angle = atan2(delta.x, delta.y) * (1.0 / 6.28) + 0.5 return _UVPolar == 0 ? uv : float2(radius, angle); |
![]() |
RepeatUV0~1で繰り返すようになります |
frac(uv) | ![]() |
Opacity前Layerとの合成方法を制御します |
![]() |
|
|---|---|---|
| 操作例 | ![]() |
|
Blend Mode合成モードを変更します ※1:乗算の逆バージョンのイメージ 背景が暗いほど描画色が明るく反映されます ※2:ScreenとMultipleの合わせ技 背景が暗い場所は乗算、明るい場所はスクリーン コントラストが強くなります 白黒背景にOverlayを重ねると明暗を維持して色味を反映できます ※3:背景と描画色の差分出力します |
Overrite:BG * (1-opacity) + Draw * opacityAdd: BG + Draw * OpacitySubrtuct: BG - Draw * OpacityMultiple: BG * (1-opacity) + BG * Draw * opacityDivid: BG * (1-opacity) + BG / Draw * opacityMax: BG * (1-opacity) + max(BG ,Draw)* opacityMin: BG * (1-opacity) + min(BG ,Draw)* opacityScreen:※1 BG * (1-opacity) + (1-(1-BG)*(1-Draw))* opacityOverlay:※2 screen = (1-(1-BG)*(1-Draw))multiple = 2.0 * BG * Drawoverlay = multiple * (1-step(BG,0.5)) + screen * step(BG,0.5)BG * (1-opacity) + overlay * opacityDifference:※3 BG * (1-opacity) + abs(Draw - BG) + opacity
|
![]() |
Draw Channel描画時に利用するチャンネルを切り替えます R:赤 G:緑 B:青 A:アルファ Luminance:明るさ 1:描画カラーを無視して1で描画します 0:描画カラーを無視して0で描画します None:描画カラーを無視して背景色のままになります 特定チャンネルのみを描画したり、チャンネルを入れ替えたい場合に利用します |
![]() |
|
Opacity合成割合を調整します BlendModeに合わせた計算に利用されます |
opacity *= drawColor.w | ![]() |
Power累乗計算します Draw^power
|
![]() |
|
Multiply Alphaopacityに対して描画カラーのアルファを乗算します |
![]() |
|
OneMinus描画カラーを反転します |
1 - Draw | ![]() |
Contrast描画カラーのコントラストを調整します 0.5以下はより暗く、0.5以上はより明るく |
saturate((Draw- 0.5) * _Contrast + 0.5) | ![]() |
| Draw_Noise | Layer | Draw_TileAndOffset |




























