Commit f40ca906 authored by xujr's avatar xujr

UI修正,动画修正,果汁效果优化

parent 74afdf22
Shader "Unlit/3DdiscardTest"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
//裁切的范围(根据实际物体大小而定,通过C#赋值)
_DiscardFactor("DiscardFactor",Range(-1,10)) = 0.0
//切口光的颜色
_LightColor("LightColor",Color) = (1,1,1,1)
//光的宽度
_LightWidth("LightWidth",Range(0.0,0.1))=0.05
}
SubShader
{
Tags { "RenderType"="Opaque" }
//不关闭背面剔除的话看不到物体内侧
Cull off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float3 worldPos:TEXCOORD1;
};
sampler2D _MainTex;
float _YFactor;
float _DiscardFactor;
float4 _LightColor;
float _LightWidth;
v2f vert (appdata_base v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.worldPos= mul(unity_ObjectToWorld, v.vertex).xyz;
o.uv = v.texcoord;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float factor = _YFactor-i.worldPos.y + _DiscardFactor;
//_YFactor-i.worldPos.y=0时像素为物体中心,大于0像素在下面,小于0像素在上面,_DiscardFactor越小,factor越小,下面保留的就越少
if (factor<0)
{
discard;
}
float4 color = tex2D(_MainTex, i.uv);
//factor<0的部分已经被裁减,剩下的部分在加个边界做切面的描边
if (factor < _LightWidth)
{
return _LightColor;
}
return color;
//优化了上面if的写法,等价,但是看起来比较绕
//float lerpFactor=saturate(sign(_LightWidth -factor));
//return color * (1 - lerpFactor) + lerpFactor * _LightColor;
}
ENDCG
}
}
}
\ No newline at end of file
Shader "Unlit/3DdiscardTest"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
//裁切的范围(根据实际物体大小而定,通过C#赋值)
_DiscardFactor("DiscardFactor",Range(-1,10)) = 0.0
//切口光的颜色
_LightColor("LightColor",Color) = (1,1,1,1)
//光的宽度
_LightWidth("LightWidth",Range(0.0,0.1))=0.05
}
SubShader
{
Tags { "RenderType"="Opaque" }
//不关闭背面剔除的话看不到物体内侧
Cull off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float3 worldPos:TEXCOORD1;
};
sampler2D _MainTex;
float _YFactor;
float _DiscardFactor;
float4 _LightColor;
float _LightWidth;
v2f vert (appdata_base v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.worldPos= mul(unity_ObjectToWorld, v.vertex).xyz;
o.uv = v.texcoord;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float factor = _YFactor-i.worldPos.y + _DiscardFactor;
//_YFactor-i.worldPos.y=0时像素为物体中心,大于0像素在下面,小于0像素在上面,_DiscardFactor越小,factor越小,下面保留的就越少
if (factor<0)
{
discard;
}
float4 color = tex2D(_MainTex, i.uv);
//factor<0的部分已经被裁减,剩下的部分在加个边界做切面的描边
if (factor < _LightWidth)
{
return _LightColor;
}
return color;
}
ENDCG
}
}
}
\ No newline at end of file
Shader "Unlit/3DdiscardTest"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
//裁切的范围(根据实际物体大小而定,通过C#赋值)
_DiscardFactor("DiscardFactor",Range(0.00,0.67)) = 0.00
//切口光的颜色
_LightColor("LightColor",Color) = (1,1,1,1)
//光的宽度
_LightWidth("LightWidth",Range(0.0,0.1))=0.05
}
SubShader
{
Tags { "RenderType"="Opaque" }
//不关闭背面剔除的话看不到物体内侧
Cull off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float3 worldPos:TEXCOORD1;
};
sampler2D _MainTex;
float _YFactor;
float _DiscardFactor;
float4 _LightColor;
float _LightWidth;
v2f vert (appdata_base v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.worldPos= mul(unity_ObjectToWorld, v.vertex).xyz;
o.uv = v.texcoord;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float factor = _YFactor-i.worldPos.y + _DiscardFactor;
//_YFactor-i.worldPos.y=0时像素为物体中心,大于0像素在下面,小于0像素在上面,_DiscardFactor越小,factor越小,下面保留的就越少
if (factor<0)
{
discard;
}
float4 color = tex2D(_MainTex, i.uv);
//factor<0的部分已经被裁减,剩下的部分在加个边界做切面的描边
if (factor < _LightWidth)
{
return _LightColor;
}
return color;
}
ENDCG
}
}
}
\ No newline at end of file
Shader "Unityunity/LiquidBottle"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainColor("MainColor",Color) = (1, 1, 1, 1)
_TopColor("TopColor",Color) = (1, 1, 0, 1)
_FillAmount("FillAmout",Range(-2 ,2)) = 0
_EdgeWidth("EdgeWidth",Range(0 , 1)) = 0.2
_BottleWidth("BottleWidth",Range(0,1)) = 0.2
_BottleColor("BottleColor",Color) = (1,1,1,1)
_RimColor("RimColor",Color)=(1,1,1,1)
_RimWidth("RimWidth",float)=0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
Cull OFF
AlphaToMask on
//ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float fillEdge : TEXCOORD1;
float3 viewDir : COLOR;
float3 normal : COLOR2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainColor;
float _FillAmount;
float4 _TopColor;
float _EdgeWidth;
float4 _RimColor;
float _RimWidth;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.fillEdge=mul(unity_ObjectToWorld,v.vertex.xyz).y+_FillAmount;
o.normal=v.normal;
o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _MainColor;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);
float4 rimCol=_RimColor*smoothstep(0.5,1,dotProduct);
fixed4 edgeVal=step(i.fillEdge,0.5)-step(i.fillEdge,0.5-_EdgeWidth);
fixed4 edgeCol=edgeVal *= _TopColor*0.9;
fixed4 finalVal=step(i.fillEdge,0.5)-edgeVal;
fixed4 finalCol=finalVal*col;
finalCol+=edgeCol+rimCol;
fixed4 topCol=_TopColor * (edgeVal+finalVal);
// float dotVal = 1- pow(dot(i.normal, i.viewDir),0.3);
// return float4(dotVal,dotVal,dotVal,1);
return facing > 0 ? finalCol : topCol;
}
ENDCG
}
// Pass
// {
// //Cull Front
// Blend SrcAlpha OneMinusSrcAlpha
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// // make fog work
// #pragma multi_compile_fog
// #include "UnityCG.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float2 uv : TEXCOORD0;
// float4 normal : NORMAL;
// };
// struct v2f
// {
// float2 uv : TEXCOORD0;
// UNITY_FOG_COORDS(1)
// float4 vertex : SV_POSITION;
// float3 viewDir : COLOR;
// float3 normal :NORMAL;
// };
// float4 _BottleColor;
// float _BottleWidth;
// float4 _RimColor;
// float _RimWidth;
// v2f vert (appdata v)
// {
// v2f o;
// v.vertex.xyz+=v.normal.xyz*_BottleWidth;
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
// UNITY_TRANSFER_FOG(o,o.vertex);
// o.normal=v.normal.xyz;
// o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
// return o;
// }
// fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
// {
// // sample the texture
// fixed4 col = _BottleColor;
// // apply fog
// UNITY_APPLY_FOG(i.fogCoord, col);
// float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);//1-pow(dot(i.normal, i.viewDir),_RimWidth/10);
// float4 rimCol=_RimColor*smoothstep(0.2,1,dotProduct);
// return rimCol;
// }
// ENDCG
// }
}
}
\ No newline at end of file
Shader "Unlit/LiquidBottle"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainColor("MainColor",Color) = (1, 1, 1, 1)
_TopColor("TopColor",Color) = (1, 1, 0, 1)
_FillAmount("FillAmout",Range(-2 ,2)) = 0
_EdgeWidth("EdgeWidth",Range(0 , 1)) = 0.2
_BottleWidth("BottleWidth",Range(0,1)) = 0.2
_BottleColor("BottleColor",Color) = (1,1,1,1)
_RimColor("RimColor",Color)=(1,1,1,1)
_RimWidth("RimWidth",float)=0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
Cull OFF
AlphaToMask on
//ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float fillEdge : TEXCOORD1;
float3 viewDir : COLOR;
float3 normal : COLOR2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainColor;
float _FillAmount;
float4 _TopColor;
float _EdgeWidth;
float4 _RimColor;
float _RimWidth;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.fillEdge=mul(unity_ObjectToWorld,v.vertex.xyz).y+_FillAmount;
o.normal=v.normal;
o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _MainColor;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);
float4 rimCol=_RimColor*smoothstep(0.5,1,dotProduct);
fixed4 edgeVal=step(i.fillEdge,0.5)-step(i.fillEdge,0.5-_EdgeWidth);
fixed4 edgeCol=edgeVal *= _TopColor*0.9;
fixed4 finalVal=step(i.fillEdge,0.5)-edgeVal;
fixed4 finalCol=finalVal*col;
finalCol+=edgeCol+rimCol;
fixed4 topCol=_TopColor * (edgeVal+finalVal);
// float dotVal = 1- pow(dot(i.normal, i.viewDir),0.3);
// return float4(dotVal,dotVal,dotVal,1);
return facing > 0 ? finalCol : topCol;
}
ENDCG
}
// Pass
// {
// //Cull Front
// Blend SrcAlpha OneMinusSrcAlpha
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// // make fog work
// #pragma multi_compile_fog
// #include "UnityCG.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float2 uv : TEXCOORD0;
// float4 normal : NORMAL;
// };
// struct v2f
// {
// float2 uv : TEXCOORD0;
// UNITY_FOG_COORDS(1)
// float4 vertex : SV_POSITION;
// float3 viewDir : COLOR;
// float3 normal :NORMAL;
// };
// float4 _BottleColor;
// float _BottleWidth;
// float4 _RimColor;
// float _RimWidth;
// v2f vert (appdata v)
// {
// v2f o;
// v.vertex.xyz+=v.normal.xyz*_BottleWidth;
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
// UNITY_TRANSFER_FOG(o,o.vertex);
// o.normal=v.normal.xyz;
// o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
// return o;
// }
// fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
// {
// // sample the texture
// fixed4 col = _BottleColor;
// // apply fog
// UNITY_APPLY_FOG(i.fogCoord, col);
// float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);//1-pow(dot(i.normal, i.viewDir),_RimWidth/10);
// float4 rimCol=_RimColor*smoothstep(0.2,1,dotProduct);
// return rimCol;
// }
// ENDCG
// }
}
}
\ No newline at end of file
Shader "Unityunity/LiquidBottle"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainColor("MainColor",Color) = (1, 1, 1, 1)
_TopColor("TopColor",Color) = (1, 1, 0, 1)
_FillAmount("FillAmout",Range(-2 ,2)) = 0
_EdgeWidth("EdgeWidth",Range(0 , 1)) = 0.2
_BottleWidth("BottleWidth",Range(0,1)) = 0.2
_BottleColor("BottleColor",Color) = (1,1,1,1)
_RimColor("RimColor",Color)=(1,1,1,1)
_RimWidth("RimWidth",float)=0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
Cull OFF
AlphaToMask on
//ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float fillEdge : TEXCOORD1;
float3 viewDir : COLOR;
float3 normal : COLOR2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainColor;
float _FillAmount;
float4 _TopColor;
float _EdgeWidth;
float4 _RimColor;
float _RimWidth;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.fillEdge=mul(unity_ObjectToWorld,v.vertex.xyz).y+_FillAmount;
o.normal=v.normal;
o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _MainColor;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);
float4 rimCol=_RimColor*smoothstep(0.5,1,dotProduct);
fixed4 edgeVal=step(i.fillEdge,0.5)-step(i.fillEdge,0.5-_EdgeWidth);
fixed4 edgeCol=edgeVal *= _TopColor*0.9;
fixed4 finalVal=step(i.fillEdge,0.5)-edgeVal;
fixed4 finalCol=finalVal*col;
finalCol+=edgeCol+rimCol;
fixed4 topCol=_TopColor * (edgeVal+finalVal);
// float dotVal = 1- pow(dot(i.normal, i.viewDir),0.3);
// return float4(dotVal,dotVal,dotVal,1);
return facing > 0 ? finalCol : topCol;
}
ENDCG
}
// Pass
// {
// //Cull Front
// Blend SrcAlpha OneMinusSrcAlpha
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// // make fog work
// #pragma multi_compile_fog
// #include "UnityCG.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float2 uv : TEXCOORD0;
// float4 normal : NORMAL;
// };
// struct v2f
// {
// float2 uv : TEXCOORD0;
// UNITY_FOG_COORDS(1)
// float4 vertex : SV_POSITION;
// float3 viewDir : COLOR;
// float3 normal :NORMAL;
// };
// float4 _BottleColor;
// float _BottleWidth;
// float4 _RimColor;
// float _RimWidth;
// v2f vert (appdata v)
// {
// v2f o;
// v.vertex.xyz+=v.normal.xyz*_BottleWidth;
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
// UNITY_TRANSFER_FOG(o,o.vertex);
// o.normal=v.normal.xyz;
// o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
// return o;
// }
// fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
// {
// // sample the texture
// fixed4 col = _BottleColor;
// // apply fog
// UNITY_APPLY_FOG(i.fogCoord, col);
// float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);//1-pow(dot(i.normal, i.viewDir),_RimWidth/10);
// float4 rimCol=_RimColor*smoothstep(0.2,1,dotProduct);
// return rimCol;
// }
// ENDCG
// }
}
}
\ No newline at end of file
Shader "Unityunity/LiquidBottles"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainColor("MainColor",Color) = (1, 1, 1, 1)
_TopColor("TopColor",Color) = (1, 1, 0, 1)
_FillAmount("FillAmout",Range(-2 ,2)) = 0
_EdgeWidth("EdgeWidth",Range(0 , 1)) = 0.2
_BottleWidth("BottleWidth",Range(0,1)) = 0.2
_BottleColor("BottleColor",Color) = (1,1,1,1)
_RimColor("RimColor",Color)=(1,1,1,1)
_RimWidth("RimWidth",float)=0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
Cull OFF
AlphaToMask on
//ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float fillEdge : TEXCOORD1;
float3 viewDir : COLOR;
float3 normal : COLOR2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainColor;
float _FillAmount;
float4 _TopColor;
float _EdgeWidth;
float4 _RimColor;
float _RimWidth;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.fillEdge=mul(unity_ObjectToWorld,v.vertex.xyz).y+_FillAmount;
o.normal=v.normal;
o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _MainColor;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);
float4 rimCol=_RimColor*smoothstep(0.5,1,dotProduct);
fixed4 edgeVal=step(i.fillEdge,0.5)-step(i.fillEdge,0.5-_EdgeWidth);
fixed4 edgeCol=edgeVal *= _TopColor*0.9;
fixed4 finalVal=step(i.fillEdge,0.5)-edgeVal;
fixed4 finalCol=finalVal*col;
finalCol+=edgeCol+rimCol;
fixed4 topCol=_TopColor * (edgeVal+finalVal);
// float dotVal = 1- pow(dot(i.normal, i.viewDir),0.3);
// return float4(dotVal,dotVal,dotVal,1);
return facing > 0 ? finalCol : topCol;
}
ENDCG
}
// Pass
// {
// //Cull Front
// Blend SrcAlpha OneMinusSrcAlpha
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// // make fog work
// #pragma multi_compile_fog
// #include "UnityCG.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float2 uv : TEXCOORD0;
// float4 normal : NORMAL;
// };
// struct v2f
// {
// float2 uv : TEXCOORD0;
// UNITY_FOG_COORDS(1)
// float4 vertex : SV_POSITION;
// float3 viewDir : COLOR;
// float3 normal :NORMAL;
// };
// float4 _BottleColor;
// float _BottleWidth;
// float4 _RimColor;
// float _RimWidth;
// v2f vert (appdata v)
// {
// v2f o;
// v.vertex.xyz+=v.normal.xyz*_BottleWidth;
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
// UNITY_TRANSFER_FOG(o,o.vertex);
// o.normal=v.normal.xyz;
// o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
// return o;
// }
// fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
// {
// // sample the texture
// fixed4 col = _BottleColor;
// // apply fog
// UNITY_APPLY_FOG(i.fogCoord, col);
// float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);//1-pow(dot(i.normal, i.viewDir),_RimWidth/10);
// float4 rimCol=_RimColor*smoothstep(0.2,1,dotProduct);
// return rimCol;
// }
// ENDCG
// }
}
}
\ No newline at end of file
Shader "Unlit/LiquidBottles"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MainColor("MainColor",Color) = (1, 1, 1, 1)
_TopColor("TopColor",Color) = (1, 1, 0, 1)
_FillAmount("FillAmout",Range(-2 ,2)) = 0
_EdgeWidth("EdgeWidth",Range(0 , 1)) = 0.2
_BottleWidth("BottleWidth",Range(0,1)) = 0.2
_BottleColor("BottleColor",Color) = (1,1,1,1)
_RimColor("RimColor",Color)=(1,1,1,1)
_RimWidth("RimWidth",float)=0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
Cull OFF
AlphaToMask on
//ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float fillEdge : TEXCOORD1;
float3 viewDir : COLOR;
float3 normal : COLOR2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainColor;
float _FillAmount;
float4 _TopColor;
float _EdgeWidth;
float4 _RimColor;
float _RimWidth;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.fillEdge=mul(unity_ObjectToWorld,v.vertex.xyz).y+_FillAmount;
o.normal=v.normal;
o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _MainColor;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);
float4 rimCol=_RimColor*smoothstep(0.5,1,dotProduct);
fixed4 edgeVal=step(i.fillEdge,0.5)-step(i.fillEdge,0.5-_EdgeWidth);
fixed4 edgeCol=edgeVal *= _TopColor*0.9;
fixed4 finalVal=step(i.fillEdge,0.5)-edgeVal;
fixed4 finalCol=finalVal*col;
finalCol+=edgeCol+rimCol;
fixed4 topCol=_TopColor * (edgeVal+finalVal);
// float dotVal = 1- pow(dot(i.normal, i.viewDir),0.3);
// return float4(dotVal,dotVal,dotVal,1);
return facing > 0 ? finalCol : topCol;
}
ENDCG
}
// Pass
// {
// //Cull Front
// Blend SrcAlpha OneMinusSrcAlpha
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// // make fog work
// #pragma multi_compile_fog
// #include "UnityCG.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float2 uv : TEXCOORD0;
// float4 normal : NORMAL;
// };
// struct v2f
// {
// float2 uv : TEXCOORD0;
// UNITY_FOG_COORDS(1)
// float4 vertex : SV_POSITION;
// float3 viewDir : COLOR;
// float3 normal :NORMAL;
// };
// float4 _BottleColor;
// float _BottleWidth;
// float4 _RimColor;
// float _RimWidth;
// v2f vert (appdata v)
// {
// v2f o;
// v.vertex.xyz+=v.normal.xyz*_BottleWidth;
// o.vertex = UnityObjectToClipPos(v.vertex);
// o.uv = v.uv;
// UNITY_TRANSFER_FOG(o,o.vertex);
// o.normal=v.normal.xyz;
// o.viewDir=normalize(ObjSpaceViewDir(v.vertex));
// return o;
// }
// fixed4 frag (v2f i,fixed facing : VFace) : SV_Target
// {
// // sample the texture
// fixed4 col = _BottleColor;
// // apply fog
// UNITY_APPLY_FOG(i.fogCoord, col);
// float dotProduct = 1-pow(dot(i.normal, i.viewDir),_RimWidth);//1-pow(dot(i.normal, i.viewDir),_RimWidth/10);
// float4 rimCol=_RimColor*smoothstep(0.2,1,dotProduct);
// return rimCol;
// }
// ENDCG
// }
}
}
\ No newline at end of file
Shader "Unlit/LiquidShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
//液体部分
_Height("h",float)=0.5
_SectionColor ("Section Color", Color) = (1,1,1,0)
_WaterColor ("Water Color", Color) = (1,1,1,0)
_FoamColor("FoamColor", Color) = (1,1,1,0)
_LiquidHeight("LiquidHeight",float) = 0.1
_LiquidRimColor ("Liquid Rim Color",Color) = (1,1,1,1)
_LiquidRimRange ("Liquid Rim Range", float) = 0.1
_LiquidCameraOffset ("Liquid CameraOffset", Vector) = (0.2, 0,0,0)
_LiquidRimScale ("Liquid RimScale", float) = 0.2
//玻璃部分
_Color("Glass Color",Color) = (0.6,0.6,0.6,1)
_AlphaRange("Alpha Range",Range(-1,1)) = 0
_RimColor("Rim Color",Color) = (1,1,1,1)
_RimRange("Rim Range", float) = 0.1
_Raduis("Raduis", float) = 0.1
_CameraOffset("CameraOffset", Vector) = (0.2, 0,0,0)
_ForceDir("ForceDir", Vector) = (0,0,0,0)
_WaveHeight("WaveHeight", float) = 1
}
SubShader
{
Pass
{
Tags { "RenderType"="Opaque" }
LOD 100
cull off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal:NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float3 worldPos:TEXCOORD2;
float3 viewDir:TEXCOORD3;
float3 worldNormal:TEXCOORD4;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Height;
float _LiquidHeight;
float4 _SectionColor;
float4 _WaterColor;
float4 _FoamColor;
float4 _ForceDir;
float _WaveHeight;
float4 _LiquidRimColor;
float _LiquidRimRange;
float4 _LiquidCameraOffset;
float _LiquidRimScale;
float _TargetHeight;
float GetWaveHeight(float3 worldPos){
float3 disVector = float3(worldPos.x, _Height, worldPos.z) - float3(0, _Height, 0);
float dis = length(disVector);
float d = dot(disVector, _ForceDir.xyz);
return _Height + dis * d * 0.01 * _WaveHeight;
}
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.worldPos=mul((float3x3)unity_ObjectToWorld,v.vertex);
o.viewDir=WorldSpaceViewDir(v.vertex);
o.worldNormal=UnityObjectToWorldNormal(v.normal);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col;
_TargetHeight = GetWaveHeight(i.worldPos);
if(i.worldPos.y - _TargetHeight > 0.001)
{
discard;
}
float fd = dot( i.viewDir, i.worldNormal);
if (fd.x < 0)
{
col = _SectionColor;
return col;
}
else if(i.worldPos.y > (_TargetHeight - _LiquidHeight)){
col.rgb = _FoamColor;
return col;
}
float3 normal = normalize(i.worldNormal);
float3 viewDir = normalize(_WorldSpaceCameraPos.xyz - i.worldPos.xyz);
float NdotV = saturate(dot(normal,viewDir + _LiquidCameraOffset.xyz));
float alpha = _LiquidRimScale * pow(1 - NdotV, _LiquidRimRange);
fixed3 rim = smoothstep(float3(0,0,0), _LiquidRimColor, alpha);// _LiquidRimColor * alpha;
col.rgb =_WaterColor + rim;
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
Pass
{
Tags{"RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
Cull back
Blend SrcAlpha OneMinusSrcAlpha
ZWrite OFF
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal:NORMAL;
};
struct v2f
{
float3 normalDir:TEXCOORD0;
float4 vertex : SV_POSITION;
float3 worldPos : TEXCOORD1;
};
fixed4 _Color;
float _AlphaRange;
fixed4 _RimColor;
float _RimRange;
float _Raduis;
float4 _CameraOffset;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
float3 vnormal = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = TransformViewToProjection(vnormal.xy);
o.vertex.xy += offset * _Raduis;//在视图空间便宜不会出现近大远小
o.normalDir = normalize(mul((float3x3)unity_ObjectToWorld, v.normal));
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float3 normal = normalize(i.normalDir);
float3 viewDir = normalize(_WorldSpaceCameraPos.xyz - i.worldPos.xyz);
float NdotV = saturate(dot(normal,viewDir + _CameraOffset.xyz));//视线方向做了偏移,调整fresnel效果,使效果更风格化
fixed3 diffuse = NdotV *_Color;
float alpha = pow(1 - NdotV, _RimRange);
fixed3 rim = _RimColor * alpha;//smoothstep(float3(0,0,0), _RimColor, alpha);
return fixed4(diffuse + rim ,alpha * _AlphaRange);
}
ENDCG
}
}
}
Shader "Unlit/LiquidShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
//液体部分
_Height("h",float)=0.5
_SectionColor ("Section Color", Color) = (1,1,1,0)
_WaterColor ("Water Color", Color) = (1,1,1,0)
_FoamColor("FoamColor", Color) = (1,1,1,0)
_LiquidHeight("LiquidHeight",float) = 0.1
_LiquidRimColor ("Liquid Rim Color",Color) = (1,1,1,1)
_LiquidRimRange ("Liquid Rim Range", float) = 0.1
_LiquidCameraOffset ("Liquid CameraOffset", Vector) = (0.2, 0,0,0)
_LiquidRimScale ("Liquid RimScale", float) = 0.2
//玻璃部分
// _Color("Glass Color",Color) = (0.6,0.6,0.6,1)
// _AlphaRange("Alpha Range",Range(-1,1)) = 0
// _RimColor("Rim Color",Color) = (1,1,1,1)
// _RimRange("Rim Range", float) = 0.1
// _Raduis("Raduis", float) = 0.1
// _CameraOffset("CameraOffset", Vector) = (0.2, 0,0,0)
// _ForceDir("ForceDir", Vector) = (0,0,0,0)
// _WaveHeight("WaveHeight", float) = 1
}
SubShader
{
Pass
{
Tags { "RenderType"="Opaque" }
LOD 100
cull off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal:NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float3 worldPos:TEXCOORD2;
float3 viewDir:TEXCOORD3;
float3 worldNormal:TEXCOORD4;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _Height;
float _LiquidHeight;
float4 _SectionColor;
float4 _WaterColor;
float4 _FoamColor;
float4 _ForceDir;
float _WaveHeight;
float4 _LiquidRimColor;
float _LiquidRimRange;
float4 _LiquidCameraOffset;
float _LiquidRimScale;
float _TargetHeight;
float GetWaveHeight(float3 worldPos){
float3 disVector = float3(worldPos.x, _Height, worldPos.z) - float3(0, _Height, 0);
float dis = length(disVector);
float d = dot(disVector, _ForceDir.xyz);
return _Height + dis * d * 0.01 * _WaveHeight;
}
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.worldPos=mul((float3x3)unity_ObjectToWorld,v.vertex);
o.viewDir=WorldSpaceViewDir(v.vertex);
o.worldNormal=UnityObjectToWorldNormal(v.normal);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col;
_TargetHeight = GetWaveHeight(i.worldPos);
if(i.worldPos.y - _TargetHeight > 0.001)
{
discard;
}
float fd = dot( i.viewDir, i.worldNormal);
if (fd.x < 0)
{
col = _SectionColor;
return col;
}
else if(i.worldPos.y > (_TargetHeight - _LiquidHeight)){
col.rgb = _FoamColor;
return col;
}
float3 normal = normalize(i.worldNormal);
float3 viewDir = normalize(_WorldSpaceCameraPos.xyz - i.worldPos.xyz);
float NdotV = saturate(dot(normal,viewDir + _LiquidCameraOffset.xyz));
float alpha = _LiquidRimScale * pow(1 - NdotV, _LiquidRimRange);
fixed3 rim = smoothstep(float3(0,0,0), _LiquidRimColor, alpha);// _LiquidRimColor * alpha;
col.rgb =_WaterColor + rim;
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
// Pass
// {
// Tags{"RenderType"="Transparent" "Queue"="Transparent" }
// LOD 100
// Cull back
// Blend SrcAlpha OneMinusSrcAlpha
// ZWrite OFF
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// // make fog work
// #pragma multi_compile_fog
// #include "UnityCG.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal:NORMAL;
// };
// struct v2f
// {
// float3 normalDir:TEXCOORD0;
// float4 vertex : SV_POSITION;
// float3 worldPos : TEXCOORD1;
// };
// fixed4 _Color;
// float _AlphaRange;
// fixed4 _RimColor;
// float _RimRange;
// float _Raduis;
// float4 _CameraOffset;
// v2f vert (appdata v)
// {
// v2f o;
// o.vertex = UnityObjectToClipPos(v.vertex);
// float3 vnormal = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
// float2 offset = TransformViewToProjection(vnormal.xy);
// o.vertex.xy += offset * _Raduis;//在视图空间便宜不会出现近大远小
// o.normalDir = normalize(mul((float3x3)unity_ObjectToWorld, v.normal));
// return o;
// }
// fixed4 frag (v2f i) : SV_Target
// {
// float3 normal = normalize(i.normalDir);
// float3 viewDir = normalize(_WorldSpaceCameraPos.xyz - i.worldPos.xyz);
// float NdotV = saturate(dot(normal,viewDir + _CameraOffset.xyz));//视线方向做了偏移,调整fresnel效果,使效果更风格化
// fixed3 diffuse = NdotV *_Color;
// float alpha = pow(1 - NdotV, _RimRange);
// fixed3 rim = _RimColor * alpha;//smoothstep(float3(0,0,0), _RimColor, alpha);
// return fixed4(diffuse + rim ,alpha * _AlphaRange);
// }
// ENDCG
// }
}
}
Shader "Ly/Liquid"
{
Properties
{
_Tint("Tint", Color) = (1,1,1,1)
_MainTex("Texture", 2D) = "white" {}
_FillAmount("Fill Amount", Range(-10,10)) = 0.0
[HideInInspector] _WobbleX("WobbleX", Range(-1,1)) = 0.0
[HideInInspector] _WobbleZ("WobbleZ", Range(-1,1)) = 0.0
_TopColor("Top Color", Color) = (1,1,1,1)
_FoamColor("Foam Line Color", Color) = (1,1,1,1)
_Rim("Foam Line Width", Range(0,0.1)) = 0.0
_RimColor("Rim Color", Color) = (1,1,1,1)
_RimPower("Rim Power", Range(0,10)) = 0.0
_ThickCol("ThickCol", Color) = (1,0,0,1)
_ThickFactor("ThickFactor", Range(0,1)) = 0.1
_EdgePower("Edge Power", Range(0,1)) = 0.0
_EdgeRimColor("EdgeRimColor", Color) = (1, 1, 1, 1)
_EdgeRimIntensity("Edge Power", Range(0,1)) = 0.0
}
SubShader
{
Tags{ "Queue" = "Geometry" }
Pass
{
Cull off // 双面渲染
AlphaToMask On // 设置透明度
CGPROGRAM
#include "UnityCG.cginc"
float4 _ThickCol;
float _ThickFactor;
float _EdgePower;
float _EdgeRimIntensity;
float4 _EdgeRimColor;
struct v2f
{
float4 pos : SV_POSITION;
float3 normal : COLOR0;
float3 viewDir : COLOR1;
};
v2f vert(appdata_full v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
float3 mvnormal = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 thickness = TransformViewToProjection(mvnormal.xy);
o.pos.xy += thickness * _ThickFactor;
o.normal = v.normal;
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag(v2f i) : SV_Target
{
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _EdgePower);
float4 RimResult = smoothstep(0.5, 1.0, dotProduct) * _EdgeRimColor * _EdgeRimIntensity;
float col = _ThickCol + RimResult;
return col;
}
//使用vert函数和frag函数
#pragma vertex vert
#pragma fragment frag
ENDCG
}
Pass
{
Zwrite On
Cull Off
AlphaToMask On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float3 viewDir : COLOR;
float3 normal : COLOR2;
float fillEdge : TEXCOORD2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _FillAmount, _WobbleX, _WobbleZ;
float4 _TopColor, _RimColor, _FoamColor, _Tint;
float _Rim, _RimPower;
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz , mul(m, vertex.xz)).xzyw;
}
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
// get world position of the vertex
float3 worldPos = mul(unity_ObjectToWorld, v.vertex.xyz);
// rotate it around XY
float3 worldPosX = RotateAroundYInDegrees(float4(worldPos,0),360);
// rotate around XZ
float3 worldPosZ = float3 (worldPosX.y, worldPosX.z, worldPosX.x);
// combine rotations with worldPos, based on sine wave from script
float3 worldPosAdjusted = worldPos + (worldPosX * _WobbleX) + (worldPosZ* _WobbleZ);
// how high up the liquid is
o.fillEdge = worldPosAdjusted.y + _FillAmount;
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _Tint;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
// rim light
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _RimPower);
float4 RimResult = smoothstep(0.5, 1.0, dotProduct);
RimResult *= _RimColor;
// foam edge
float4 foam = (step(i.fillEdge, 0.5) - step(i.fillEdge, (0.5 - _Rim)));
float4 foamColored = foam * (_FoamColor * 0.9);
// rest of the liquid
float4 result = step(i.fillEdge, 0.5) - foam;
float4 resultColored = result * col;
// both together, with the texture
float4 finalResult = resultColored + foamColored;
finalResult.rgb += RimResult;
// color of backfaces/ top
float4 topColor = _TopColor * (foam + result);
//VFACE returns positive for front facing, negative for backfacing
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
}
}
\ No newline at end of file
Shader "Unlit/Liquid"
{
Properties
{
_Tint("Tint", Color) = (1,1,1,1)
_MainTex("Texture", 2D) = "white" {}
_FillAmount("Fill Amount", Range(-10,10)) = 0.0
[HideInInspector] _WobbleX("WobbleX", Range(-1,1)) = 0.0
[HideInInspector] _WobbleZ("WobbleZ", Range(-1,1)) = 0.0
_TopColor("Top Color", Color) = (1,1,1,1)
_FoamColor("Foam Line Color", Color) = (1,1,1,1)
_Rim("Foam Line Width", Range(0,0.1)) = 0.0
_RimColor("Rim Color", Color) = (1,1,1,1)
_RimPower("Rim Power", Range(0,10)) = 0.0
_ThickCol("ThickCol", Color) = (1,0,0,1)
_ThickFactor("ThickFactor", Range(0,1)) = 0.1
_EdgePower("Edge Power", Range(0,1)) = 0.0
_EdgeRimColor("EdgeRimColor", Color) = (1, 1, 1, 1)
_EdgeRimIntensity("Edge Power", Range(0,1)) = 0.0
}
SubShader
{
Tags{ "Queue" = "Geometry" }
Pass
{
Cull off // 双面渲染
AlphaToMask On // 设置透明度
CGPROGRAM
#include "UnityCG.cginc"
float4 _ThickCol;
float _ThickFactor;
float _EdgePower;
float _EdgeRimIntensity;
float4 _EdgeRimColor;
struct v2f
{
float4 pos : SV_POSITION;
float3 normal : COLOR0;
float3 viewDir : COLOR1;
};
v2f vert(appdata_full v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
float3 mvnormal = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 thickness = TransformViewToProjection(mvnormal.xy);
o.pos.xy += thickness * _ThickFactor;
o.normal = v.normal;
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag(v2f i) : SV_Target
{
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _EdgePower);
float4 RimResult = smoothstep(0.5, 1.0, dotProduct) * _EdgeRimColor * _EdgeRimIntensity;
float col = _ThickCol + RimResult;
return col;
}
//使用vert函数和frag函数
#pragma vertex vert
#pragma fragment frag
ENDCG
}
Pass
{
Zwrite On
Cull Off
AlphaToMask On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float3 viewDir : COLOR;
float3 normal : COLOR2;
float fillEdge : TEXCOORD2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _FillAmount, _WobbleX, _WobbleZ;
float4 _TopColor, _RimColor, _FoamColor, _Tint;
float _Rim, _RimPower;
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz , mul(m, vertex.xz)).xzyw;
}
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
// get world position of the vertex
float3 worldPos = mul(unity_ObjectToWorld, v.vertex.xyz);
// rotate it around XY
float3 worldPosX = RotateAroundYInDegrees(float4(worldPos,0),360);
// rotate around XZ
float3 worldPosZ = float3 (worldPosX.y, worldPosX.z, worldPosX.x);
// combine rotations with worldPos, based on sine wave from script
float3 worldPosAdjusted = worldPos + (worldPosX * _WobbleX) + (worldPosZ* _WobbleZ);
// how high up the liquid is
o.fillEdge = worldPosAdjusted.y + _FillAmount;
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _Tint;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
// rim light
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _RimPower);
float4 RimResult = smoothstep(0.5, 1.0, dotProduct);
RimResult *= _RimColor;
// foam edge
float4 foam = (step(i.fillEdge, 0.5) - step(i.fillEdge, (0.5 - _Rim)));
float4 foamColored = foam * (_FoamColor * 0.9);
// rest of the liquid
float4 result = step(i.fillEdge, 0.5) - foam;
float4 resultColored = result * col;
// both together, with the texture
float4 finalResult = resultColored + foamColored;
finalResult.rgb += RimResult;
// color of backfaces/ top
float4 topColor = _TopColor * (foam + result);
//VFACE returns positive for front facing, negative for backfacing
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
}
}
\ No newline at end of file
Shader "Unlit/Liquid"
{
Properties
{
_Tint("Tint", Color) = (1,1,1,1)
_MainTex("Texture", 2D) = "white" {}
_FillAmount("Fill Amount", Range(-10,10)) = 0.0
[HideInInspector] _WobbleX("WobbleX", Range(-1,1)) = 0.0
[HideInInspector] _WobbleZ("WobbleZ", Range(-1,1)) = 0.0
_TopColor("Top Color", Color) = (1,1,1,1)
_FoamColor("Foam Line Color", Color) = (1,1,1,1)
_Rim("Foam Line Width", Range(0,0.1)) = 0.0
_RimColor("Rim Color", Color) = (1,1,1,1)
_RimPower("Rim Power", Range(0,10)) = 0.0
_ThickCol("ThickCol", Color) = (1,0,0,1)
_ThickFactor("ThickFactor", Range(0,1)) = 0.1
_EdgePower("Edge Power", Range(0,1)) = 0.0
_EdgeRimColor("EdgeRimColor", Color) = (1, 1, 1, 1)
_EdgeRimIntensity("Edge Power", Range(0,1)) = 0.0
}
SubShader
{
Tags{ "Queue" = "Geometry" }
Pass
{
Cull off // 双面渲染
AlphaToMask On // 设置透明度
CGPROGRAM
#include "UnityCG.cginc"
float4 _ThickCol;
float _ThickFactor;
float _EdgePower;
float _EdgeRimIntensity;
float4 _EdgeRimColor;
struct v2f
{
float4 pos : SV_POSITION;
float3 normal : COLOR0;
float3 viewDir : COLOR1;
};
v2f vert(appdata_full v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
float3 mvnormal = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 thickness = TransformViewToProjection(mvnormal.xy);
o.pos.xy += thickness * _ThickFactor;
o.normal = v.normal;
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
return o;
}
fixed4 frag(v2f i) : SV_Target
{
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _EdgePower);
float4 RimResult = smoothstep(0.5, 1.0, dotProduct) * _EdgeRimColor * _EdgeRimIntensity;
float col = _ThickCol + RimResult;
return col;
}
//使用vert函数和frag函数
#pragma vertex vert
#pragma fragment frag
ENDCG
}
Pass
{
Zwrite On
Cull Off
AlphaToMask On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
float3 viewDir : COLOR;
float3 normal : COLOR2;
float fillEdge : TEXCOORD2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _FillAmount, _WobbleX, _WobbleZ;
float4 _TopColor, _RimColor, _FoamColor, _Tint;
float _Rim, _RimPower;
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz , mul(m, vertex.xz)).xzyw;
}
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
// get world position of the vertex
float3 worldPos = mul(unity_ObjectToWorld, v.vertex.xyz);
// rotate it around XY
float3 worldPosX = RotateAroundYInDegrees(float4(worldPos,0),360);
// rotate around XZ
float3 worldPosZ = float3 (worldPosX.y, worldPosX.z, worldPosX.x);
// combine rotations with worldPos, based on sine wave from script
float3 worldPosAdjusted = worldPos + (worldPosX * _WobbleX) + (worldPosZ* _WobbleZ);
// how high up the liquid is
o.fillEdge = worldPosAdjusted.y + _FillAmount;
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * _Tint;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
// rim light
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _RimPower);
float4 RimResult = smoothstep(0.5, 1.0, dotProduct);
RimResult *= _RimColor;
// foam edge
float4 foam = (step(i.fillEdge, 0.5) - step(i.fillEdge, (0.5 - _Rim)));
float4 foamColored = foam * (_FoamColor * 0.9);
// rest of the liquid
float4 result = step(i.fillEdge, 0.5) - foam;
float4 resultColored = result * col;
// both together, with the texture
float4 finalResult = resultColored + foamColored;
finalResult.rgb += RimResult;
// color of backfaces/ top
float4 topColor = _TopColor * (foam + result);
//VFACE returns positive for front facing, negative for backfacing
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
}
}
\ No newline at end of file
Shader "Custom/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.1, 0.9)) = 0.0
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.05)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.1, 0.9)) = 0.0
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.05)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.1, 1.6)) = 0.0
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.05)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.4, 1.6)) = 0.4
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.05)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0, 2)) = 0
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.05)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.4, 1.6)) = 0.4
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.05)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.4, 1.6)) = 0.4
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.1)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.4, 1.6)) = 0.4
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.2)) = 0.0
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
Shader "Unlit/WS_LiquidBottle"
{
Properties
{
_LiquidColor("Liquid Color", Color) = (1, 1, 1, 1)
_FillAmount("Fill Amount", Range(0.4, 1.6)) = 0.4
[HideInInspector] _WobbleX("Wobble X", Range(-1, 1)) = 0.0
[HideInInspector] _WobbleZ("Wobble Z", Range(-1, 1)) = 0.0
_LiquidTopColor("Liquid Top Color", Color) = (1, 1, 1, 1)
_LiquidFoamColor("Liquid Foam Color", Color) = (1, 1, 1, 1)
_FoamLineWidth("Foam Line Width", Range(0, 0.2)) = 0.1
_LiquidRimColor("Liquid Rim Color", Color) = (1, 1, 1, 1)
_LiquidRimPower("Liquid Rim Power", Range(0, 10)) = 0.0
_LiquidRimIntensity("Liquid Rim Intensity", Range(0, 3)) = 1.0
//Bottle
_BottleThickness("Bottle Thickness", Range(0.01, 0.3)) = 0.01
_BottleSpecularGloss("Bottle Specular Gloss", Range(1, 100)) = 0.0
_BottleColor("Bottle Color", Color) = (1, 1, 1, 1)
_BottleSpecularColor("Bottle Specular Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" "DisableBatching"="True"}
//第一个pass用于渲染液体
Pass
{
//Tags{"RenderType"="Opaque" "Queue"="Geometry"}
AlphaToMask On
//ZWrite On
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 position : SV_POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float fillEdge : TEXCOORD2;
};
//返回的float中x是vertex.y, y是旋转后的x,z是旋转前的z,w是旋转后的z
float4 RotateAroundYInDegrees(float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, sina, -sina, cosa);
return float4(vertex.yz,mul(m, vertex.xz)).xzyw;
}
float _FillAmount, _WobbleX, _WobbleZ;
float4 _LiquidRimColor, _LiquidFoamColor, _LiquidTopColor, _LiquidColor;
float _LiquidRimPower, _LiquidRimIntensity, _FoamLineWidth;
v2f vert(appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.position = UnityObjectToClipPos(v.vertex);
//未加入旋转y轴,所以先定死360,即不旋转
float4 rotatedPos = RotateAroundYInDegrees(v.vertex, 360);
//posX和posZ用于决定液体高度,因为胶囊体的网格是对称的,所以能够呈现成一边水面上升,一边水面下降
float posX = rotatedPos.y;
float posZ = rotatedPos.w;
//顶点高度 - 最高可显示液体高度,大于0表示超出可显示高度,小于等于0表示可显示液体
o.fillEdge = (v.vertex.y / 2 + 0.5) - ((posX * _WobbleX) + (posZ * _WobbleZ) + _FillAmount);
//视线向量和法线向量都用模型空间的
o.viewDir = normalize(ObjSpaceViewDir(v.vertex));
o.normal = v.normal;
return o;
}
fixed4 frag(v2f i, fixed facing : VFACE) : SV_Target
{
//边缘光
float dotProduct = 1 - pow(dot(i.normal, i.viewDir), _LiquidRimPower);
float3 RimResult = _LiquidRimColor * smoothstep(0.5, 1.0, dotProduct) * _LiquidRimIntensity;
//泡沫
float foam = step(i.fillEdge, 0.0) - step(i.fillEdge, (0.0 - _FoamLineWidth));
float4 foamColor = foam * _LiquidFoamColor;
//液体颜色
//step(i.fillEdge, 0.0) - foam 表示如果显示了泡沫就不显示液体颜色了
float result = step(i.fillEdge, 0.0) - foam;
float4 resultColor = result * _LiquidColor;
//最后显示的颜色,如果液体颜色和泡沫颜色都没有,那最后的颜色值是(0,0,0,0),因为开了AlphaToMask On,所以alpha通道为0时,就不给像素着色了,就相当于是透明的了。
float4 finalResult = resultColor + foamColor;
finalResult.rgb += RimResult;
//水面,直接用背面来显示水面,正面用于显示液体
//(foam + result)表示在背面对应的正面有液体或者泡沫时才显示水面
float4 topColor = _LiquidTopColor * (foam + result);
return facing > 0 ? finalResult : topColor;
}
ENDCG
}
// //第二个pass用于渲染瓶子
// Pass
// {
// Blend SrcAlpha OneMinusSrcAlpha
// Cull Back
// CGPROGRAM
// #pragma vertex vert
// #pragma fragment frag
// #include "UnityCG.cginc"
// #include "Lighting.cginc"
// struct appdata
// {
// float4 vertex : POSITION;
// float3 normal : NORMAL;
// };
// struct v2f
// {
// float4 position : SV_POSITION;
// float3 worldViewDir : TEXCOORD0;
// float3 worldNormal : TEXCOORD1;
// float3 worldLightDir : TEXCOORD2;
// };
// float _BottleThickness, _BottleSpecularGloss, _BottleRimPower, _BottleRimIntensity;
// float4 _BottleSpecularColor, _BottleColor, _BottleRimColor;
// v2f vert(appdata v)
// {
// v2f o;
// UNITY_INITIALIZE_OUTPUT(v2f, o);
// v.vertex.xyz += _BottleThickness * v.normal;
// o.position = UnityObjectToClipPos(v.vertex);
// float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
// o.worldNormal = normalize(UnityObjectToWorldNormal(v.vertex));
// o.worldLightDir = normalize(UnityWorldSpaceLightDir(worldPos));
// o.worldViewDir = normalize(_WorldSpaceCameraPos.xyz - worldPos);
// return o;
// }
// fixed4 frag(v2f i) : SV_Target
// {
// //高光反射
// float3 halfDir = normalize(i.worldViewDir + i.worldLightDir);
// float3 specular = _LightColor0.rgb * _BottleSpecularColor.rgb * (pow(max(0, dot(halfDir, i.worldNormal)), _BottleSpecularGloss));
// fixed4 finalColor = _BottleColor + fixed4(specular.rgb, 0);
// return finalColor;
// }
// ENDCG
// }
}
}
...@@ -38,7 +38,7 @@ RenderSettings: ...@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.45130473, g: 0.5001914, b: 0.5690714, a: 1} m_IndirectSpecularColor: {r: 0.45130455, g: 0.5001912, b: 0.56907165, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &4 --- !u!157 &4
LightmapSettings: LightmapSettings:
...@@ -471,6 +471,71 @@ PrefabInstance: ...@@ -471,6 +471,71 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 767122296, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2122888657, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2122888657, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2122888657, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchoredPosition.x
value: 75
objectReference: {fileID: 0}
- target: {fileID: 2122888657, guid: 919382978f5e2684ba83e6daf6491458, type: 3}
propertyPath: m_AnchoredPosition.y
value: -75
objectReference: {fileID: 0}
- target: {fileID: 1028847026378544127, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1028847026378544127, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1028847026378544127, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 285
objectReference: {fileID: 0}
- target: {fileID: 1028847026378544127, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -85
objectReference: {fileID: 0}
- target: {fileID: 5033102133725279573, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5033102133725279573, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5033102133725279573, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 500
objectReference: {fileID: 0}
- target: {fileID: 5033102133725279573, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -80
objectReference: {fileID: 0}
- target: {fileID: 6064464676328073066, guid: 919382978f5e2684ba83e6daf6491458,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6064464677632144689, guid: 919382978f5e2684ba83e6daf6491458, - target: {fileID: 6064464677632144689, guid: 919382978f5e2684ba83e6daf6491458,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
......
This diff is collapsed.
fileFormatVersion: 2
guid: 2185bd17c604e1c479846af20b477152
labels:
- ObiFluid
timeCreated: 1487785607
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
...@@ -388,7 +388,7 @@ GameObject: ...@@ -388,7 +388,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &767122297 --- !u!224 &767122297
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -1201,7 +1201,7 @@ RectTransform: ...@@ -1201,7 +1201,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 75, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 150, y: 150} m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2122888659 --- !u!222 &2122888659
...@@ -2042,7 +2042,7 @@ RectTransform: ...@@ -2042,7 +2042,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 285, y: -85} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 170, y: 170} m_SizeDelta: {x: 170, y: 170}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1028847026378544125 --- !u!222 &1028847026378544125
...@@ -2743,6 +2743,8 @@ GameObject: ...@@ -2743,6 +2743,8 @@ GameObject:
- component: {fileID: 1273482193804146341} - component: {fileID: 1273482193804146341}
- component: {fileID: 8693128544138801966} - component: {fileID: 8693128544138801966}
- component: {fileID: 4568547535411243664} - component: {fileID: 4568547535411243664}
- component: {fileID: 1352795825}
- component: {fileID: 1352795824}
m_Layer: 5 m_Layer: 5
m_Name: Image m_Name: Image
m_TagString: Untagged m_TagString: Untagged
...@@ -2806,6 +2808,36 @@ MonoBehaviour: ...@@ -2806,6 +2808,36 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!114 &1352795825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2276373580177298909}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: 1}
m_UseGraphicAlpha: 1
--- !u!114 &1352795824
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2276373580177298909}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 2, y: -2}
m_UseGraphicAlpha: 1
--- !u!1 &2347244091006803277 --- !u!1 &2347244091006803277
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -10407,6 +10439,8 @@ GameObject: ...@@ -10407,6 +10439,8 @@ GameObject:
- component: {fileID: 9213853710415438453} - component: {fileID: 9213853710415438453}
- component: {fileID: 4374027026374214703} - component: {fileID: 4374027026374214703}
- component: {fileID: 7410630539327239699} - component: {fileID: 7410630539327239699}
- component: {fileID: 606965843}
- component: {fileID: 606965842}
m_Layer: 5 m_Layer: 5
m_Name: Image m_Name: Image
m_TagString: Untagged m_TagString: Untagged
...@@ -10470,6 +10504,36 @@ MonoBehaviour: ...@@ -10470,6 +10504,36 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!114 &606965843
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5562945445041803326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: 1}
m_UseGraphicAlpha: 1
--- !u!114 &606965842
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5562945445041803326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 2, y: -2}
m_UseGraphicAlpha: 1
--- !u!1 &5579890993387218574 --- !u!1 &5579890993387218574
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -10974,7 +11038,7 @@ RectTransform: ...@@ -10974,7 +11038,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 500, y: -80} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 160} m_SizeDelta: {x: 160, y: 160}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &9065902244082100770 --- !u!222 &9065902244082100770
...@@ -11109,7 +11173,7 @@ GameObject: ...@@ -11109,7 +11173,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &6064464676328073067 --- !u!224 &6064464676328073067
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -14845,6 +14909,8 @@ GameObject: ...@@ -14845,6 +14909,8 @@ GameObject:
- component: {fileID: 4159856959460922000} - component: {fileID: 4159856959460922000}
- component: {fileID: 2192134537839265414} - component: {fileID: 2192134537839265414}
- component: {fileID: 337171890132233307} - component: {fileID: 337171890132233307}
- component: {fileID: 1937425472}
- component: {fileID: 1937425471}
m_Layer: 5 m_Layer: 5
m_Name: Image m_Name: Image
m_TagString: Untagged m_TagString: Untagged
...@@ -14908,6 +14974,36 @@ MonoBehaviour: ...@@ -14908,6 +14974,36 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!114 &1937425472
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7080706849099009272}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: 1}
m_UseGraphicAlpha: 1
--- !u!114 &1937425471
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7080706849099009272}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 2, y: -2}
m_UseGraphicAlpha: 1
--- !u!1 &7096287595787835688 --- !u!1 &7096287595787835688
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -25,9 +25,9 @@ Transform: ...@@ -25,9 +25,9 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3803887659397336397} m_GameObject: {fileID: 3803887659397336397}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2} m_LocalScale: {x: 0.13, y: 0.15, z: 0.13}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
......
...@@ -31,7 +31,7 @@ ModelImporter: ...@@ -31,7 +31,7 @@ ModelImporter:
extraExposedTransformPaths: [] extraExposedTransformPaths: []
extraUserProperties: [] extraUserProperties: []
clipAnimations: [] clipAnimations: []
isReadable: 0 isReadable: 1
meshes: meshes:
lODScreenPercentages: [] lODScreenPercentages: []
globalScale: 1 globalScale: 1
......
...@@ -8,7 +8,7 @@ AnimatorState: ...@@ -8,7 +8,7 @@ AnimatorState:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: juice_yellow m_Name: juice_yellow
m_Speed: 1 m_Speed: 0.3
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: [] m_Transitions: []
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
...@@ -138,7 +138,7 @@ AnimatorState: ...@@ -138,7 +138,7 @@ AnimatorState:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: juice_Orange m_Name: juice_Orange
m_Speed: 1 m_Speed: 0.3
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: [] m_Transitions: []
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
...@@ -208,7 +208,7 @@ AnimatorState: ...@@ -208,7 +208,7 @@ AnimatorState:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: juice_red m_Name: juice_red
m_Speed: 1 m_Speed: 0.3
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: [] m_Transitions: []
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
......
fileFormatVersion: 2
guid: c140a608d40d70a4880da4d97139f0e5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 02c68c4ce48118a45ac2a4d08c47bdc2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Lemon_juice0
m_Shader: {fileID: 4800000, guid: c7c2116a27c85f34a8d73ddbb9dace12, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BackTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b9642abbfe759e4b95858c7a46695bb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BackCut: 0
m_Colors:
- _BackColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _MainColor: {r: 1, g: 0.9386792, b: 0.9386792, a: 1}
fileFormatVersion: 2
guid: 81f3bc3c5ab3bd246996c66871355b7e
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Lemon_juice1
m_Shader: {fileID: 4800000, guid: 6bb6ee299aa625849b8c3e69e1ca3b85, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b9642abbfe759e4b95858c7a46695bb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaRange: -0.03
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Height: 0.5
- _LiquidHeight: 0.03
- _LiquidRimRange: 1.6
- _LiquidRimScale: 0.3
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Raduis: 0.08
- _RimRange: 0.08
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _WaveHeight: 1
- _ZWrite: 1
m_Colors:
- _CameraOffset: {r: 0.2, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 0.9858491, b: 0.50980395, a: 0}
- _ForceDir: {r: 0, g: 0, b: 0, a: 0}
- _LiquidCameraOffset: {r: 0.1, g: 0.1, b: 0.1, a: 0.1}
- _LiquidRimColor: {r: 1, g: 1, b: 1, a: 1}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _SectionColor: {r: 0.9686275, g: 0.8745099, b: 0.098039225, a: 0}
- _WaterColor: {r: 0.9568628, g: 0.8352942, b: 0.08235294, a: 0}
fileFormatVersion: 2
guid: 12d6fa75c9d97a44abfca1e447745da1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Lemon_juice2
m_Shader: {fileID: 4800000, guid: 2d1122fb84a48834eb8b51d34a4b228a, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b9642abbfe759e4b95858c7a46695bb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaRange: -0.03
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EdgePower: 0
- _EdgeRimIntensity: 0
- _FillAmount: -10
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Height: 1
- _LiquidHeight: 0.03
- _LiquidRimRange: 1.6
- _LiquidRimScale: 0.3
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Raduis: 0.08
- _Rim: 0
- _RimPower: 0
- _RimRange: 0.08
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _ThickFactor: 0
- _UVSec: 0
- _WaveHeight: 1
- _WobbleX: 0
- _WobbleZ: 0
- _ZWrite: 1
m_Colors:
- _CameraOffset: {r: 0.2, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EdgeRimColor: {r: 1, g: 1, b: 1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 0.9858491, b: 0.50980395, a: 0}
- _ForceDir: {r: 0, g: 0, b: 0, a: 0}
- _LiquidCameraOffset: {r: 0.1, g: 0.1, b: 0.1, a: 0.1}
- _LiquidRimColor: {r: 1, g: 1, b: 1, a: 1}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _SectionColor: {r: 0.9686275, g: 0.8745099, b: 0.098039225, a: 0}
- _ThickCol: {r: 0.96862745, g: 0.87058824, b: 0.09803922, a: 0}
- _Tint: {r: 1, g: 1, b: 1, a: 1}
- _TopColor: {r: 0.9686275, g: 0.8705883, b: 0.098039225, a: 1}
- _WaterColor: {r: 0.9568628, g: 0.8352942, b: 0.08235294, a: 0}
fileFormatVersion: 2
guid: 8f00d7182aa68ca4b9fe60ac75c1b134
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Lemon_juice3
m_Shader: {fileID: 4800000, guid: 3c6359e2d4953c94c994bf7792fb2121, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b9642abbfe759e4b95858c7a46695bb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaRange: -0.03
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DiscardFactor: 0.67
- _DstBlend: 0
- _EdgePower: 0
- _EdgeRimIntensity: 0
- _FillAmount: -10
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Height: 1
- _LightWidth: 0.05
- _LiquidHeight: 0.03
- _LiquidRimRange: 1.6
- _LiquidRimScale: 0.3
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Raduis: 0.08
- _Rim: 0
- _RimPower: 1
- _RimRange: 0.08
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _ThickFactor: 0
- _UVSec: 0
- _WaveHeight: 1
- _WobbleX: 0
- _WobbleZ: 0
- _ZWrite: 1
m_Colors:
- _CameraOffset: {r: 0.2, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EdgeRimColor: {r: 1, g: 1, b: 1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 0.9858491, b: 0.50980395, a: 0}
- _ForceDir: {r: 0, g: 0, b: 0, a: 0}
- _LightColor: {r: 1, g: 0.969554, b: 0.6650944, a: 1}
- _LiquidCameraOffset: {r: 0.1, g: 0.1, b: 0.1, a: 0.1}
- _LiquidRimColor: {r: 1, g: 1, b: 1, a: 1}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _SectionColor: {r: 0.9686275, g: 0.8745099, b: 0.098039225, a: 0}
- _ThickCol: {r: 0.96862745, g: 0.87058824, b: 0.09803922, a: 0}
- _Tint: {r: 1, g: 1, b: 1, a: 1}
- _TopColor: {r: 0.9686275, g: 0.8705883, b: 0.098039225, a: 1}
- _WaterColor: {r: 0.9568628, g: 0.8352942, b: 0.08235294, a: 0}
fileFormatVersion: 2
guid: 61fc65395637edc4fbda881aa26d6f08
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Lemon_juice4
m_Shader: {fileID: 4800000, guid: 1e1ed91248cd0c94fa706382299f8eb9, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b9642abbfe759e4b95858c7a46695bb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaRange: -0.03
- _BottleWidth: 0.05
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DiscardFactor: 0.67
- _DstBlend: 0
- _EdgePower: 0
- _EdgeRimIntensity: 0
- _EdgeWidth: 0.1
- _FillAmount: 0.51
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Height: 1
- _LightWidth: 0.05
- _LiquidHeight: 0.03
- _LiquidRimRange: 1.6
- _LiquidRimScale: 0.3
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Raduis: 0.08
- _Rim: 0
- _RimPower: 1
- _RimRange: 0.08
- _RimWidth: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _ThickFactor: 0
- _UVSec: 0
- _WaveHeight: 1
- _WobbleX: 0
- _WobbleZ: 0
- _ZWrite: 1
m_Colors:
- _BottleColor: {r: 1, g: 1, b: 1, a: 1}
- _CameraOffset: {r: 0.2, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EdgeRimColor: {r: 1, g: 1, b: 1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 0.9858491, b: 0.50980395, a: 0}
- _ForceDir: {r: 0, g: 0, b: 0, a: 0}
- _LightColor: {r: 1, g: 0.969554, b: 0.6650944, a: 1}
- _LiquidCameraOffset: {r: 0.1, g: 0.1, b: 0.1, a: 0.1}
- _LiquidRimColor: {r: 1, g: 1, b: 1, a: 1}
- _MainColor: {r: 1, g: 1, b: 1, a: 1}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _SectionColor: {r: 0.9686275, g: 0.8745099, b: 0.098039225, a: 0}
- _ThickCol: {r: 0.96862745, g: 0.87058824, b: 0.09803922, a: 0}
- _Tint: {r: 1, g: 1, b: 1, a: 1}
- _TopColor: {r: 0.9686275, g: 0.8705883, b: 0.098039225, a: 1}
- _WaterColor: {r: 0.9568628, g: 0.8352942, b: 0.08235294, a: 0}
fileFormatVersion: 2
guid: 53b4d4d573f00a24ab98ac01f6378f90
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Lemon_juice5
m_Shader: {fileID: 4800000, guid: 9f4e019adcf6fee41919f0667e6054c9, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1b9642abbfe759e4b95858c7a46695bb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaRange: -0.03
- _BottleSpecularGloss: 0
- _BottleThickness: 0.01
- _BottleWidth: 0.05
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DiscardFactor: 0.67
- _DstBlend: 0
- _EdgePower: 0
- _EdgeRimIntensity: 0
- _EdgeWidth: 0.1
- _FillAmount: 1.6
- _FoamLineWidth: 0.1
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Height: 1
- _LightWidth: 0.05
- _LiquidHeight: 0.03
- _LiquidRimIntensity: 0.1
- _LiquidRimPower: 2
- _LiquidRimRange: 1.6
- _LiquidRimScale: 0.3
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Raduis: 0.08
- _Rim: 0
- _RimPower: 1
- _RimRange: 0.08
- _RimWidth: 0
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _ThickFactor: 0
- _UVSec: 0
- _WaveHeight: 1
- _WobbleX: 0
- _WobbleZ: 0
- _ZWrite: 1
m_Colors:
- _BottleColor: {r: 1, g: 1, b: 1, a: 1}
- _BottleSpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _CameraOffset: {r: 0.2, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EdgeRimColor: {r: 1, g: 1, b: 1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FoamColor: {r: 1, g: 0.9858491, b: 0.50980395, a: 0}
- _ForceDir: {r: 0, g: 0, b: 0, a: 0}
- _LightColor: {r: 1, g: 0.969554, b: 0.6650944, a: 1}
- _LiquidCameraOffset: {r: 0.1, g: 0.1, b: 0.1, a: 0.1}
- _LiquidColor: {r: 1, g: 0.9088144, b: 0.1745283, a: 1}
- _LiquidFoamColor: {r: 0.9889623, g: 0.99215686, b: 0.54509807, a: 1}
- _LiquidRimColor: {r: 0.9529412, g: 0.8884599, b: 0.2901961, a: 1}
- _LiquidTopColor: {r: 0.98039216, g: 0.866392, b: 0.31764707, a: 1}
- _MainColor: {r: 1, g: 1, b: 1, a: 1}
- _RimColor: {r: 1, g: 1, b: 1, a: 1}
- _SectionColor: {r: 0.9686275, g: 0.8745099, b: 0.098039225, a: 0}
- _ThickCol: {r: 0.96862745, g: 0.87058824, b: 0.09803922, a: 0}
- _Tint: {r: 1, g: 1, b: 1, a: 1}
- _TopColor: {r: 0.9686275, g: 0.8705883, b: 0.098039225, a: 1}
- _WaterColor: {r: 0.9568628, g: 0.8352942, b: 0.08235294, a: 0}
fileFormatVersion: 2
guid: c3c7b3b6511d28544950378a5154c3df
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Orange_juice0
m_Shader: {fileID: 4800000, guid: c7c2116a27c85f34a8d73ddbb9dace12, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BackTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: dca3e4eda77cda44581f53b56f528b02, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BackCut: 0
m_Colors:
- _BackColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _MainColor: {r: 1, g: 1, b: 1, a: 1}
fileFormatVersion: 2
guid: 66d3eee4d3a358444934ff8d286126bf
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 08e4817eee81f9b4185e7073c365e3f9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8ec756227ed81c54597faca0225d071c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment