Dual mat-cap corrected technique

Dual mat-cap corrected technique

I was used screen space light texture technique (matcap or lightcap) since from 2006 in years.

And then my new stuff of new matcap technique (I called dual matcap technique) since by 2015 in years When I developed android mobile game in Korea.

Basically matcap technique is So famous tweak shader lighting technique for mobile games.

But I curious Could I use to dual side of matcap?

So here is results.

自2006年以来,我一直在使用屏幕空间光纹理技术(matcap或lightcap)。

然后我的新东西是新的matcap技术。

基本匹配的技术是用于手机游戏的着名的调整着色器照明技术。

但我很好奇我可以使用matcap的双面吗?

所以这是结果。

Paraboloid意思就是数学上的抛物面公式。

https://en.wikipedia.org/wiki/Paraboloid

在这里插入图片描述
如图所示,看上图的凸面镜和凹面镜的话,更容易理解。

这样的凸面抛物面用两个,当做environment map或者irradiance map来使用。

有实时捕捉环境图的方法和在手游里面能让他快速运行而使用的pre compute的方法。

本章就讲第二种方法pre compute based irradiance map和Specular Glossy filtering map。

还有关于实际shader 的 implementation,从构造要怎么设计开始到制作为止。

★ What is the dual parabolic environment map
(A View-Independent Parameterization for Environment Maps)
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Result is here

在这里插入图片描述

Dual Matcap Preview Demo Clip here

Shader /*ase_name*/ "Leegoonz/ASETemplateShaders/ParabolicMatcap" /*end*/
{
	Properties
	{
		_FrontParaboloid ("_FrontParaboloid", 2D) = "white" { }
		_RearParaboloid ("_RearParaboloid", 2D) = "white" { }
		/*ase_props*/
		
	
	}
	
	SubShader
	{
		Tags { "RenderType"="Opaque" "LightMode" = "ForwardBase" /*ase_tags*/}
		LOD 100
		Cull Off
		/*ase_pass*/

		Pass
		{
			CGPROGRAM
			#pragma target 3.0 
			#pragma vertex vert
			#pragma fragment frag
			#include "UnityCG.cginc"
			/*ase_pragma*/

			struct appdata
			{
				float4 vertex : POSITION;
				float3 normal : NORMAL;	
				float4 texcoord : TEXCOORD0;
				float4 texcoord1 : TEXCOORD1;
				UNITY_VERTEX_INPUT_INSTANCE_ID
				/*ase_vdata:p=p;uv0=tc0.xy;uv1=tc1.xy*/
			};
			
			struct v2f
			{
				float4 vertex : SV_POSITION;
				float4 texcoord : TEXCOORD0;
				float3 worldNormal : TEXCOORD1;
				UNITY_VERTEX_OUTPUT_STEREO
				/*ase_interp(1,7):sp=sp.xyzw;uv0=tc0.xy;uv1=tc0.zw*/
			};

			
			uniform fixed4 _Color;
			uniform sampler2D _FrontParaboloid;
			uniform sampler2D _RearParaboloid;
			/*ase_globals*/
			
			v2f vert ( appdata v /*ase_vert_input*/)
			{
				v2f o;
				UNITY_SETUP_INSTANCE_ID(v);
				UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
				o.texcoord.xy = v.texcoord.xy;
				o.texcoord.zw = v.texcoord1.xy;
				
				// ase common template code
				/*ase_vert_code:v=appdata;o=v2f*/
				
				v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3*/ float3(0,0,0) /*end*/;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.worldNormal = normalize(mul((float3x3)unity_ObjectToWorld, v.normal));
				return o;
			}

			inline fixed4 texParaboloidXFliped(sampler2D front, sampler2D back, float3 refl)
			{
				if (refl.x > 0)
				{
					float2 frontUv;
					frontUv.x = refl.z / (refl.x + 1);
					frontUv.y = refl.y / (refl.x + 1);
					frontUv = (frontUv * .5f) + 0.5f;
		
					frontUv.x = 1 - frontUv.x;

					return tex2D(front, frontUv);
				}
				else
				{
					float2 backUv;
					backUv.x = refl.z / (1 - refl.x);
					backUv.x *= -1;
					backUv.y = refl.y / (1 - refl.x);
					backUv = (backUv * .5f) + 0.5f;
	
					backUv.x = backUv.x;
		
					return tex2D(back, backUv);
				}
			}
			
			fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target
			{
				fixed4 parabolicOut;
				// ase common template code
				/*ase_frag_code:i=v2f*/
				
				parabolicOut = /*ase_frag_out:Albedo Color;Float4*/float4(1,1,1,1)/*end*/;
				//return myColorVar;
				return parabolicOut * texParaboloidXFliped(_FrontParaboloid, _RearParaboloid, i.worldNormal);;
			}
			ENDCG
		}
	}
	CustomEditor "ASEMaterialInspector"
}

About JP

链接: Website.
在这里插入图片描述
在这里插入图片描述
出生在韩国的TA。
1997年开始从事电脑图形视觉化工作后,在这个行业已经有21年经验了。
在多个网络游戏公司引领过美术团队,之前在allegorithmic担任TA负责人,在中国网易盘古工作室担任TA总监,现在是巨人网络TA部门的总负责人。
懒惰的人才有创意”是他坚信并执行的哲学道理。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章