Commit 494e3450 authored by Pinguin's avatar Pinguin
Browse files

better dissolve shader with normal and roughness map

parent b41d3648
......@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Can
m_Shader: {fileID: 4800000, guid: ffd47d42d0525a24da64b36a365b7531, type: 3}
m_Shader: {fileID: 4800000, guid: 6f40288e2fc4b804b91d3464810e21ba, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
......@@ -36,7 +36,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DissolveTex:
m_Texture: {fileID: 2800000, guid: 6aac7e4c24033f745908517c924bc086, type: 3}
m_Texture: {fileID: 2800000, guid: 38f75f5c96cf4734eaf03828d7d4aa29, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
......@@ -47,10 +47,18 @@ Material:
m_Texture: {fileID: 2800000, guid: 9031f05801e5d6d44a2f2be87d2f8a0f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Metallic:
m_Texture: {fileID: 2800000, guid: 7d7a6abeaa6851247ae0b8940ed38cbd, 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}
- _Normal:
m_Texture: {fileID: 2800000, guid: ddfa7f74b60a656468503e6013931161, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
......@@ -63,7 +71,7 @@ Material:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DissolveAmount: 0.344
- _DissolveAmount: 0
- _DissolveScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
......@@ -71,6 +79,7 @@ Material:
- _GlossyReflections: 1
- _Metallic: 0.55
- _Mode: 0
- _NormalIntensity: 1
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
......
......@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Disolvinglick
m_Shader: {fileID: 4800000, guid: ffd47d42d0525a24da64b36a365b7531, type: 3}
m_Shader: {fileID: 4800000, guid: 6f40288e2fc4b804b91d3464810e21ba, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
......@@ -47,10 +47,18 @@ Material:
m_Texture: {fileID: 2800000, guid: 4e862822f4ef689418b5df23423187cb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Metallic:
m_Texture: {fileID: 2800000, guid: d0bc42db1e3fb4a42b20fcd53127d5e1, 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}
- _Normal:
m_Texture: {fileID: 2800000, guid: e2ca7654430632049bf5760649d455dd, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
......@@ -71,6 +79,7 @@ Material:
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _NormalIntensity: 1
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
......
Shader "Custom/DissolveSurfaceShader_NormalRough"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Metallic ("Metallic Map", 2D) = "white" {}
_Normal ("Normal Map", 2D) = "white" {}
_NormalIntensity ("Normal Intensity", Range(-2,2)) = 1
// Dissolve
_DissolveTex ("Dissolve Map", 2D) = "white" {}
_DissolveAmount ("Dissolve Amount", Range(0,1)) = 0.5
_DissolveScale ("Dissolve Scale", float) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard addshadow
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _Metallic;
sampler2D _Normal;
struct Input
{
float2 uv_MainTex;
float2 uv_Metallic;
float2 uv_Normal;
float2 uv_DissolveTex;
};
half _NormalIntensity;
fixed4 _Color;
// Dissolve
sampler2D _DissolveTex;
half _DissolveAmount;
half _DissolveScale;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from metallic map (smoothness is the alpha channel)
fixed4 m = tex2D(_Metallic, IN.uv_Metallic);
o.Metallic = m.rgb;
o.Smoothness = m.a;
// Normal map comes from a normal map texture
fixed3 n = UnpackNormal (tex2D(_Normal, IN.uv_Normal));
n.y = -n.y;
n.x *= _NormalIntensity;
n.y *= _NormalIntensity;
o.Normal = n.rgb;
o.Alpha = c.a;
// Dissolve
fixed4 noise = tex2D (_DissolveTex, IN.uv_DissolveTex * _DissolveScale);
clip(noise.r - _DissolveAmount);
}
ENDCG
}
FallBack "Diffuse"
}
fileFormatVersion: 2
guid: 6f40288e2fc4b804b91d3464810e21ba
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
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