ICE SHADER FAMILY FOR MOBILE

Purpose of implementation.

  • Fully support to mobile devices such as opengl-es 2.x to 3.x.
  • Under limited of instruction counts 180.
  • Under limited texture fetching counts 6.
  • 完全支持移动设备,例如opengl-es 2.x至3.x.
  • 指令数限制下为180。
  • 在有限的纹理抓取下计数为6。

The game I’m developing now implements a point light that doesn’t work at all in the rendering core.

In order to achieve the permeation effect, the LUT of the Ramp method was used to express the depth of ice chunks inherently, and the Glitz phenomenon caused by scattering of ice or snow surface was implemented to give the user a visually interesting feeling.

目前正在开发的游戏在rendering core里Point light完全不能启用。

为了获得透射效果,使用了Ramp形式的LUT来表现冰块具有固有的深度,并通过实现由冰块或眼睛表面散射而形成的Glitz现象,增强了视觉上的趣味感。

而且,由于它通常是透过冰块的材质,所以阴影的强度比普通物件弱很多,一般情况下,方向光的阴影强度大部分使用1,修改后其他所有对象也会受到影响。

选择简单的方法在GetMainLightShadowParams() 函数中定义,在特定shader中放置关键字时,可以降低阴影浓度以进行处理。

In addition, the shadow density is weaker than normal objects because it is usually a transparent material of ice. In general, the shadow intensity of directional light is mostly 1, and all other objects are affected.I chose a simple method and defined it inside the GetMainLightShadowParams () function so that if I put keywords inside a specific shader, it handles it by lowering the shadow density.

In-dependency snow shader


Development of ice effect that can be calculated sufficiently with mobile hardware performance. This is mainly used for developing dungeon battle scenes.
Dungeon combat scenes are loaded independently and remove special effects related to weather changes or other environmental changes like other open scenes.
The overall performance was measured and the effect was expressed boldly.

冰效应的发展,可以通过移动硬件性能进行充分计算。
这主要用于开发地牢战斗场景。
地牢战斗场景是独立加载的,并且会删除与天气变化或其他环境变化(如其他开放场景)有关的特殊效果。
测量总体性能,并大胆表达效果。

Material Inspector of Unity3D.
//Parralex thickness shader here to start.
				float2 uv = input.uv.xy * float2( 1,1 ) + float2( 0,0 );
				float2 uv_BottomDepthMap = input.uv.xy * _BottomDepthMap_ST.xy + _BottomDepthMap_ST.zw;

				float3 tanToWorld0 = float3( WorldSpaceTangent.x, WorldSpaceBiTangent.x, WorldSpaceNormal.x );
				float3 tanToWorld1 = float3( WorldSpaceTangent.y, WorldSpaceBiTangent.y, WorldSpaceNormal.y );
				float3 tanToWorld2 = float3( WorldSpaceTangent.z, WorldSpaceBiTangent.z, WorldSpaceNormal.z );
				float3 ViewDirTS =  tanToWorld0 * WorldSpaceViewDirection.x + tanToWorld1 * WorldSpaceViewDirection.y  + tanToWorld2 * WorldSpaceViewDirection.z;
				ViewDirTS = normalize(ViewDirTS); //Parallex ice ground viewDir according to tangent
				float4 mask_Var = tex2D(_Mask , uv);
				float2 plx_bottom = ( ( mask_Var.b - 1 ) * ( ViewDirTS.xy / ViewDirTS.z ) * OutterDepthScale ) + uv;
				float2 uv_MiddleDepthMap = input.uv.xy * _MiddleDepthMap_ST.xy + _MiddleDepthMap_ST.zw;
				float2 plx_middle = ( ( mask_Var.g - 1 ) * ( ViewDirTS.xy / ViewDirTS.z ) * _MiddleDepthScale ) + uv;
				float4 combinedMiddleBottomAlbedo = lerp( ( tex2D( _BottomMap, plx_bottom ) * _BottomDark ) , ( tex2D( _MiddleMap, plx_middle ) * _MidDark ) , tex2D( _Mask, plx_middle ).r);
				float4 albedoCombined = lerp( combinedMiddleBottomAlbedo , half4(0,0,0,1) , mask_Var.r);
				float2 uv_normalTop = input.uv.xy * _normalTop_ST.xy + _normalTop_ST.zw;
				float2 uv_RoughnessMap = input.uv.xy * _RoughnessMap_ST.xy + _RoughnessMap_ST.zw;
				float4 roughness_Var = tex2D( _RoughnessMap, uv_RoughnessMap );
				float3 normalCombined = lerp( float3(0,0,1) , UnpackNormalScale( tex2D( _normalTop, uv_normalTop ), 1.0f ) , ( mask_Var.g * roughness_Var ).rgb);

Categories: shader

Tagged as: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s