Contenu connexe
Plus de Unity Technologies Japan K.K. (20)
【Unite 2017 Tokyo】「オルタナティブガールズ」〜50cmの距離感で3D美少女を最高にかわいく魅せる方法〜
- 12. •
•
CharacterPartsMeshData meshData = new CharacterPartsMeshData ();
meshData.renderer = renderers [i];
meshData.original = mesh;
meshData.lod = cruncherTarget.outputMesh;
meshes.Add (meshData);
// Prefab以下に格納
AssetDatabase.AddObjectToAsset (cruncherTarget.outputMesh, target);
- 41. •
•
•
inline fixed4 frag_toon_opaque (v2f_toon_sphere IN)
{
ALPHA_CLIP_DITHER(IN);
fixed4 col = tex2D(_MainTex, IN.texcoord.xy);
fixed3 rgb = col.rgb;
#ifdef DISABLE_LIGHT
#else
PROJ_FRAG_HALF(IN,rgb);
rgb *= unity_LightColor[0].rgb;
#endif
FRAG_OVERDRAW(IN,rgb);
// sphere
CHARACTER_SPHERE(IN,rgb);
// shadow
CHARACTER_SHADOW(IN,rgb);
// rim
CHARACTER_RIM(IN,rgb);
// final color
CHARACTER_FINAL_COLOR(rgb,col);
return col;
}
- 42. •
•
•
CGPROGRAM
#pragma multi_compile _ ENABLE_ALPHA
#pragma multi_compile _ ENABLE_SPHERE
#pragma multi_compile _ DISABLE_LIGHT
#pragma multi_compile _ G_PROJ_TEX G_PROJ_CUBE
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
ENDCG
- 43. •
•
var sph = targetMat.GetTexture ("_SphereCube");
var def = targetMat.IsKeywordEnabled ("ENABLE_SPHERE");
if (sph == null && def) {
targetMat.DisableKeyword ("ENABLE_SPHERE");
EditorUtility.SetDirty (targetMat);
} else if (sph != null && def == false) {
targetMat.EnableKeyword ("ENABLE_SPHERE");
EditorUtility.SetDirty (targetMat);
}