From 6ceb40441b4288f62cff074703aebd7beb544d38 Mon Sep 17 00:00:00 2001 From: teascade Date: Tue, 21 Apr 2020 00:40:00 +0300 Subject: [PATCH] Do some leafshader and then give up --- Assets/Materials/CampFog.mat | 2 +- Assets/Materials/PineLefa Better.mat | 77 +++++++++++++++++++++++ Assets/Materials/PineLefa Better.mat.meta | 8 +++ Assets/Scenes/Yee.unity | 9 ++- Assets/Shaders/LeafShader.shader | 65 +++++++++++++++++++ Assets/Shaders/LeafShader.shader.meta | 9 +++ 6 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 Assets/Materials/PineLefa Better.mat create mode 100644 Assets/Materials/PineLefa Better.mat.meta create mode 100644 Assets/Shaders/LeafShader.shader create mode 100644 Assets/Shaders/LeafShader.shader.meta diff --git a/Assets/Materials/CampFog.mat b/Assets/Materials/CampFog.mat index 27912be..1b91f0a 100644 --- a/Assets/Materials/CampFog.mat +++ b/Assets/Materials/CampFog.mat @@ -71,7 +71,7 @@ Material: - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 - - _Transparency: 0.04502965 + - _Transparency: 0 - _UVSec: 0 - _ZWrite: 1 m_Colors: diff --git a/Assets/Materials/PineLefa Better.mat b/Assets/Materials/PineLefa Better.mat new file mode 100644 index 0000000..be3dbc6 --- /dev/null +++ b/Assets/Materials/PineLefa Better.mat @@ -0,0 +1,77 @@ +%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: PineLefa Better + m_Shader: {fileID: 4800000, guid: ded3955735336054cb520d1093af426c, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 1 + 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: 0} + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.28607845, g: 0.5377358, b: 0.07863118, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Materials/PineLefa Better.mat.meta b/Assets/Materials/PineLefa Better.mat.meta new file mode 100644 index 0000000..8165ea4 --- /dev/null +++ b/Assets/Materials/PineLefa Better.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0da5266ff8381a7479426659118efb7d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Yee.unity b/Assets/Scenes/Yee.unity index f543566..abfe7f4 100644 --- a/Assets/Scenes/Yee.unity +++ b/Assets/Scenes/Yee.unity @@ -5672,6 +5672,11 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 7362998546455154831, guid: 3d3251a3aedb46143931b1ea4eaa4138, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 80996928df7a0d847bbb7a283c52976b, type: 2} - target: {fileID: 9084453306067018835, guid: 3d3251a3aedb46143931b1ea4eaa4138, type: 3} propertyPath: m_StaticEditorFlags @@ -18730,7 +18735,7 @@ PrefabInstance: - target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259, type: 3} propertyPath: Regen - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259, type: 3} @@ -18765,7 +18770,7 @@ PrefabInstance: - target: {fileID: 5133887194504435357, guid: 8cf3939d3cb6e684c8ac9618e68c8259, type: 3} propertyPath: ShowInEditor - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 6166170817692975782, guid: 8cf3939d3cb6e684c8ac9618e68c8259, type: 3} diff --git a/Assets/Shaders/LeafShader.shader b/Assets/Shaders/LeafShader.shader new file mode 100644 index 0000000..98c5adc --- /dev/null +++ b/Assets/Shaders/LeafShader.shader @@ -0,0 +1,65 @@ +// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' + +Shader "Custom/LeafShader" +{ + Properties + { + _Color ("Color", Color) = (1,1,1,1) + _MainTex ("Albedo (RGB)", 2D) = "white" {} + _Glossiness ("Smoothness", Range(0,1)) = 0.5 + _Metallic ("Metallic", Range(0,1)) = 0.0 + } + SubShader + { + Tags { "Queue"="Transparent" "RenderType"="Transparent" } + LOD 200 + ZWrite Off + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + // Physically based Standard lighting model, and enable shadows on all light types + #pragma surface surf Standard fullforwardshadows alpha:fade vertex:vert + + // Use shader model 3.0 target, to get nicer looking lighting + #pragma target 3.0 + + sampler2D _MainTex; + + struct Input + { + float2 uv_MainTex; + float3 pos; + }; + void vert (inout appdata_full v, out Input o) { + UNITY_INITIALIZE_OUTPUT(Input,o); + o.pos = v.vertex; + } + + half _Glossiness; + half _Metallic; + fixed4 _Color; + + // 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 slider variables + o.Metallic = _Metallic; + o.Smoothness = _Glossiness; + float len = length(IN.pos); + o.Alpha = (pow(len, 8) / 8 * 0.8 + 0.2) * c.a; + + } + ENDCG + } + FallBack "Diffuse" +} diff --git a/Assets/Shaders/LeafShader.shader.meta b/Assets/Shaders/LeafShader.shader.meta new file mode 100644 index 0000000..5c83a0b --- /dev/null +++ b/Assets/Shaders/LeafShader.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ded3955735336054cb520d1093af426c +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: