GOSUKE FACTORY

何かの記録

2020/11/25 - 
MSC
 Shader を作成することで、頂点カラーで陰影をつける事が My Summer Car でもできたので、UV は適当に作業する事にしました。その代わりに、きれいに頂点カラーで陰影がつけられるようにメッシュの調整が必要になり手間がかかりますが、ちくちく UV を弄るよりかは、こっちの方がまだ楽しい。

 ただ、見よう見まねでごちゃごちゃ組み合わせた Shader なので、ちょっと心配です。あと、もう1枚テクスチャを重ねて、汚れの描画ができればいいのですが、うーん。


Shader "Custom/Shader_VertexColor" {
	Properties {
			_MainTex ("Albedo", 2D) = "white" { }
			_Color      ("Color"     , Color      ) = (1, 1, 1, 1)
			_Metallic   ("Metallic"  , Range(0, 1)) = 0.0
			_Glossiness ("Smoothness", Range(0, 1)) = 0.5
			_Occlusion  ("Occlusion" , Range(0, 1)) = 1.0
		 	_BumpScale ("Scale", Float) = 1
 			_BumpMap ("Normal Map", 2D) = "bump" { }
	}

	SubShader {
		Tags {
			"Queue"      = "Geometry"
			"RenderType" = "Opaque"
			}
		
		CGPROGRAM
			#pragma target 3.0
			#pragma surface surf Standard fullforwardshadows
			fixed4 _Color;
			sampler2D _MainTex;
			sampler2D _BumpMap; 
 			half _BumpScale; 
			half _Glossiness;
			half _Metallic;
			half _Occlusion;

			struct Input {
			float2 uv_MainTex;
				fixed4 color : COLOR;
			};

			void surf (Input IN, inout SurfaceOutputStandard o) {
				fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
				o.Albedo     = c.rgb * lerp(1, IN.color, _Occlusion);
				o.Metallic   = _Metallic;
				o.Smoothness = _Glossiness;

				fixed4 n = tex2D(_BumpMap, IN.uv_MainTex); 
				o.Normal = UnpackScaleNormal(n, _BumpScale); 

			}
		ENDCG
	}

	FallBack "Diffuse"
}




Youtube Twitter



 当サイトはPC版ゲームのMODを中心に取り扱うなか、私gosukeのたわ言をつらつらと記録しています。(MODとはModification、元のゲームに様々な要素を追加・改変する事で、オリジナルのゲームよりさらに楽しめる幅が広がります。)

 また、リンクフリーではありますが、ファイルへの直リンクは出来ればご遠慮お願い致します。バナーでリンクする場合は下にあるバナーを使用して下さい。

管理者:gosuke

banner

意見、要望、感想、叱咤、激励、などなどありましたら下の意見箱またはX(旧Twitter)にメッセージをどうぞ。
意見箱