浏览代码

fixed shader format

/4.1
Shan Jiang 4 年前
当前提交
923b393e
共有 2 个文件被更改,包括 150 次插入157 次删除
  1. 200
      Assets/Scenes/ImageTracking/Prefabs/FireFliesPrefab/Shaders/FireFly.shader
  2. 107
      Assets/Scenes/ImageTracking/Prefabs/FlowerPrefab/Shaders/Vegetation.shader

200
Assets/Scenes/ImageTracking/Prefabs/FireFliesPrefab/Shaders/FireFly.shader


Shader "Unlit/FireFlyNew"
{
Properties
{
_MainTex ("Albedo (Emissive)", 2D) = "white" {}
_Wings ("Wings", 2D) = "white" {}
_EmissiveAmount ("_EmissiveAmount", Float) =2.0
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
Properties
{
_MainTex ("Albedo (Emissive)", 2D) = "white" {}
_Wings ("Wings", 2D) = "white" {}
_EmissiveAmount ("_EmissiveAmount", Float) =2.0
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert alpha:fade
#pragma fragment frag
#include "UnityCG.cginc"
Pass
{
CGPROGRAM
#pragma vertex vert alpha:fade
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float4 uv : TEXCOORD0;
float4 color : COLOR;
};
struct appdata
{
float4 vertex : POSITION;
float4 uv : TEXCOORD0;
float4 color : COLOR;
};
struct v2f
{
float4 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
};
struct v2f
{
float4 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
};
sampler2D _MainTex;
float _EmissiveAmount;
//float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
//o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.uv = v.uv;
o.color.rgba = v.color.rgba;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
float4 emissive = i.color * col.a;
clip(i.color.a - 0.5);
sampler2D _MainTex;
float _EmissiveAmount;
//float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
//o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.uv = v.uv;
o.color.rgba = v.color.rgba;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
float4 emissive = i.color * col.a;
clip(i.color.a - 0.5);
col += emissive * pow(_EmissiveAmount, 2.2);
return col;
}
ENDCG
}
col += emissive * pow(_EmissiveAmount, 2.2);
return col;
}
ENDCG
}
Pass
{
Cull Off
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
Cull Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float4 uv : TEXCOORD0;
float4 color : COLOR;
};
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float4 uv : TEXCOORD0;
float4 color : COLOR;
};
struct v2f
{
float4 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
};
struct v2f
{
float4 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
};
sampler2D _Wings;
//float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
//o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.uv = v.uv;
o.color.rgba = v.color.rgba;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 wings = tex2D(_Wings, i.uv.zw);
wings.a = lerp( wings.a, 0, i.color.a);
sampler2D _Wings;
//float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
//o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.uv = v.uv;
o.color.rgba = v.color.rgba;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 wings = tex2D(_Wings, i.uv.zw);
wings.a = lerp( wings.a, 0, i.color.a);
return wings;
}
ENDCG
}
}
return wings;
}
ENDCG
}
}
}

107
Assets/Scenes/ImageTracking/Prefabs/FlowerPrefab/Shaders/Vegetation.shader


Shader "Custom/Vegetation" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap ("Normal", 2D)= "bump" {}
_OcclusionMap ("Occlusion", 2D) = "white" {}
_OcclusionStrength ("Occlusion Strength", Range(0,1)) = 0.0
_MetallicGlossMap ("Metaillic Smoothness (R/A)", 2D) = "white" {}
_EmissionMap ("Emissive", 2D) = "white" {}
[hdr]_EmissiveColor ("Emissive Color", Color) = (0,0,0,0)
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="TransparentCutout" "Queue"="AlphaTest" }
LOD 200
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_BumpMap ("Normal", 2D)= "bump" {}
_OcclusionMap ("Occlusion", 2D) = "white" {}
_OcclusionStrength ("Occlusion Strength", Range(0,1)) = 0.0
_MetallicGlossMap ("Metaillic Smoothness (R/A)", 2D) = "white" {}
_EmissionMap ("Emissive", 2D) = "white" {}
[hdr]_EmissiveColor ("Emissive Color", Color) = (0,0,0,0)
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="TransparentCutout" "Queue"="AlphaTest" }
LOD 200
CGPROGRAM
#pragma multi_compile _ LOD_FADE_CROSSFADE
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows vertex:vert
CGPROGRAM
#pragma multi_compile _ LOD_FADE_CROSSFADE
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows vertex:vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex, _OcclusionMap, _BumpMap, _MetallicGlossMap, _EmissionMap;
sampler2D _MainTex, _OcclusionMap, _BumpMap, _MetallicGlossMap, _EmissionMap;
struct Input {
float2 uv_MainTex;
float4 screenPos;
};
struct Input {
float2 uv_MainTex;
float4 screenPos;
};
half _Glossiness, _Metallic, _OcclusionStrength;
fixed4 _Color, _EmissiveColor;
half _Glossiness, _Metallic, _OcclusionStrength;
fixed4 _Color, _EmissiveColor;
void vert (inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input,o);
void vert (inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input,o);
}
//float3 worldPos = mul (unity_ObjectToWorld, v.vertex).xyz;
// 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)
//float vLength = length(v.vertex);
//v.vertex.x += sin(_Time * 5) * 0.2 * vLength;
void surf (Input IN, inout SurfaceOutputStandard o) {
}
// 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) {
#ifdef LOD_FADE_CROSSFADE
#ifdef LOD_FADE_CROSSFADE
fixed4 ms = tex2D (_MetallicGlossMap, IN.uv_MainTex);
fixed4 ms = tex2D (_MetallicGlossMap, IN.uv_MainTex);
o.Albedo = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Normal = UnpackNormal(tex2D (_BumpMap, IN.uv_MainTex));
o.Metallic = ms.r * _Metallic;
o.Smoothness = ms.a * _Glossiness;
o.Occlusion = LerpOneTo (tex2D (_OcclusionMap, IN.uv_MainTex), _OcclusionStrength);
o.Emission = tex2D (_EmissionMap, IN.uv_MainTex) * _EmissiveColor;
//o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
o.Albedo = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Normal = UnpackNormal(tex2D (_BumpMap, IN.uv_MainTex));
o.Metallic = ms.r * _Metallic;
o.Smoothness = ms.a * _Glossiness;
o.Occlusion = LerpOneTo (tex2D (_OcclusionMap, IN.uv_MainTex), _OcclusionStrength);
o.Emission = tex2D (_EmissionMap, IN.uv_MainTex) * _EmissiveColor;
}
ENDCG
}
FallBack "Diffuse"
}
正在加载...
取消
保存