This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
public class AssetBundleChecker | |
{ | |
[MenuItem("Assets/CreateLink.xml")] | |
static void Create() | |
{ | |
var generator = new LinkXmlGenerator(); | |
// UnityEditor.Animations.AnimatorControllerを取得してしまうので、RuntimeAnimatorControllerに変更 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void anime_perspective(inout float4 v) { | |
float3 cameradir = float3(-UNITY_MATRIX_V._m02, -UNITY_MATRIX_V._m12, -UNITY_MATRIX_V._m22); // カメラの方向ベクトル | |
float3 viewdir = WorldSpaceViewDir(v); // 頂点からカメラへのベクトル | |
float len = length(viewdir); // 頂点とカメラとの距離 | |
float maxv = 2; // アニメパースをかける最大距離 | |
len = clamp(len, 0.0, maxv) / maxv; // アニメパースをかける距離を0~1の範囲にする | |
len = pow(1 - len, 4.0); // カメラとの距離の逆4乗となるようにする | |
float factor = 1.25; // まぁいい感じの係数 | |
v.xyz += mul(_World2Object, (-cameradir) * len * factor + (viewdir-cameradir) * len * factor); // 頂点をずらす | |
} |