chore: add MarrowSDK plugin
Signed-off-by: Jo <johannesreckers2006@gmail.com>
This commit is contained in:
parent
64de674738
commit
5eb961ae8a
119 changed files with 40706 additions and 0 deletions
8
Assets/SLZShaders/Include/Particle.meta
Normal file
8
Assets/SLZShaders/Include/Particle.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 05cb88a931e735a4b9ad942dbbbf3ed7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/SLZShaders/Include/Particle/ShaderInjector.meta
Normal file
8
Assets/SLZShaders/Include/Particle/ShaderInjector.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: baf0cae36873ec6479fc0c926f732068
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 98a02e34c0c4b8748ade0ad9cd5a2611
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,152 @@
|
|||
|
||||
#pragma target 5.0
|
||||
//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
//#!INJECT_POINT MOBILE_DEFINES
|
||||
#else
|
||||
//#!INJECT_POINT STANDALONE_DEFINES
|
||||
#endif
|
||||
|
||||
//#!INJECT_POINT UNIVERSAL_DEFINES
|
||||
|
||||
#pragma multi_compile_fog
|
||||
#pragma skip_variants FOG_LINEAR
|
||||
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options procedural:ParticleInstancingSetup
|
||||
|
||||
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
|
||||
#include "Include/Particle/billboard.hlsl"
|
||||
//#!INJECT_POINT INCLUDES
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 uv0_vertexStream0_xy : TEXCOORD0;
|
||||
half4 color : COLOR;
|
||||
//#!INJECT_POINT VERTEX_IN
|
||||
//#!INJECT_DEFAULT
|
||||
float vertexStream1 : TEXCOORD1;
|
||||
//#!INJECT_END
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
//#!INJECT_POINT VERTEX_CENTROID
|
||||
//#!INJECT_DEFAULT
|
||||
float4 vertex : SV_POSITION;
|
||||
//#!INJECT_END
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 wPos_xyz_fog_x : TEXCOORD1;
|
||||
half4 color : COLOR;
|
||||
//#!INJECT_POINT INTERPOLATORS
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
struct fragOut
|
||||
{
|
||||
half4 color : SV_Target;
|
||||
//#!INJECT_POINT OUTPUT_SEMANTICS
|
||||
};
|
||||
|
||||
//#include "Include/PlatformSamplers.hlsl"
|
||||
|
||||
TEXTURE2D(_BaseMap);
|
||||
SamplerState sampler_BaseMap;
|
||||
|
||||
//#!INJECT_POINT UNIFORMS
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
half4 _BaseColor;
|
||||
//#!INJECT_POINT MATERIAL_CBUFFER
|
||||
CBUFFER_END
|
||||
|
||||
//#!INJECT_POINT FUNCTIONS
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
//#!INJECT_POINT VERT_BEGIN
|
||||
|
||||
//#!INJECT_POINT VERT_TRANSFORM
|
||||
//#!INJECT_DEFAULT
|
||||
float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x);
|
||||
v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter);
|
||||
//#!INJECT_END
|
||||
o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz);
|
||||
o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz);
|
||||
o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap);
|
||||
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
|
||||
o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far;
|
||||
o.color = v.color;
|
||||
|
||||
//#!INJECT_POINT VERT_END
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fragOut frag(v2f i)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
fragOut f;
|
||||
|
||||
//#!INJECT_POINT FRAG_BEGIN
|
||||
|
||||
//#!INJECT_POINT FRAG_COLOR
|
||||
//#!INJECT_DEFAULT
|
||||
f.color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv0);
|
||||
f.color *= _BaseColor * i.color;
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_POINT FRAG_FOG
|
||||
//#!INJECT_DEFAULT
|
||||
half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos));
|
||||
#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w);
|
||||
#elif defined(SLZ_PARTICLE_MULTIPLICATIVE)
|
||||
f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w));
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w);
|
||||
#endif
|
||||
#endif
|
||||
//#!INJECT_END
|
||||
|
||||
|
||||
//#!INJECT_POINT FRAG_VOLUMETRICS
|
||||
//#!INJECT_DEFAULT
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
#if defined(_VOLUMETRICS_ENABLED)
|
||||
f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a;
|
||||
#endif
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz);
|
||||
#endif
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_POINT FRAG_END
|
||||
|
||||
return f;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2df13d630bf74324fbefa9003b6544b3
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4e0ec44885694984b843804e07b56a1c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,42 @@
|
|||
//#!INJECT_BEGIN INCLUDES 0
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZSoftBlend.hlsl"
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
|
||||
float _SoftFactor;
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_BEGIN VERTEX_CENTROID 0
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
centroid float4 vertex : SV_POSITION;
|
||||
#else
|
||||
float4 vertex : SV_POSITION;
|
||||
#endif
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_BEGIN OUTPUT_SEMANTICS 0
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
float depth : SV_DepthLessEqual;
|
||||
#endif
|
||||
//#!INJECT_END
|
||||
|
||||
|
||||
//#!INJECT_BEGIN FRAG_END 99
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
half noise = GetScreenNoiseR(screenUVs);
|
||||
f.depth = SLZSoftBlendZTest(i.vertex.z, noise, _SoftFactor);
|
||||
#else
|
||||
float rawDepth = SampleSceneDepth(screenUVs);
|
||||
float viewZ = dot(GetWorldToViewMatrix()._m20_m21_m22_m23, float4(i.wPos_xyz_fog_x.xyz, 1));
|
||||
float fade = SLZSoftBlendDepth(rawDepth, viewZ, _SoftFactor);
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
f.color *= fade;
|
||||
#elif defined(SLZ_PARTICLE_MULTIPLICATIVE)
|
||||
f.color = lerp(fade, float4(1,1,1,1), f.color));
|
||||
#else
|
||||
f.color.a *= fade;
|
||||
#endif
|
||||
#endif
|
||||
//#!INJECT_END
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f42ab72a6a8465649be290d03a8f1981
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
//#!INJECT_BEGIN FRAG_BEGIN -1
|
||||
float2 screenUVs = GetNormalizedScreenSpaceUV(i.vertex);
|
||||
//#!INJECT_END
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 03859193eb793184ca8cc47738d7109d
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,39 @@
|
|||
//#!INJECT_BEGIN UNIFORMS 0
|
||||
TEXTURE2D(_ScreenSpacePattern);
|
||||
SAMPLER(sampler_ScreenSpacePattern);
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
|
||||
half _Speed;
|
||||
half _SecondarySpeed;
|
||||
float _ScreenSpaceSize;
|
||||
float _ParticleOffset;
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_BEGIN FUNCTIONS 0
|
||||
float2 RotateTorchUVs(float2 uv, float2 center, float angle)
|
||||
{
|
||||
uv = uv - center;
|
||||
float sin1, cos1;
|
||||
sincos(angle, sin1, cos1);
|
||||
float2x2 rotMat = float2x2(cos1, -sin1, sin1, cos1);
|
||||
uv = mul(rotMat, uv);
|
||||
return uv + center;
|
||||
}
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_BEGIN VERT_BEGIN 0
|
||||
v.vertex.z += _ParticleOffset;
|
||||
//#!INJECT_END
|
||||
|
||||
//#!INJECT_BEGIN FRAG_COLOR 0
|
||||
float angle1 = frac(_Time[0] * 3.1830988618 * _Speed) * TWO_PI;
|
||||
float angle2 = frac(_Time[0] * 3.1830988618 * _Speed * _SecondarySpeed) * TWO_PI;
|
||||
angle1 = -angle1;
|
||||
float2 uv1 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle1);
|
||||
half layer1 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv1).r;
|
||||
float2 uv2 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle2);
|
||||
half layer2 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv2).r;
|
||||
half4 SSPattern = SAMPLE_TEXTURE2D(_ScreenSpacePattern, sampler_ScreenSpacePattern, _ScreenParams.xy * screenUVs / _ScreenSpaceSize);
|
||||
f.color = (layer1 * layer2 * i.color.a) * SSPattern * _BaseColor * i.color;
|
||||
//#!INJECT_END
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2a6fc1acbba5a6045a0692bfb9a7a8f2
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,17 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
|
||||
m_Name: ParticleBasic
|
||||
m_EditorClassIdentifier:
|
||||
outputInclude: {fileID: 10900000, guid: c156fe6f1c50d864f8ceb85b935236f7, type: 3}
|
||||
baseInclude: {fileID: 10900000, guid: 2df13d630bf74324fbefa9003b6544b3, type: 3}
|
||||
injectableIncludes: []
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 36686d6671a56b04f9401216e0ff9ae5
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,128 @@
|
|||
/*-----------------------------------------------------------------------------------------------------*
|
||||
*-----------------------------------------------------------------------------------------------------*
|
||||
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
|
||||
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
|
||||
*-----------------------------------------------------------------------------------------------------*
|
||||
*-----------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#pragma target 5.0
|
||||
//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
||||
#pragma multi_compile_fog
|
||||
#pragma skip_variants FOG_LINEAR
|
||||
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options procedural:ParticleInstancingSetup
|
||||
|
||||
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
|
||||
#include "Include/Particle/billboard.hlsl"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 uv0_vertexStream0_xy : TEXCOORD0;
|
||||
half4 color : COLOR;
|
||||
float vertexStream1 : TEXCOORD1;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 wPos_xyz_fog_x : TEXCOORD1;
|
||||
half4 color : COLOR;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
struct fragOut
|
||||
{
|
||||
half4 color : SV_Target;
|
||||
};
|
||||
|
||||
//#include "Include/PlatformSamplers.hlsl"
|
||||
|
||||
TEXTURE2D(_BaseMap);
|
||||
SamplerState sampler_BaseMap;
|
||||
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
half4 _BaseColor;
|
||||
CBUFFER_END
|
||||
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
|
||||
float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x);
|
||||
v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter);
|
||||
o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz);
|
||||
o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz);
|
||||
o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap);
|
||||
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
|
||||
o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far;
|
||||
o.color = v.color;
|
||||
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fragOut frag(v2f i)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
fragOut f;
|
||||
|
||||
|
||||
f.color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv0);
|
||||
f.color *= _BaseColor * i.color;
|
||||
|
||||
half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos));
|
||||
#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w);
|
||||
#elif defined(SLZ_PARTICLE_MULTIPLICATIVE)
|
||||
f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w));
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
#if defined(_VOLUMETRICS_ENABLED)
|
||||
f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a;
|
||||
#endif
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz);
|
||||
#endif
|
||||
|
||||
|
||||
return f;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c156fe6f1c50d864f8ceb85b935236f7
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,19 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
|
||||
m_Name: ParticleSoft
|
||||
m_EditorClassIdentifier:
|
||||
outputInclude: {fileID: 10900000, guid: 005850956c06e3c4d9126500376c9a40, type: 3}
|
||||
baseInclude: {fileID: 10900000, guid: 2df13d630bf74324fbefa9003b6544b3, type: 3}
|
||||
injectableIncludes:
|
||||
- {fileID: 10900000, guid: 03859193eb793184ca8cc47738d7109d, type: 3}
|
||||
- {fileID: 10900000, guid: f42ab72a6a8465649be290d03a8f1981, type: 3}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 390d76c4ec3c32e4e8ecc2b49aa78a1c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,175 @@
|
|||
/*-----------------------------------------------------------------------------------------------------*
|
||||
*-----------------------------------------------------------------------------------------------------*
|
||||
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
|
||||
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
|
||||
*-----------------------------------------------------------------------------------------------------*
|
||||
*-----------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#pragma target 5.0
|
||||
//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
||||
#pragma multi_compile_fog
|
||||
#pragma skip_variants FOG_LINEAR
|
||||
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options procedural:ParticleInstancingSetup
|
||||
|
||||
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
|
||||
#include "Include/Particle/billboard.hlsl"
|
||||
// Begin Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl"
|
||||
#else
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#endif
|
||||
// End Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 uv0_vertexStream0_xy : TEXCOORD0;
|
||||
half4 color : COLOR;
|
||||
float vertexStream1 : TEXCOORD1;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
// Begin Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
centroid float4 vertex : SV_POSITION;
|
||||
#else
|
||||
float4 vertex : SV_POSITION;
|
||||
#endif
|
||||
// End Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 wPos_xyz_fog_x : TEXCOORD1;
|
||||
half4 color : COLOR;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
struct fragOut
|
||||
{
|
||||
half4 color : SV_Target;
|
||||
// Begin Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
float depth : SV_DepthLessEqual;
|
||||
#endif
|
||||
// End Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
};
|
||||
|
||||
//#include "Include/PlatformSamplers.hlsl"
|
||||
|
||||
TEXTURE2D(_BaseMap);
|
||||
SamplerState sampler_BaseMap;
|
||||
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
half4 _BaseColor;
|
||||
// Begin Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
float _SoftFactor;
|
||||
// End Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
CBUFFER_END
|
||||
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
|
||||
float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x);
|
||||
v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter);
|
||||
o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz);
|
||||
o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz);
|
||||
o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap);
|
||||
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
|
||||
o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far;
|
||||
o.color = v.color;
|
||||
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fragOut frag(v2f i)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
fragOut f;
|
||||
|
||||
// Begin Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ----------------------------------------------------------
|
||||
float2 screenUVs = GetNormalizedScreenSpaceUV(i.vertex);
|
||||
// End Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ----------------------------------------------------------
|
||||
|
||||
f.color = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv0);
|
||||
f.color *= _BaseColor * i.color;
|
||||
|
||||
half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos));
|
||||
#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w);
|
||||
#elif defined(SLZ_PARTICLE_MULTIPLICATIVE)
|
||||
f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w));
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
#if defined(_VOLUMETRICS_ENABLED)
|
||||
f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a;
|
||||
#endif
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz);
|
||||
#endif
|
||||
|
||||
// Begin Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
half noise = GetScreenNoiseR(screenUVs);
|
||||
float depthOffset = _SoftFactor * noise * noise ;
|
||||
float vertDepth = i.vertex.z;
|
||||
float cameraZ = 1.0 / (_ZBufferParams.z * vertDepth + _ZBufferParams.w);
|
||||
cameraZ += depthOffset;
|
||||
f.depth = (rcp(cameraZ) - _ZBufferParams.w) / _ZBufferParams.z;
|
||||
#else
|
||||
float rawDepth = SampleSceneDepth(screenUVs);
|
||||
float sceneZ = (unity_OrthoParams.w == 0) ? LinearEyeDepth(rawDepth, _ZBufferParams) : LinearDepthToEyeDepth(rawDepth);
|
||||
float thisZ = LinearEyeDepth(i.wPos_xyz_fog_x.xyz, GetWorldToViewMatrix());
|
||||
float fade = saturate((1 / _SoftFactor) * (sceneZ - thisZ));
|
||||
fade *= fade;
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
f.color *= fade;
|
||||
#elif defined(SLZ_PARTICLE_MULTIPLICATIVE)
|
||||
f.color = lerp(fade, float4(1,1,1,1), f.color));
|
||||
#else
|
||||
f.color.a *= fade;
|
||||
#endif
|
||||
#endif
|
||||
// End Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
|
||||
return f;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 005850956c06e3c4d9126500376c9a40
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,20 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
|
||||
m_Name: ParticleTorch
|
||||
m_EditorClassIdentifier:
|
||||
outputInclude: {fileID: 10900000, guid: 2313d59684d119840a78fee73c48959a, type: 3}
|
||||
baseInclude: {fileID: 10900000, guid: 2df13d630bf74324fbefa9003b6544b3, type: 3}
|
||||
injectableIncludes:
|
||||
- {fileID: 10900000, guid: 03859193eb793184ca8cc47738d7109d, type: 3}
|
||||
- {fileID: 10900000, guid: f42ab72a6a8465649be290d03a8f1981, type: 3}
|
||||
- {fileID: 10900000, guid: 2a6fc1acbba5a6045a0692bfb9a7a8f2, type: 3}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 88f1b8e9d502e19419d88bca2cab94da
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,200 @@
|
|||
/*-----------------------------------------------------------------------------------------------------*
|
||||
*-----------------------------------------------------------------------------------------------------*
|
||||
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
|
||||
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
|
||||
*-----------------------------------------------------------------------------------------------------*
|
||||
*-----------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#pragma target 5.0
|
||||
//#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
||||
#pragma multi_compile_fog
|
||||
#pragma skip_variants FOG_LINEAR
|
||||
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options procedural:ParticleInstancingSetup
|
||||
|
||||
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
|
||||
#include "Include/Particle/billboard.hlsl"
|
||||
// Begin Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZSoftBlend.hlsl"
|
||||
// End Injection INCLUDES from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 uv0_vertexStream0_xy : TEXCOORD0;
|
||||
half4 color : COLOR;
|
||||
float vertexStream1 : TEXCOORD1;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
// Begin Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
centroid float4 vertex : SV_POSITION;
|
||||
#else
|
||||
float4 vertex : SV_POSITION;
|
||||
#endif
|
||||
// End Injection VERTEX_CENTROID from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 wPos_xyz_fog_x : TEXCOORD1;
|
||||
half4 color : COLOR;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
struct fragOut
|
||||
{
|
||||
half4 color : SV_Target;
|
||||
// Begin Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
float depth : SV_DepthLessEqual;
|
||||
#endif
|
||||
// End Injection OUTPUT_SEMANTICS from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
};
|
||||
|
||||
//#include "Include/PlatformSamplers.hlsl"
|
||||
|
||||
TEXTURE2D(_BaseMap);
|
||||
SamplerState sampler_BaseMap;
|
||||
|
||||
// Begin Injection UNIFORMS from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
TEXTURE2D(_ScreenSpacePattern);
|
||||
SAMPLER(sampler_ScreenSpacePattern);
|
||||
// End Injection UNIFORMS from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _BaseMap_ST;
|
||||
half4 _BaseColor;
|
||||
// Begin Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
float _SoftFactor;
|
||||
// End Injection MATERIAL_CBUFFER from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
// Begin Injection MATERIAL_CBUFFER from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
half _Speed;
|
||||
half _SecondarySpeed;
|
||||
float _ScreenSpaceSize;
|
||||
float _ParticleOffset;
|
||||
// End Injection MATERIAL_CBUFFER from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
CBUFFER_END
|
||||
|
||||
// Begin Injection FUNCTIONS from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
float2 RotateTorchUVs(float2 uv, float2 center, float angle)
|
||||
{
|
||||
uv = uv - center;
|
||||
float sin1, cos1;
|
||||
sincos(angle, sin1, cos1);
|
||||
float2x2 rotMat = float2x2(cos1, -sin1, sin1, cos1);
|
||||
uv = mul(rotMat, uv);
|
||||
return uv + center;
|
||||
}
|
||||
// End Injection FUNCTIONS from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
// Begin Injection VERT_BEGIN from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
v.vertex.z += _ParticleOffset;
|
||||
// End Injection VERT_BEGIN from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
|
||||
float3 particleCenter = float3(v.uv0_vertexStream0_xy.zw, v.vertexStream1.x);
|
||||
v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, particleCenter);
|
||||
o.wPos_xyz_fog_x.xyz = TransformObjectToWorld(v.vertex.xyz);
|
||||
o.vertex = TransformWorldToHClip(o.wPos_xyz_fog_x.xyz);
|
||||
o.uv0 = TRANSFORM_TEX(v.uv0_vertexStream0_xy.xy, _BaseMap);
|
||||
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
|
||||
o.wPos_xyz_fog_x.w = unity_FogParams.x * clipZ_0Far;
|
||||
o.color = v.color;
|
||||
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fragOut frag(v2f i)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
fragOut f;
|
||||
|
||||
// Begin Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ----------------------------------------------------------
|
||||
float2 screenUVs = GetNormalizedScreenSpaceUV(i.vertex);
|
||||
// End Injection FRAG_BEGIN from Injection_Particle_screenspaceUVs.hlsl ----------------------------------------------------------
|
||||
|
||||
// Begin Injection FRAG_COLOR from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
float angle1 = frac(_Time[0] * 3.1830988618 * _Speed) * TWO_PI;
|
||||
float angle2 = frac(_Time[0] * 3.1830988618 * _Speed * _SecondarySpeed) * TWO_PI;
|
||||
angle1 = -angle1;
|
||||
float2 uv1 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle1);
|
||||
half layer1 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv1).r;
|
||||
float2 uv2 = RotateTorchUVs(i.uv0.xy, float2(0.5, 0.5), angle2);
|
||||
half layer2 = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv2).r;
|
||||
half4 SSPattern = SAMPLE_TEXTURE2D(_ScreenSpacePattern, sampler_ScreenSpacePattern, _ScreenParams.xy * screenUVs / _ScreenSpaceSize);
|
||||
f.color = (layer1 * layer2 * i.color.a) * SSPattern * _BaseColor * i.color;
|
||||
// End Injection FRAG_COLOR from Injection_Torch.hlsl ----------------------------------------------------------
|
||||
|
||||
half3 viewDir = normalize(half3(i.wPos_xyz_fog_x.xyz - _WorldSpaceCameraPos));
|
||||
#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
f.color.rgb *= 1.0 - ComputeFogIntensity(i.wPos_xyz_fog_x.w);
|
||||
#elif defined(SLZ_PARTICLE_MULTIPLICATIVE)
|
||||
f.color.rgb = lerp(f.color.rgb, half3(1,1,1), ComputeFogIntensity(i.wPos_xyz_fog_x.w));
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color.rgb = MixFog(f.color.rgb, viewDir, i.wPos_xyz_fog_x.w);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
#if defined(_VOLUMETRICS_ENABLED)
|
||||
f.color *= GetVolumetricColor(i.wPos_xyz_fog_x.xyz).a;
|
||||
#endif
|
||||
#elif defined(SLZ_PARTICLE_ALPHABLEND)
|
||||
f.color = Volumetrics(f.color, i.wPos_xyz_fog_x.xyz);
|
||||
#endif
|
||||
|
||||
// Begin Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
#if defined(SHADER_API_MOBILE)
|
||||
half noise = GetScreenNoiseR(screenUVs);
|
||||
f.depth = SLZSoftBlendZTest(i.vertex.z, noise, _SoftFactor);
|
||||
#else
|
||||
float rawDepth = SampleSceneDepth(screenUVs);
|
||||
float viewZ = dot(GetWorldToViewMatrix()._m20_m21_m22_m23, float4(i.wPos_xyz_fog_x.xyz, 1));
|
||||
float fade = SLZSoftBlendDepth(rawDepth, viewZ, _SoftFactor);
|
||||
#if defined(SLZ_PARTICLE_ADDITIVE)
|
||||
f.color *= fade;
|
||||
#elif defined(SLZ_PARTICLE_MULTIPLICATIVE)
|
||||
f.color = lerp(fade, float4(1,1,1,1), f.color));
|
||||
#else
|
||||
f.color.a *= fade;
|
||||
#endif
|
||||
#endif
|
||||
// End Injection FRAG_END from Injection_Particle_SoftBlend.hlsl ----------------------------------------------------------
|
||||
|
||||
return f;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2313d59684d119840a78fee73c48959a
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1 @@
|
|||
v.vertex.xyz = ParticleFaceCamera(v.vertex.xyz, v.ase_texcoord1.xyz);
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0e6e0041457dfeb47936aa37f7c4bfdf
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1 @@
|
|||
v.vertex.xyz = MeshFlareBillboard(v.vertex.xyz);
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 75872890b046c074fac20ab6d18e52b1
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
94
Assets/SLZShaders/Include/Particle/billboard.hlsl
Normal file
94
Assets/SLZShaders/Include/Particle/billboard.hlsl
Normal file
|
@ -0,0 +1,94 @@
|
|||
float3 centerEyePos()
|
||||
{
|
||||
#if defined(UNITY_STEREO_MULTIVIEW_ENABLED) || defined(UNITY_STEREO_INSTANCING_ENABLED)
|
||||
return 0.5 * (unity_StereoWorldSpaceCameraPos[0] + unity_StereoWorldSpaceCameraPos[1]);
|
||||
#else
|
||||
return _WorldSpaceCameraPos;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Rotates a particle to face the camera in a more vr-correct way than unity's default particle system
|
||||
*
|
||||
*/
|
||||
|
||||
float3 particle_face_camera(float3 vertex, inout float3 normal, inout float3 center)
|
||||
{
|
||||
vertex.xyz -= center;
|
||||
|
||||
float3 head = centerEyePos();
|
||||
float3 centerToEye = normalize(center-head);
|
||||
float c2eXZLen = length(centerToEye.xz);
|
||||
float sin1 = -centerToEye.y;
|
||||
float cos1 = c2eXZLen;
|
||||
float2x2 rotPitch = float2x2(cos1, sin1, -sin1, cos1);
|
||||
|
||||
vertex.zy = mul(rotPitch, vertex.zy);
|
||||
normal.zy = mul(rotPitch, normal.zy);
|
||||
//tangent.zy = mul(rotPitch, tangent.zy);
|
||||
|
||||
float sin2 = centerToEye.x/c2eXZLen;
|
||||
float cos2 = centerToEye.z/c2eXZLen;
|
||||
float2x2 rotYaw = float2x2(cos2, sin2, -sin2, cos2);
|
||||
|
||||
vertex.xz = mul(rotYaw,vertex.xz);
|
||||
normal.xz = mul(rotYaw,normal.xz);
|
||||
//tangent.xz = mul(rotYaw,tangent.xz);
|
||||
|
||||
vertex.xyz += center;
|
||||
return vertex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float3 ParticleFaceCamera(float3 vertex, float3 center)
|
||||
{
|
||||
vertex.xyz -= center;
|
||||
|
||||
float3 head = centerEyePos();
|
||||
float3 centerToEye = normalize(center - head);
|
||||
float c2eXZLen = length(centerToEye.xz);
|
||||
float sin1 = -centerToEye.y;
|
||||
float cos1 = c2eXZLen;
|
||||
float2x2 rotPitch = float2x2(cos1, sin1, -sin1, cos1);
|
||||
|
||||
vertex.zy = mul(rotPitch, vertex.zy);
|
||||
|
||||
|
||||
float sin2 = centerToEye.x / c2eXZLen;
|
||||
float cos2 = centerToEye.z / c2eXZLen;
|
||||
float2x2 rotYaw = float2x2(cos2, sin2, -sin2, cos2);
|
||||
|
||||
vertex.xz = mul(rotYaw, vertex.xz);
|
||||
|
||||
|
||||
vertex.xyz += center;
|
||||
return vertex;
|
||||
}
|
||||
|
||||
float3 MeshFaceCamera(float3 vertex)
|
||||
{
|
||||
float3 center = float3(0,0,0);
|
||||
//vertex = TransformObjectToWorld(vertex);
|
||||
|
||||
float3 head = TransformWorldToObject(centerEyePos());
|
||||
float3 centerToEye = normalize(center - head);
|
||||
float c2eXZLen = length(centerToEye.xz);
|
||||
float sin1 = -centerToEye.y;
|
||||
float cos1 = c2eXZLen;
|
||||
float2x2 rotPitch = float2x2(cos1, sin1, -sin1, cos1);
|
||||
|
||||
vertex.zy = mul(rotPitch, vertex.zy);
|
||||
|
||||
|
||||
float sin2 = centerToEye.x / c2eXZLen;
|
||||
float cos2 = centerToEye.z / c2eXZLen;
|
||||
float2x2 rotYaw = float2x2(cos2, sin2, -sin2, cos2);
|
||||
|
||||
vertex.xz = mul(rotYaw, vertex.xz);
|
||||
|
||||
|
||||
//vertex.xyz += center;
|
||||
return vertex;
|
||||
}
|
||||
|
7
Assets/SLZShaders/Include/Particle/billboard.hlsl.meta
Normal file
7
Assets/SLZShaders/Include/Particle/billboard.hlsl.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 40dd6881c3760054cacc50fdba7554dc
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/SLZShaders/Include/PlatformSamplers.hlsl
Normal file
16
Assets/SLZShaders/Include/PlatformSamplers.hlsl
Normal file
|
@ -0,0 +1,16 @@
|
|||
#if defined(SHADER_API_MOBILE) // Quest 2 (XR2) works better with combined texture-samplers apparently
|
||||
|
||||
#ifdef TEXTURE2D
|
||||
#undef TEXTURE2D
|
||||
#endif
|
||||
#ifdef SAMPLER
|
||||
#undef SAMPLER
|
||||
#endif
|
||||
#ifdef SAMPLE_TEXTURE2D
|
||||
#undef SAMPLE_TEXTURE2D
|
||||
#endif
|
||||
|
||||
#define TEXTURE2D(textureName) sampler2D textureName
|
||||
#define SAMPLER(samplerName)
|
||||
#define SAMPLE_TEXTURE2D(textureName, samplerName, coord) tex2D(textureName, coord)
|
||||
#endif
|
7
Assets/SLZShaders/Include/PlatformSamplers.hlsl.meta
Normal file
7
Assets/SLZShaders/Include/PlatformSamplers.hlsl.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6aab105c75192124887c893201ce93e0
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
95
Assets/SLZShaders/Include/Triplanar.hlsl
Normal file
95
Assets/SLZShaders/Include/Triplanar.hlsl
Normal file
|
@ -0,0 +1,95 @@
|
|||
#if !defined(SLZ_TRIPLANAR_INCLUDED)
|
||||
#define SLZ_TRIPLANAR_INCLUDED
|
||||
//#define TEXTURE2D_PARAM(textureName, samplerName) Texture2D textureName, sampler samplerName
|
||||
|
||||
/**
|
||||
* Struct containg the ddx and ddy of the uvs combined into one half4 for each axis
|
||||
*/
|
||||
struct tpDerivatives
|
||||
{
|
||||
half4 ddX;
|
||||
half4 ddY;
|
||||
half4 ddZ;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the derivatives of the worldspace coordinates reduced to 3 2 dimensional planes defined by each axis
|
||||
*
|
||||
* @param wPos Worldspace position
|
||||
* @param[out] dd struct containing the x and y derivatives of each plane
|
||||
*/
|
||||
void GetDirectionalDerivatives(float3 wPos, out tpDerivatives dd)
|
||||
{
|
||||
dd.ddX.xy = ddx(wPos.zy);
|
||||
dd.ddY.xy = ddx(wPos.xz);
|
||||
dd.ddZ.xy = ddx(wPos.xy);
|
||||
dd.ddX.zw = ddy(wPos.zy);
|
||||
dd.ddY.zw = ddy(wPos.xz);
|
||||
dd.ddZ.zw = ddy(wPos.xy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the worldspace axis that the given mesh normal is most closely aligned to, and returns the coordinates of the
|
||||
* pixel in the plane aligned with that axis and the derivatives associated with that plane. Also generates a tangent to world
|
||||
* matrix using the axes orthogonal to the dominant axis as the tangent and bitangent.
|
||||
*
|
||||
* @param[out] triplanarUV Coordinates of the fragment in the plane aligned with the dominant axis
|
||||
* @param[out] ddxMax X derivatives of the coordinates of the fragment in the plane aligned with the dominant axis
|
||||
* @param[out] ddyMax Y derivatives of the coordinates of the fragment in the plane aligned with the dominant axis
|
||||
* @param[out] tanToWrld Tangent to world matrix composed of the other two axes as tangent and bitangent, and the mesh normal as the normal
|
||||
* @param wPos World-space position of the fragment
|
||||
* @param wNorm World-space mesh normal
|
||||
* @param dd derivatives of the fragment's coordinates in each axis aligned plane
|
||||
*/
|
||||
void GetTPUVExpensive(out float2 triplanarUV, out half2 ddxMax, out half2 ddyMax, out half3x3 tanToWrld, float3 wPos, half3 wNorm,
|
||||
tpDerivatives dd)
|
||||
{
|
||||
half3 dir;
|
||||
dir.x = abs(wNorm.x) > abs(wNorm.y) && abs(wNorm.x) > abs(wNorm.z) ? 1 : 0;
|
||||
dir.y = abs(wNorm.y) >= abs(wNorm.x) && abs(wNorm.y) > abs(wNorm.z) ? 1 : 0;
|
||||
dir.z = abs(wNorm.z) >= abs(wNorm.y) && abs(wNorm.z) >= abs(wNorm.x) ? 1 : 0;
|
||||
half3 dirSign = sign(wNorm);
|
||||
dirSign.z = -dirSign.z; // u should be flipped on Z
|
||||
ddxMax = dir.x * dd.ddX.xy + dir.y * dd.ddY.xy + dir.z * dd.ddZ.xy;
|
||||
ddyMax = dir.x * dd.ddX.zw + dir.y * dd.ddY.zw + dir.z * dd.ddZ.zw;
|
||||
//half3 maxDir = half3(dirX, dirY, dirZ);
|
||||
float2 uvX = wPos.zy * float2(dirSign.x, 1.0);
|
||||
triplanarUV = dir.x * uvX;
|
||||
float2 uvY = wPos.xz * float2(dirSign.y, 1.0);
|
||||
triplanarUV = mad(dir.y, uvY, triplanarUV);
|
||||
float2 uvZ = wPos.xy * float2(dirSign.z, 1.0);
|
||||
triplanarUV = mad(dir.z, uvZ, triplanarUV);
|
||||
|
||||
|
||||
tanToWrld = half3x3(
|
||||
dir.y * dirSign.y + dir.z * dirSign.z, 0, wNorm.x,
|
||||
0, dir.x + dir.z, wNorm.y,
|
||||
dir.x * dirSign.x, dir.y, wNorm.z
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void GetTPUVCheap(out float2 triplanarUV, out half3x3 tanToWrld, float3 wPos, half3 wNorm)
|
||||
{
|
||||
half3 dir;
|
||||
dir.x = abs(wNorm.x) > abs(wNorm.y) && abs(wNorm.x) > abs(wNorm.z) ? 1 : 0;
|
||||
dir.y = abs(wNorm.y) >= abs(wNorm.x) && abs(wNorm.y) > abs(wNorm.z) ? 1 : 0;
|
||||
dir.z = abs(wNorm.z) >= abs(wNorm.y) && abs(wNorm.z) >= abs(wNorm.x) ? 1 : 0;
|
||||
half3 dirSign = sign(wNorm);
|
||||
dirSign.z = -dirSign.z; // u should be flipped on Z
|
||||
//half3 maxDir = half3(dirX, dirY, dirZ);
|
||||
float2 uvX = wPos.zy * float2(dirSign.x, 1.0);
|
||||
triplanarUV = dir.x * uvX;
|
||||
float2 uvY = wPos.xz * float2(dirSign.y, 1.0);
|
||||
triplanarUV = mad(dir.y, uvY, triplanarUV);
|
||||
float2 uvZ = wPos.xy * float2(dirSign.z, 1.0);
|
||||
triplanarUV = mad(dir.z, uvZ, triplanarUV);
|
||||
|
||||
tanToWrld = half3x3(
|
||||
dir.y * dirSign.y + dir.z * dirSign.z, 0, wNorm.x,
|
||||
0, dir.x + dir.z, wNorm.y,
|
||||
dir.x * dirSign.x, dir.y, wNorm.z
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
7
Assets/SLZShaders/Include/Triplanar.hlsl.meta
Normal file
7
Assets/SLZShaders/Include/Triplanar.hlsl.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 225aec2e7a259b642a9fa1a4d10d7aac
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue