v0.1.0
This commit is contained in:
61
Assets/DomeShift/Resources/DomeGlass.shader
Normal file
61
Assets/DomeShift/Resources/DomeGlass.shader
Normal file
@@ -0,0 +1,61 @@
|
||||
Shader "DomeShift/Glass"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color ("Glazing tint and opacity", Color) = (0.59, 0.78, 0.75, 0.16)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" "IgnoreProjector" = "True" }
|
||||
|
||||
Pass
|
||||
{
|
||||
Cull Back
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
struct SurfaceVertex
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct GlassVertex
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float3 worldPosition : TEXCOORD0;
|
||||
half3 worldNormal : TEXCOORD1;
|
||||
};
|
||||
|
||||
GlassVertex Vert(SurfaceVertex vertex)
|
||||
{
|
||||
GlassVertex result;
|
||||
result.position = UnityObjectToClipPos(vertex.position);
|
||||
result.worldPosition = mul(unity_ObjectToWorld, vertex.position).xyz;
|
||||
result.worldNormal = UnityObjectToWorldNormal(vertex.normal);
|
||||
return result;
|
||||
}
|
||||
|
||||
fixed4 Frag(GlassVertex vertex) : SV_Target
|
||||
{
|
||||
half3 perspective = normalize(_WorldSpaceCameraPos.xyz - vertex.worldPosition);
|
||||
half3 sightline = lerp(perspective, UNITY_MATRIX_V[2].xyz, unity_OrthoParams.w);
|
||||
half grazing = 1.0h - saturate(abs(dot(normalize(vertex.worldNormal), sightline)));
|
||||
half sheen = grazing * grazing;
|
||||
fixed3 tint = lerp(_Color.rgb, fixed3(0.9, 0.96, 0.93), sheen * 0.4h);
|
||||
fixed opacity = saturate(_Color.a * (0.82h + sheen * 0.7h));
|
||||
return fixed4(tint, opacity);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
9
Assets/DomeShift/Resources/DomeGlass.shader.meta
Normal file
9
Assets/DomeShift/Resources/DomeGlass.shader.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d3cbd66b18df15b09abe79aa23338c7
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user