增加收获属性逻辑,优化掉落物表现效果
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DropEmission
|
||||
m_Shader: {fileID: 4800000, guid: ee6321f7c35d4f41a692ace420f07421, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 1
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 2020
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _EmissionIntensity: 0.25
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.04, g: 0.85, b: 0.22, a: 1}
|
||||
- _EmissionColor: {r: 0.12, g: 1, b: 0.38, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cbf218826364797b5f9e4bd8ff5b674
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d9bc2d0d723681449aaea6bc054f6ce
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,118 @@
|
||||
Shader "SepCore/Drop/Instanced Emission"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_BaseColor ("Base Color", Color) = (0.04, 0.85, 0.22, 1)
|
||||
[HDR] _EmissionColor ("Emission Color", Color) = (0.12, 1, 0.38, 1)
|
||||
_EmissionIntensity ("Emission Intensity", Range(0, 10)) = 1.8
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "Opaque"
|
||||
"RenderPipeline" = "UniversalPipeline"
|
||||
"Queue" = "Geometry"
|
||||
}
|
||||
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode" = "UniversalForward" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
#pragma multi_compile_instancing
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
UNITY_INSTANCING_BUFFER_START(DropProperties)
|
||||
UNITY_DEFINE_INSTANCED_PROP(float4, _BaseColor)
|
||||
UNITY_DEFINE_INSTANCED_PROP(float4, _EmissionColor)
|
||||
UNITY_DEFINE_INSTANCED_PROP(float, _EmissionIntensity)
|
||||
UNITY_INSTANCING_BUFFER_END(DropProperties)
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float3 normalWS : TEXCOORD0;
|
||||
float4 shadowCoord : TEXCOORD1;
|
||||
half fogFactor : TEXCOORD2;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
Varyings Vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
|
||||
VertexPositionInputs positionInputs = GetVertexPositionInputs(input.positionOS.xyz);
|
||||
VertexNormalInputs normalInputs = GetVertexNormalInputs(input.normalOS);
|
||||
|
||||
output.positionCS = positionInputs.positionCS;
|
||||
output.normalWS = normalInputs.normalWS;
|
||||
output.shadowCoord = GetShadowCoord(positionInputs);
|
||||
output.fogFactor = ComputeFogFactor(positionInputs.positionCS.z);
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
|
||||
half4 baseColor = UNITY_ACCESS_INSTANCED_PROP(DropProperties, _BaseColor);
|
||||
half3 emissionColor = UNITY_ACCESS_INSTANCED_PROP(DropProperties, _EmissionColor).rgb;
|
||||
half emissionIntensity = UNITY_ACCESS_INSTANCED_PROP(DropProperties, _EmissionIntensity);
|
||||
|
||||
half3 normalWS = normalize(input.normalWS);
|
||||
Light mainLight = GetMainLight(input.shadowCoord);
|
||||
half diffuse = saturate(dot(normalWS, mainLight.direction)) * mainLight.shadowAttenuation;
|
||||
half3 ambientLighting = SampleSH(normalWS);
|
||||
half3 baseLighting = baseColor.rgb * (ambientLighting + mainLight.color * diffuse);
|
||||
half3 color = MixFog(baseLighting + emissionColor * emissionIntensity, input.fogFactor);
|
||||
|
||||
return half4(color, baseColor.a);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags { "LightMode" = "ShadowCaster" }
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
ColorMask 0
|
||||
Cull Back
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
#pragma multi_compile_instancing
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee6321f7c35d4f41a692ace420f07421
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user