Flatkit 추가 및 설정
This commit is contained in:
8
Assets/FlatKit/Shaders/StylizedSurface/LibraryUrp.meta
Normal file
8
Assets/FlatKit/Shaders/StylizedSurface/LibraryUrp.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 118ff3e3b1cef4a79837b12635233239
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,282 @@
|
||||
#ifndef FLATKIT_LIGHTING_DR_INCLUDED
|
||||
#define FLATKIT_LIGHTING_DR_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
inline half NdotLTransition(half3 normal, half3 lightDir, half selfShadingSize, half shadowEdgeSize, half flatness) {
|
||||
const half NdotL = dot(normal, lightDir);
|
||||
const half angleDiff = saturate((NdotL * 0.5 + 0.5) - selfShadingSize);
|
||||
const half angleDiffTransition = smoothstep(0, shadowEdgeSize, angleDiff);
|
||||
return lerp(angleDiff, angleDiffTransition, flatness);
|
||||
}
|
||||
|
||||
inline half NdotLTransitionPrimary(half3 normal, half3 lightDir) {
|
||||
return NdotLTransition(normal, lightDir, _SelfShadingSize, _ShadowEdgeSize, _Flatness);
|
||||
}
|
||||
|
||||
#if defined(DR_CEL_EXTRA_ON)
|
||||
inline half NdotLTransitionExtra(half3 normal, half3 lightDir) {
|
||||
return NdotLTransition(normal, lightDir, _SelfShadingSizeExtra, _ShadowEdgeSizeExtra, _FlatnessExtra);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline half NdotLTransitionTexture(half3 normal, half3 lightDir, sampler2D stepTex) {
|
||||
const half NdotL = dot(normal, lightDir);
|
||||
const half angleDiff = saturate((NdotL * 0.5 + 0.5) - _SelfShadingSize * 0.0);
|
||||
const half4 rampColor = tex2D(stepTex, half2(angleDiff, 0.5));
|
||||
// NOTE: The color channel here corresponds to the texture format in the shader editor script.
|
||||
const half angleDiffTransition = rampColor.r;
|
||||
return angleDiffTransition;
|
||||
}
|
||||
|
||||
inline void ApplyLightToColor(Light light, inout half3 c) {
|
||||
#if defined(_UNITYSHADOWMODE_MULTIPLY)
|
||||
c *= lerp(1, light.shadowAttenuation, _UnityShadowPower);
|
||||
#endif
|
||||
#if defined(_UNITYSHADOWMODE_COLOR)
|
||||
c = lerp(lerp(c, _UnityShadowColor.rgb, _UnityShadowColor.a), c, light.shadowAttenuation);
|
||||
#endif
|
||||
|
||||
c.rgb *= light.color * light.distanceAttenuation;
|
||||
}
|
||||
|
||||
half3 LightingPhysicallyBased_DSTRM(Light light, InputData inputData)
|
||||
{
|
||||
// If all light in the scene is baked, we use custom light direction for the cel shading.
|
||||
#if defined(LIGHTMAP_ON)
|
||||
light.direction = _LightmapDirection;
|
||||
#else
|
||||
light.direction = lerp(light.direction, _LightmapDirection, _OverrideLightmapDir);
|
||||
#endif
|
||||
|
||||
half4 c = _BaseColor;
|
||||
|
||||
#if defined(_CELPRIMARYMODE_SINGLE)
|
||||
const half NdotLTPrimary = NdotLTransitionPrimary(inputData.normalWS, light.direction);
|
||||
c = lerp(_ColorDim, c, NdotLTPrimary);
|
||||
#endif // _CELPRIMARYMODE_SINGLE
|
||||
|
||||
#if defined(_CELPRIMARYMODE_STEPS)
|
||||
const half NdotLTSteps = NdotLTransitionTexture(inputData.normalWS, light.direction, _CelStepTexture);
|
||||
c = lerp(_ColorDimSteps, c, NdotLTSteps);
|
||||
#endif // _CELPRIMARYMODE_STEPS
|
||||
|
||||
#if defined(_CELPRIMARYMODE_CURVE)
|
||||
const half NdotLTCurve = NdotLTransitionTexture(inputData.normalWS, light.direction, _CelCurveTexture);
|
||||
c = lerp(_ColorDimCurve, c, NdotLTCurve);
|
||||
#endif // _CELPRIMARYMODE_CURVE
|
||||
|
||||
#if defined(DR_CEL_EXTRA_ON)
|
||||
const half NdotLTExtra = NdotLTransitionExtra(inputData.normalWS, light.direction);
|
||||
c = lerp(_ColorDimExtra, c, NdotLTExtra);
|
||||
#endif // DR_CEL_EXTRA_ON
|
||||
|
||||
#if defined(DR_GRADIENT_ON)
|
||||
const float angleRadians = _GradientAngle / 180.0 * PI;
|
||||
#if defined(_GRADIENTSPACE_WORLD)
|
||||
const float2 position = inputData.positionWS.xy;
|
||||
#else
|
||||
const float2 position = TransformWorldToObject(inputData.positionWS).xy;
|
||||
#endif
|
||||
const float posGradRotated = (position.x - _GradientCenterX) * sin(angleRadians) +
|
||||
(position.y - _GradientCenterY) * cos(angleRadians);
|
||||
const half gradientFactor = saturate((_GradientSize * 0.5 - posGradRotated) / _GradientSize);
|
||||
c = lerp(c, _ColorGradient, gradientFactor);
|
||||
#endif // DR_GRADIENT_ON
|
||||
|
||||
const half NdotL = dot(inputData.normalWS, light.direction);
|
||||
|
||||
#if defined(DR_RIM_ON)
|
||||
const float rim = 1.0 - dot(inputData.viewDirectionWS, inputData.normalWS);
|
||||
const float rimSpread = 1.0 - _FlatRimSize - NdotL * _FlatRimLightAlign;
|
||||
const float rimEdgeSmooth = _FlatRimEdgeSmoothness;
|
||||
const float rimTransition = smoothstep(rimSpread - rimEdgeSmooth * 0.5, rimSpread + rimEdgeSmooth * 0.5, rim);
|
||||
c.rgb = lerp(c.rgb, _FlatRimColor.rgb, rimTransition * _FlatRimColor.a);
|
||||
#endif // DR_RIM_ON
|
||||
|
||||
#if defined(DR_SPECULAR_ON)
|
||||
// Halfway between lighting direction and view vector.
|
||||
const float3 halfVector = normalize(light.direction + inputData.viewDirectionWS);
|
||||
const float NdotH = dot(inputData.normalWS, halfVector) * 0.5 + 0.5;
|
||||
const float specular = saturate(pow(abs(NdotH), 100.0 * (1.0 - _FlatSpecularSize) * (1.0 - _FlatSpecularSize)));
|
||||
const float specularTransition = smoothstep(0.5 - _FlatSpecularEdgeSmoothness * 0.1,
|
||||
0.5 + _FlatSpecularEdgeSmoothness * 0.1, specular);
|
||||
c = lerp(c, _FlatSpecularColor, specularTransition);
|
||||
#endif // DR_SPECULAR_ON
|
||||
|
||||
#if defined(_UNITYSHADOW_OCCLUSION)
|
||||
const float occludedAttenuation = smoothstep(0.25, 0.0, -min(NdotL, 0));
|
||||
light.shadowAttenuation *= occludedAttenuation;
|
||||
light.distanceAttenuation *= occludedAttenuation;
|
||||
#endif
|
||||
|
||||
ApplyLightToColor(light, c.rgb);
|
||||
return c.rgb;
|
||||
}
|
||||
|
||||
void StylizeLight(inout Light light)
|
||||
{
|
||||
const half shadowAttenuation = saturate(light.shadowAttenuation * _UnityShadowSharpness);
|
||||
light.shadowAttenuation = shadowAttenuation;
|
||||
|
||||
const float distanceAttenuation = smoothstep(0, _LightFalloffSize + 0.001, light.distanceAttenuation);
|
||||
light.distanceAttenuation = distanceAttenuation;
|
||||
|
||||
/*
|
||||
#if LIGHTMAP_ON
|
||||
const half3 lightColor = 0;
|
||||
#else
|
||||
*/
|
||||
const half3 lightColor = lerp(half3(1, 1, 1), light.color, _LightContribution);
|
||||
/*
|
||||
#endif
|
||||
*/
|
||||
light.color = lightColor;
|
||||
}
|
||||
|
||||
half4 UniversalFragment_DSTRM(InputData inputData, SurfaceData surfaceData, float2 uv)
|
||||
{
|
||||
const half4 shadowMask = CalculateShadowMask(inputData);
|
||||
|
||||
#if VERSION_GREATER_EQUAL(10, 0)
|
||||
Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, shadowMask);
|
||||
#else
|
||||
Light mainLight = GetMainLight(inputData.shadowCoord);
|
||||
#endif
|
||||
|
||||
#if UNITY_VERSION >= 202220
|
||||
uint meshRenderingLayers = GetMeshRenderingLayer();
|
||||
#elif VERSION_GREATER_EQUAL(12, 0)
|
||||
uint meshRenderingLayers = GetMeshRenderingLightLayer();
|
||||
#endif
|
||||
|
||||
#if LIGHTMAP_ON
|
||||
mainLight.distanceAttenuation = 1.0;
|
||||
#endif
|
||||
|
||||
StylizeLight(mainLight);
|
||||
|
||||
#if defined(_SCREEN_SPACE_OCCLUSION)
|
||||
AmbientOcclusionFactor aoFactor = GetScreenSpaceAmbientOcclusion(inputData.normalizedScreenSpaceUV);
|
||||
mainLight.color *= aoFactor.directAmbientOcclusion;
|
||||
inputData.bakedGI *= aoFactor.indirectAmbientOcclusion;
|
||||
#endif
|
||||
|
||||
MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, shadowMask);
|
||||
|
||||
// Apply Flat Kit stylizing to `inputData.bakedGI` (which is half3).
|
||||
#if LIGHTMAP_ON
|
||||
// Apply cel shading. Can also separate modes by `#if defined(_CELPRIMARYMODE_SINGLE)` etc.
|
||||
// length(inputData.bakedGI) can be replaced with inputData.bakedGI to use light map color more directly.
|
||||
/*
|
||||
float lighmapEdgeSize = saturate(_ShadowEdgeSize * 10.0);
|
||||
inputData.bakedGI = lerp(_ColorDim.rgb, _BaseColor.rgb,
|
||||
smoothstep(_SelfShadingSize - lighmapEdgeSize, _SelfShadingSize + lighmapEdgeSize, length(inputData.bakedGI)));
|
||||
|
||||
// Apply shadow modes
|
||||
#if defined(_UNITYSHADOWMODE_MULTIPLY)
|
||||
inputData.bakedGI = lerp(1, inputData.bakedGI, (1 - inputData.bakedGI) * _UnityShadowPower);
|
||||
#endif
|
||||
#if defined(_UNITYSHADOWMODE_COLOR)
|
||||
inputData.bakedGI = lerp(inputData.bakedGI, _UnityShadowColor.rgb, _UnityShadowColor.a * inputData.bakedGI);
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
||||
const half4 albedo = half4(surfaceData.albedo + surfaceData.emission, surfaceData.alpha);
|
||||
|
||||
const float2 detailUV = TRANSFORM_TEX(uv, _DetailMap);
|
||||
const half4 detail = SAMPLE_TEXTURE2D(_DetailMap, sampler_DetailMap, detailUV);
|
||||
|
||||
#if defined(_BASEMAP_PREMULTIPLY)
|
||||
const half3 brdf = albedo.rgb;
|
||||
#else
|
||||
const half3 brdf = _BaseColor.rgb;
|
||||
#endif
|
||||
|
||||
BRDFData brdfData;
|
||||
InitializeBRDFData(brdf, 1.0 - 1.0 / kDielectricSpec.a, 0, 0, surfaceData.alpha, brdfData);
|
||||
half3 color = GlobalIllumination(brdfData, inputData.bakedGI, 1.0, inputData.normalWS, inputData.viewDirectionWS);
|
||||
#if VERSION_GREATER_EQUAL(12, 0)
|
||||
#ifdef _LIGHT_LAYERS
|
||||
if (IsMatchingLightLayer(mainLight.layerMask, meshRenderingLayers))
|
||||
#endif
|
||||
#endif
|
||||
color += LightingPhysicallyBased_DSTRM(mainLight, inputData);
|
||||
|
||||
#if defined(_ADDITIONAL_LIGHTS)
|
||||
uint pixelLightCount = GetAdditionalLightsCount();
|
||||
|
||||
#if USE_FORWARD_PLUS
|
||||
for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
|
||||
{
|
||||
FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
|
||||
|
||||
Light light = GetAdditionalLight(lightIndex, inputData.positionWS, shadowMask);//, aoFactor);
|
||||
StylizeLight(light);
|
||||
|
||||
#ifdef _LIGHT_LAYERS
|
||||
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
#endif
|
||||
{
|
||||
color += LightingPhysicallyBased_DSTRM(light, inputData);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LIGHT_LOOP_BEGIN(pixelLightCount)
|
||||
Light light = GetAdditionalLight(lightIndex, inputData.positionWS, shadowMask);//, aoFactor);
|
||||
StylizeLight(light);
|
||||
|
||||
#ifdef _LIGHT_LAYERS
|
||||
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
#endif
|
||||
{
|
||||
color += LightingPhysicallyBased_DSTRM(light, inputData);
|
||||
}
|
||||
LIGHT_LOOP_END
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
color += inputData.vertexLighting * brdfData.diffuse;
|
||||
#endif
|
||||
|
||||
// Base map.
|
||||
{
|
||||
#if defined(_TEXTUREBLENDINGMODE_ADD)
|
||||
color += lerp(half3(0.0f, 0.0f, 0.0f), albedo.rgb, _TextureImpact);
|
||||
#else // _TEXTUREBLENDINGMODE_MULTIPLY
|
||||
color *= lerp(half3(1.0f, 1.0f, 1.0f), albedo.rgb, _TextureImpact);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Detail map.
|
||||
{
|
||||
#if defined(_DETAILMAPBLENDINGMODE_ADD)
|
||||
color += lerp(0, _DetailMapColor.rgb, detail.rgb * _DetailMapImpact).rgb;
|
||||
#endif
|
||||
#if defined(_DETAILMAPBLENDINGMODE_MULTIPLY)
|
||||
// color *= lerp(1, _DetailMapColor.rgb, detail.rgb * _DetailMapImpact).rgb;
|
||||
color *= lerp(1, detail.rgb * _DetailMapColor.rgb, _DetailMapImpact).rgb;
|
||||
#endif
|
||||
#if defined(_DETAILMAPBLENDINGMODE_INTERPOLATE)
|
||||
color = lerp(color, detail.rgb, _DetailMapImpact * _DetailMapColor.rgb * detail.a).rgb;
|
||||
#endif
|
||||
}
|
||||
|
||||
color += surfaceData.emission;
|
||||
|
||||
#ifdef _DBUFFER
|
||||
// Modified `DBuffer.hlsl` function `ApplyDecalToBaseColor` to use light attenuation.
|
||||
FETCH_DBUFFER(DBuffer, _DBufferTexture, int2(inputData.positionCS.xy));
|
||||
DecalSurfaceData decalSurfaceData;
|
||||
DECODE_FROM_DBUFFER(DBuffer, decalSurfaceData);
|
||||
half3 decalColor = decalSurfaceData.baseColor.xyz;
|
||||
ApplyLightToColor(mainLight, decalColor);
|
||||
color.xyz = color.xyz * decalSurfaceData.baseColor.w + decalColor;
|
||||
#endif
|
||||
|
||||
return half4(color, surfaceData.alpha);
|
||||
}
|
||||
|
||||
#endif // FLATKIT_LIGHTING_DR_INCLUDED
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d645ee52b3eb44f2dacb6784216d7712
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,279 @@
|
||||
#ifndef FLATKIT_LIGHT_PASS_DR_INCLUDED
|
||||
#define FLATKIT_LIGHT_PASS_DR_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
// Check is needed because in Unity 2021 they use two different URP versions - 14 on desktop and 12 on mobile.
|
||||
#if !VERSION_LOWER(13, 0)
|
||||
#if defined(LOD_FADE_CROSSFADE)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
|
||||
#endif
|
||||
#endif
|
||||
#include "Lighting_DR.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float3 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float2 staticLightmapUV : TEXCOORD1;
|
||||
float2 dynamicLightmapUV : TEXCOORD2;
|
||||
|
||||
#if defined(DR_VERTEX_COLORS_ON)
|
||||
float4 color : COLOR;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
|
||||
float3 positionWS : TEXCOORD1; // xyz: posWS
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
float4 normalWS : TEXCOORD2; // xyz: normal, w: viewDir.x
|
||||
float4 tangentWS : TEXCOORD3; // xyz: tangent, w: viewDir.y
|
||||
float4 bitangentWS : TEXCOORD4; // xyz: bitangent, w: viewDir.z
|
||||
#else
|
||||
float3 normalWS : TEXCOORD2;
|
||||
float3 viewDir : TEXCOORD3;
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half4 fogFactorAndVertexLight : TEXCOORD5; // x: fogFactor, yzw: vertex light
|
||||
#else
|
||||
half fogFactor : TEXCOORD5;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD6;
|
||||
#endif
|
||||
|
||||
DECLARE_LIGHTMAP_OR_SH(staticLightmapUV, vertexSH, 7);
|
||||
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD8; // Dynamic lightmap UVs
|
||||
#endif
|
||||
|
||||
float4 positionCS : SV_POSITION;
|
||||
|
||||
#if defined(DR_VERTEX_COLORS_ON)
|
||||
float4 VertexColor : COLOR;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
/// ---------------------------------------------------------------------------
|
||||
// Library/PackageCache/com.unity.render-pipelines.universal@16.0.5/Shaders/SimpleLitForwardPass.hlsl
|
||||
void InitializeInputData_DR(Varyings input, half3 normalTS, out InputData inputData)
|
||||
{
|
||||
inputData = (InputData)0;
|
||||
|
||||
inputData.positionWS = input.positionWS;
|
||||
inputData.positionCS = input.positionCS;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
half3 viewDirWS = half3(input.normalWS.w, input.tangentWS.w, input.bitangentWS.w);
|
||||
#if VERSION_GREATER_EQUAL(12, 0)
|
||||
inputData.tangentToWorld = half3x3(input.tangentWS.xyz, input.bitangentWS.xyz, input.normalWS.xyz);
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS, inputData.tangentToWorld);
|
||||
#else
|
||||
float sgn = input.tangentWS.w; // should be either +1 or -1
|
||||
float3 bitangent = sgn * cross(input.normalWS.xyz, input.tangentWS.xyz);
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS, half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz));
|
||||
#endif
|
||||
#else
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(inputData.positionWS);
|
||||
inputData.normalWS = input.normalWS;
|
||||
#endif
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
viewDirWS = SafeNormalize(viewDirWS);
|
||||
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
#if VERSION_GREATER_EQUAL(12, 0)
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(inputData.positionWS, 1.0), input.fogFactor);
|
||||
#endif
|
||||
inputData.vertexLighting = half3(0, 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
|
||||
#elif !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
|
||||
|
||||
#if UNITY_VERSION >= 60000012
|
||||
inputData.bakedGI = SAMPLE_GI(input.vertexSH,
|
||||
GetAbsolutePositionWS(inputData.positionWS),
|
||||
inputData.normalWS,
|
||||
inputData.viewDirectionWS,
|
||||
input.positionCS.xy,
|
||||
/* probeOcclusion */ 0,
|
||||
inputData.shadowMask);
|
||||
#else // UNITY_VERSION >= 60000012
|
||||
inputData.bakedGI = SAMPLE_GI(input.vertexSH,
|
||||
GetAbsolutePositionWS(inputData.positionWS),
|
||||
inputData.normalWS,
|
||||
inputData.viewDirectionWS,
|
||||
input.positionCS.xy
|
||||
);
|
||||
#endif // UNITY_VERSION >= 60000012
|
||||
|
||||
#else // !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
|
||||
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
|
||||
#endif // !defined(LIGHTMAP_ON) && (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))
|
||||
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
|
||||
#if defined(DEBUG_DISPLAY)
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
|
||||
#endif
|
||||
#if defined(LIGHTMAP_ON)
|
||||
inputData.staticLightmapUV = input.staticLightmapUV;
|
||||
#else
|
||||
inputData.vertexSH = input.vertexSH;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Varyings StylizedPassVertex(Attributes input)
|
||||
{
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
#ifdef CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
CURVEDWORLD_TRANSFORM_VERTEX_AND_NORMAL(input.positionOS, input.normalOS, input.tangentOS)
|
||||
#else
|
||||
CURVEDWORLD_TRANSFORM_VERTEX(input.positionOS)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
const VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS, input.tangentOS);
|
||||
|
||||
#if defined(_FOG_FRAGMENT)
|
||||
half fogFactor = 0;
|
||||
#else
|
||||
half fogFactor = ComputeFogFactor(vertexInput.positionCS.z);
|
||||
#endif
|
||||
|
||||
output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
|
||||
output.positionWS.xyz = vertexInput.positionWS;
|
||||
output.positionCS = vertexInput.positionCS;
|
||||
|
||||
half3 viewDirWS = GetCameraPositionWS() - vertexInput.positionWS;
|
||||
|
||||
#ifdef _NORMALMAP
|
||||
output.normalWS = half4(normalInput.normalWS, viewDirWS.x);
|
||||
output.tangentWS = half4(normalInput.tangentWS, viewDirWS.y);
|
||||
output.bitangentWS = half4(normalInput.bitangentWS, viewDirWS.z);
|
||||
#else
|
||||
output.normal = NormalizeNormalPerVertex(normalInput.normalWS);
|
||||
output.viewDir = viewDirWS;
|
||||
#endif
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(input.staticLightmapUV, unity_LightmapST, output.staticLightmapUV);
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
|
||||
#endif
|
||||
|
||||
#if UNITY_VERSION >= 60000010
|
||||
float4 probeOcclusion;
|
||||
OUTPUT_SH4(vertexInput.positionWS, output.normalWS.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), output.vertexSH, probeOcclusion);
|
||||
#elif UNITY_VERSION >= 202317
|
||||
OUTPUT_SH4(vertexInput.positionWS, output.normalWS.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), output.vertexSH);
|
||||
#elif UNITY_VERSION >= 202310
|
||||
OUTPUT_SH(vertexInput.positionWS, output.normalWS.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), output.vertexSH);
|
||||
#else
|
||||
OUTPUT_SH(output.normalWS.xyz, output.vertexSH);
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half3 vertexLight = VertexLighting(vertexInput.positionWS, normalInput.normalWS);
|
||||
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
#else
|
||||
output.fogFactor = fogFactor;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
output.shadowCoord = GetShadowCoord(vertexInput);
|
||||
#endif
|
||||
|
||||
#if defined(DR_VERTEX_COLORS_ON)
|
||||
output.VertexColor = input.color;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 StylizedPassFragment(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
SurfaceData surfaceData;
|
||||
InitializeSimpleLitSurfaceData(input.uv, surfaceData);
|
||||
|
||||
#if defined(LOD_FADE_CROSSFADE) && !VERSION_LOWER(13, 0)
|
||||
LODFadeCrossFade(input.positionCS);
|
||||
#endif
|
||||
|
||||
InputData inputData;
|
||||
InitializeInputData_DR(input, surfaceData.normalTS, inputData);
|
||||
#if UNITY_VERSION >= 202330
|
||||
SETUP_DEBUG_TEXTURE_DATA(inputData, input.uv);
|
||||
#elif UNITY_VERSION >= 202210
|
||||
SETUP_DEBUG_TEXTURE_DATA(inputData, input.uv, _BaseMap);
|
||||
#endif
|
||||
|
||||
// Apply vertex color before shading (default behavior). Remove the #if block and uncomment below to apply after
|
||||
// shading.
|
||||
#if defined(DR_VERTEX_COLORS_ON)
|
||||
_BaseColor.rgb *= input.VertexColor.rgb;
|
||||
#endif
|
||||
|
||||
// Computes direct light contribution.
|
||||
half4 color = UniversalFragment_DSTRM(inputData, surfaceData, input.uv);
|
||||
|
||||
/*
|
||||
#if defined(DR_VERTEX_COLORS_ON)
|
||||
color.rgb *= input.VertexColor.rgb;
|
||||
#endif
|
||||
*/
|
||||
|
||||
color.rgb = MixFog(color.rgb, inputData.fogCoord);
|
||||
#if UNITY_VERSION >= 202220
|
||||
color.a = OutputAlpha(color.a, IsSurfaceTypeTransparent(_Surface));
|
||||
#else
|
||||
color.a = OutputAlpha(color.a, _Surface);
|
||||
#endif
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
#endif // FLATKIT_LIGHT_PASS_DR_INCLUDED
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2126186b3a4f84079b81ce8d14b60126
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,215 @@
|
||||
#ifndef FLAT_KIT_STYLIZED_INPUT_INCLUDED
|
||||
#define FLAT_KIT_STYLIZED_INPUT_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
|
||||
|
||||
// NOTE: Do not ifdef the properties here as SRP batcher can not handle different layouts.
|
||||
|
||||
#ifndef FLATKIT_TERRAIN
|
||||
#if _FORWARD_PLUS && UNITY_VERSION < 600000
|
||||
CBUFFER_START(UnityPerMaterialNoBatching)
|
||||
#else
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// See `SimpleLitInput.hlsl` and `LitInput.hlsl` for reference
|
||||
|
||||
float4 _BaseMap_ST;
|
||||
float4 _DetailMap_ST;
|
||||
|
||||
#ifndef FLATKIT_TERRAIN
|
||||
half4 _BaseColor;
|
||||
half _Cutoff;
|
||||
half _Surface;
|
||||
#endif
|
||||
|
||||
half4 _EmissionColor;
|
||||
half4 _UnityShadowColor;
|
||||
|
||||
// --- _CELPRIMARYMODE_SINGLE
|
||||
half4 _ColorDim;
|
||||
// --- _CELPRIMARYMODE_SINGLE
|
||||
|
||||
// --- DR_SPECULAR_ON
|
||||
half4 _FlatSpecularColor;
|
||||
float _FlatSpecularSize;
|
||||
float _FlatSpecularEdgeSmoothness;
|
||||
// --- DR_SPECULAR_ON
|
||||
|
||||
// --- DR_RIM_ON
|
||||
half4 _FlatRimColor;
|
||||
float _FlatRimSize;
|
||||
float _FlatRimEdgeSmoothness;
|
||||
float _FlatRimLightAlign;
|
||||
// --- DR_RIM_ON
|
||||
|
||||
// --- _CELPRIMARYMODE_STEPS
|
||||
half4 _ColorDimSteps;
|
||||
sampler2D _CelStepTexture;
|
||||
// --- _CELPRIMARYMODE_STEPS
|
||||
|
||||
// --- _CELPRIMARYMODE_CURVE
|
||||
half4 _ColorDimCurve;
|
||||
sampler2D _CelCurveTexture;
|
||||
// --- _CELPRIMARYMODE_CURVE
|
||||
|
||||
// --- DR_CEL_EXTRA_ON
|
||||
half4 _ColorDimExtra;
|
||||
half _SelfShadingSizeExtra;
|
||||
half _ShadowEdgeSizeExtra;
|
||||
half _FlatnessExtra;
|
||||
// --- DR_CEL_EXTRA_ON
|
||||
|
||||
// --- DR_GRADIENT_ON
|
||||
half4 _ColorGradient;
|
||||
half _GradientCenterX;
|
||||
half _GradientCenterY;
|
||||
half _GradientSize;
|
||||
half _GradientAngle;
|
||||
// --- DR_GRADIENT_ON
|
||||
|
||||
half _TextureImpact;
|
||||
|
||||
half _SelfShadingSize;
|
||||
half _ShadowEdgeSize;
|
||||
half _LightContribution;
|
||||
half _LightFalloffSize;
|
||||
half _Flatness;
|
||||
|
||||
half _UnityShadowPower;
|
||||
half _UnityShadowSharpness;
|
||||
|
||||
half _OverrideLightmapDir;
|
||||
half3 _LightmapDirection;
|
||||
|
||||
half _DetailMapImpact;
|
||||
half4 _DetailMapColor;
|
||||
|
||||
half4 _OutlineColor;
|
||||
half _OutlineWidth;
|
||||
half _OutlineScale;
|
||||
half _OutlineDepthOffset;
|
||||
half _CameraDistanceImpact;
|
||||
|
||||
#ifndef FLATKIT_TERRAIN
|
||||
CBUFFER_END
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_DOTS_INSTANCING_ENABLED
|
||||
UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _BaseColor)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _Cutoff)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _Surface)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _EmissionColor)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4 , _UnityShadowColor)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _ColorDim)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _FlatSpecularColor)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _FlatSpecularSize)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _FlatSpecularEdgeSmoothness)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _FlatRimColor)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _FlatRimSize)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _FlatRimEdgeSmoothness)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _FlatRimLightAlign)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _ColorDimSteps)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _ColorDimCurve)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _ColorDimExtra)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _SelfShadingSizeExtra)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _ShadowEdgeSizeExtra)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _FlatnessExtra)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _ColorGradient)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _GradientCenterX)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _GradientCenterY)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _GradientSize)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _GradientAngle)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _TextureImpact)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _SelfShadingSize)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _ShadowEdgeSize)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _LightContribution)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _LightFalloffSize)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _Flatness)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _UnityShadowPower)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _UnityShadowSharpness)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _OverrideLightmapDir)
|
||||
UNITY_DOTS_INSTANCED_PROP(float3, _LightmapDirection)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _DetailMapImpact)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _DetailMapColor)
|
||||
UNITY_DOTS_INSTANCED_PROP(float4, _OutlineColor)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _OutlineWidth)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _OutlineScale)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _OutlineDepthOffset)
|
||||
UNITY_DOTS_INSTANCED_PROP(float , _CameraDistanceImpact)
|
||||
UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)
|
||||
|
||||
#define _BaseColor UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _BaseColor)
|
||||
#define _Cutoff UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _Cutoff)
|
||||
#define _Surface UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _Surface)
|
||||
#define _EmissionColor UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _EmissionColor)
|
||||
#define _UnityShadowColor UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _UnityShadowColor)
|
||||
#define _ColorDim UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _ColorDim)
|
||||
#define _FlatSpecularColor UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _FlatSpecularColor)
|
||||
#define _FlatSpecularSize UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _FlatSpecularSize)
|
||||
#define _FlatSpecularEdgeSmoothness UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _FlatSpecularEdgeSmoothness)
|
||||
#define _FlatRimColor UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _FlatRimColor)
|
||||
#define _FlatRimSize UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _FlatRimSize)
|
||||
#define _FlatRimEdgeSmoothness UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _FlatRimEdgeSmoothness)
|
||||
#define _FlatRimLightAlign UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _FlatRimLightAlign)
|
||||
#define _ColorDimSteps UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _ColorDimSteps)
|
||||
#define _ColorDimCurve UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _ColorDimCurve)
|
||||
#define _ColorDimExtra UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _ColorDimExtra)
|
||||
#define _SelfShadingSizeExtra UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _SelfShadingSizeExtra)
|
||||
#define _ShadowEdgeSizeExtra UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _ShadowEdgeSizeExtra)
|
||||
#define _FlatnessExtra UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _FlatnessExtra)
|
||||
#define _ColorGradient UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _ColorGradient)
|
||||
#define _GradientCenterX UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _GradientCenterX)
|
||||
#define _GradientCenterY UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _GradientCenterY)
|
||||
#define _GradientSize UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _GradientSize)
|
||||
#define _GradientAngle UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _GradientAngle)
|
||||
#define _TextureImpact UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _TextureImpact)
|
||||
#define _SelfShadingSize UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _SelfShadingSize)
|
||||
#define _ShadowEdgeSize UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _ShadowEdgeSize)
|
||||
#define _LightContribution UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _LightContribution)
|
||||
#define _LightFalloffSize UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _LightFalloffSize)
|
||||
#define _Flatness UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _Flatness)
|
||||
#define _UnityShadowPower UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _UnityShadowPower)
|
||||
#define _UnityShadowSharpness UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _UnityShadowSharpness)
|
||||
#define _OverrideLightmapDir UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _OverrideLightmapDir)
|
||||
#define _LightmapDirection UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float3 , _LightmapDirection)
|
||||
#define _DetailMapImpact UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _DetailMapImpact)
|
||||
#define _DetailMapColor UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _DetailMapColor)
|
||||
#define _OutlineColor UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _OutlineColor)
|
||||
#define _OutlineWidth UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _OutlineWidth)
|
||||
#define _OutlineScale UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _OutlineScale)
|
||||
#define _OutlineDepthOffset UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _OutlineDepthOffset)
|
||||
#define _CameraDistanceImpact UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _CameraDistanceImpact)
|
||||
#endif
|
||||
|
||||
inline void InitializeSimpleLitSurfaceData(float2 uv, out SurfaceData outSurfaceData)
|
||||
{
|
||||
outSurfaceData = (SurfaceData)0;
|
||||
|
||||
half4 albedo = SampleAlbedoAlpha(uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
|
||||
outSurfaceData.alpha = albedo.a * _BaseColor.a;
|
||||
AlphaDiscard(outSurfaceData.alpha, _Cutoff);
|
||||
|
||||
outSurfaceData.albedo = albedo.rgb;
|
||||
#ifdef _ALPHAPREMULTIPLY_ON
|
||||
outSurfaceData.albedo *= outSurfaceData.alpha;
|
||||
#endif
|
||||
|
||||
outSurfaceData.metallic = 0.0; // unused
|
||||
outSurfaceData.specular = 0.0; // unused
|
||||
outSurfaceData.smoothness = 0.0; // unused
|
||||
outSurfaceData.normalTS = SampleNormal(uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap));
|
||||
outSurfaceData.occlusion = 1.0; // unused
|
||||
outSurfaceData.emission = SampleEmission(uv, _EmissionColor.rgb, TEXTURE2D_ARGS(_EmissionMap, sampler_EmissionMap));
|
||||
}
|
||||
|
||||
half4 SampleSpecularSmoothness(half2 uv, half alpha, half4 specColor, TEXTURE2D_PARAM(specMap, sampler_specMap))
|
||||
{
|
||||
half4 specularSmoothness = half4(0.0h, 0.0h, 0.0h, 1.0h);
|
||||
return specularSmoothness;
|
||||
}
|
||||
|
||||
#endif // FLAT_KIT_STYLIZED_INPUT_INCLUDED
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3d750baac0e54925a4ad89a109d7561
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,154 @@
|
||||
#ifndef FLATKIT_TERRAIN_LIT_PASSES_DR_INCLUDED
|
||||
#define FLATKIT_TERRAIN_LIT_PASSES_DR_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitPasses.hlsl"
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
|
||||
#ifdef TERRAIN_GBUFFER
|
||||
FragmentOutput SplatmapFragment_DSTRM(Varyings IN)
|
||||
#else
|
||||
half4 SplatmapFragment_DSTRM(Varyings IN) : SV_TARGET
|
||||
#endif
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
|
||||
#ifdef _ALPHATEST_ON
|
||||
ClipHoles(IN.uvMainAndLM.xy);
|
||||
#endif
|
||||
|
||||
half3 normalTS = half3(0.0h, 0.0h, 1.0h);
|
||||
#ifdef TERRAIN_SPLAT_BASEPASS
|
||||
half3 albedo = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uvMainAndLM.xy).rgb;
|
||||
half smoothness = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, IN.uvMainAndLM.xy).a;
|
||||
half metallic = SAMPLE_TEXTURE2D(_MetallicTex, sampler_MetallicTex, IN.uvMainAndLM.xy).r;
|
||||
half alpha = 1;
|
||||
half occlusion = 1;
|
||||
#else
|
||||
|
||||
half4 hasMask = half4(_LayerHasMask0, _LayerHasMask1, _LayerHasMask2, _LayerHasMask3);
|
||||
half4 masks[4];
|
||||
ComputeMasks(masks, hasMask, IN);
|
||||
|
||||
float2 splatUV = (IN.uvMainAndLM.xy * (_Control_TexelSize.zw - 1.0f) + 0.5f) * _Control_TexelSize.xy;
|
||||
half4 splatControl = SAMPLE_TEXTURE2D(_Control, sampler_Control, splatUV);
|
||||
|
||||
#ifdef _TERRAIN_BLEND_HEIGHT
|
||||
// disable Height Based blend when there are more than 4 layers (multi-pass breaks the normalization)
|
||||
if (_NumLayersCount <= 4)
|
||||
HeightBasedSplatModify(splatControl, masks);
|
||||
#endif
|
||||
|
||||
half weight;
|
||||
half4 mixedDiffuse;
|
||||
half4 defaultSmoothness;
|
||||
SplatmapMix(IN.uvMainAndLM, IN.uvSplat01, IN.uvSplat23, splatControl, weight, mixedDiffuse, defaultSmoothness, normalTS);
|
||||
half3 albedo = mixedDiffuse.rgb;
|
||||
|
||||
half4 defaultMetallic = half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3);
|
||||
half4 defaultOcclusion = half4(_MaskMapRemapScale0.g, _MaskMapRemapScale1.g, _MaskMapRemapScale2.g, _MaskMapRemapScale3.g) +
|
||||
half4(_MaskMapRemapOffset0.g, _MaskMapRemapOffset1.g, _MaskMapRemapOffset2.g, _MaskMapRemapOffset3.g);
|
||||
|
||||
half4 maskSmoothness = half4(masks[0].a, masks[1].a, masks[2].a, masks[3].a);
|
||||
defaultSmoothness = lerp(defaultSmoothness, maskSmoothness, hasMask);
|
||||
half smoothness = dot(splatControl, defaultSmoothness);
|
||||
|
||||
half4 maskMetallic = half4(masks[0].r, masks[1].r, masks[2].r, masks[3].r);
|
||||
defaultMetallic = lerp(defaultMetallic, maskMetallic, hasMask);
|
||||
half metallic = dot(splatControl, defaultMetallic);
|
||||
|
||||
half4 maskOcclusion = half4(masks[0].g, masks[1].g, masks[2].g, masks[3].g);
|
||||
defaultOcclusion = lerp(defaultOcclusion, maskOcclusion, hasMask);
|
||||
half occlusion = dot(splatControl, defaultOcclusion);
|
||||
half alpha = weight;
|
||||
#endif
|
||||
|
||||
InputData inputData;
|
||||
InitializeInputData(IN, normalTS, inputData);
|
||||
|
||||
// If lightmap is enabled, flip the normal if the lightmap is flipped.
|
||||
/*
|
||||
#if defined(LIGHTMAP_ON)
|
||||
const half lightmapWorkaroundFlip = -1.0;
|
||||
inputData.normalWS = lightmapWorkaroundFlip * inputData.normalWS;
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if UNITY_VERSION > 202340
|
||||
SETUP_DEBUG_TEXTURE_DATA_FOR_TEX(inputData, IN.uvMainAndLM.xy, _BaseMap);
|
||||
#elif VERSION_GREATER_EQUAL(12, 1)
|
||||
SETUP_DEBUG_TEXTURE_DATA(inputData, IN.uvMainAndLM.xy, _BaseMap);
|
||||
#endif
|
||||
|
||||
#if defined(_DBUFFER)
|
||||
half3 specular = half3(0.0h, 0.0h, 0.0h);
|
||||
ApplyDecal(IN.clipPos,
|
||||
albedo,
|
||||
specular,
|
||||
inputData.normalWS,
|
||||
metallic,
|
||||
occlusion,
|
||||
smoothness);
|
||||
#endif
|
||||
|
||||
#if UNITY_VERSION > 60000012 // Minor version not precise, somewhere between 6.0.4 and 6.0.23.
|
||||
InitializeBakedGIData(IN, inputData);
|
||||
#endif
|
||||
|
||||
#ifdef TERRAIN_GBUFFER
|
||||
|
||||
BRDFData brdfData;
|
||||
InitializeBRDFData(albedo, metallic, /* specular */ half3(0.0h, 0.0h, 0.0h), smoothness, alpha, brdfData);
|
||||
|
||||
half4 color;
|
||||
color.rgb = GlobalIllumination(brdfData, inputData.bakedGI, occlusion, inputData.normalWS, inputData.viewDirectionWS);
|
||||
color.a = alpha;
|
||||
|
||||
SplatmapFinalColor(color, inputData.fogCoord);
|
||||
|
||||
return BRDFDataToGbuffer(brdfData, inputData, smoothness, color.rgb);
|
||||
|
||||
#else
|
||||
{
|
||||
_BaseColor.rgb *= albedo;
|
||||
|
||||
#ifdef _CELPRIMARYMODE_SINGLE
|
||||
_ColorDim.rgb *= albedo;
|
||||
#endif
|
||||
|
||||
#ifdef _CELPRIMARYMODE_STEPS
|
||||
_ColorDimSteps.rgb *= albedo;
|
||||
#endif
|
||||
|
||||
#ifdef _CELPRIMARYMODE_CURVE
|
||||
_ColorDimCurve.rgb *= albedo;
|
||||
#endif
|
||||
|
||||
#ifdef DR_CEL_EXTRA_ON
|
||||
_ColorDimExtra.rgb *= albedo;
|
||||
#endif
|
||||
|
||||
#ifdef DR_GRADIENT_ON
|
||||
_ColorGradient.rgb *= albedo;
|
||||
#endif
|
||||
}
|
||||
|
||||
SurfaceData surfaceData;
|
||||
surfaceData.albedo = albedo;
|
||||
surfaceData.alpha = alpha;
|
||||
surfaceData.emission = 0;
|
||||
surfaceData.specular = 0;
|
||||
surfaceData.smoothness = smoothness;
|
||||
surfaceData.metallic = metallic;
|
||||
surfaceData.occlusion = occlusion;
|
||||
surfaceData.normalTS = normalTS;
|
||||
surfaceData.clearCoatMask = 0;
|
||||
surfaceData.clearCoatSmoothness = 0;
|
||||
|
||||
half4 color = UniversalFragment_DSTRM(inputData, surfaceData, IN.uvMainAndLM.xy);
|
||||
|
||||
SplatmapFinalColor(color, inputData.fogCoord);
|
||||
|
||||
return half4(color.rgb, 1.0h);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // FLATKIT_TERRAIN_LIT_PASSES_DR_INCLUDED
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5217ff6887a39405aa992142275ec2c0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
640
Assets/FlatKit/Shaders/StylizedSurface/StylizedSurface.shader
Normal file
640
Assets/FlatKit/Shaders/StylizedSurface/StylizedSurface.shader
Normal file
@@ -0,0 +1,640 @@
|
||||
Shader "FlatKit/Stylized Surface"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[MainColor] _BaseColor ("Color", Color) = (1,1,1,1)
|
||||
|
||||
[KeywordEnum(None, Single, Steps, Curve)]_CelPrimaryMode("Cel Shading Mode", Float) = 1
|
||||
_ColorDim ("[_CELPRIMARYMODE_SINGLE]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_ColorDimSteps ("[_CELPRIMARYMODE_STEPS]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_ColorDimCurve ("[_CELPRIMARYMODE_CURVE]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_SelfShadingSize ("[_CELPRIMARYMODE_SINGLE]Self Shading Size", Range(0, 1)) = 0.5
|
||||
_ShadowEdgeSize ("[_CELPRIMARYMODE_SINGLE]Edge Size", Range(0, 0.5)) = 0.05
|
||||
_Flatness ("[_CELPRIMARYMODE_SINGLE]Localized Shading", Range(0, 1)) = 1.0
|
||||
|
||||
[IntRange]_CelNumSteps ("[_CELPRIMARYMODE_STEPS]Number Of Steps", Range(1, 10)) = 3.0
|
||||
_CelStepTexture ("[_CELPRIMARYMODE_STEPS][LAST_PROP_STEPS]Cel steps", 2D) = "black" {}
|
||||
_CelCurveTexture ("[_CELPRIMARYMODE_CURVE][LAST_PROP_CURVE]Ramp", 2D) = "black" {}
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_CEL_EXTRA_ON)] _CelExtraEnabled("Enable Extra Cel Layer", Int) = 0
|
||||
_ColorDimExtra ("[DR_CEL_EXTRA_ON]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_SelfShadingSizeExtra ("[DR_CEL_EXTRA_ON]Self Shading Size", Range(0, 1)) = 0.6
|
||||
_ShadowEdgeSizeExtra ("[DR_CEL_EXTRA_ON]Edge Size", Range(0, 0.5)) = 0.05
|
||||
_FlatnessExtra ("[DR_CEL_EXTRA_ON]Localized Shading", Range(0, 1)) = 1.0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_SPECULAR_ON)] _SpecularEnabled("Enable Specular", Int) = 0
|
||||
[HDR] _FlatSpecularColor("[DR_SPECULAR_ON]Specular Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_FlatSpecularSize("[DR_SPECULAR_ON]Specular Size", Range(0.0, 1.0)) = 0.1
|
||||
_FlatSpecularEdgeSmoothness("[DR_SPECULAR_ON]Specular Edge Smoothness", Range(0.0, 1.0)) = 0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_RIM_ON)] _RimEnabled("Enable Rim", Int) = 0
|
||||
[HDR] _FlatRimColor("[DR_RIM_ON]Rim Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_FlatRimLightAlign("[DR_RIM_ON]Light Align", Range(0.0, 1.0)) = 0
|
||||
_FlatRimSize("[DR_RIM_ON]Rim Size", Range(0, 1)) = 0.5
|
||||
_FlatRimEdgeSmoothness("[DR_RIM_ON]Rim Edge Smoothness", Range(0, 1)) = 0.5
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_GRADIENT_ON)] _GradientEnabled("Enable Height Gradient", Int) = 0
|
||||
[HDR] _ColorGradient("[DR_GRADIENT_ON]Gradient Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
[KeywordEnum(World, Local)]_GradientSpace("[DR_GRADIENT_ON]Space", Float) = 0
|
||||
_GradientCenterX("[DR_GRADIENT_ON]Center X", Float) = 0
|
||||
_GradientCenterY("[DR_GRADIENT_ON]Center Y", Float) = 0
|
||||
_GradientSize("[DR_GRADIENT_ON]Size", Float) = 10.0
|
||||
_GradientAngle("[DR_GRADIENT_ON]Gradient Angle", Range(0, 360)) = 0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_OUTLINE_ON)] _OutlineEnabled("Enable Outline", Int) = 0
|
||||
_OutlineWidth("[DR_OUTLINE_ON]Width", Float) = 1.0
|
||||
_OutlineColor("[DR_OUTLINE_ON]Color", Color) = (1, 1, 1, 1)
|
||||
_OutlineScale("[DR_OUTLINE_ON]Scale", Float) = 1.0
|
||||
[Toggle(DR_OUTLINE_SMOOTH_NORMALS)] _VertexExtrusionSmoothNormals("[DR_OUTLINE_ON]Smooth Normals", Float) = 0.0
|
||||
_OutlineDepthOffset("[DR_OUTLINE_ON]Depth Offset", Range(0, 1)) = 0.0
|
||||
[KeywordEnum(Screen, Object)] _OutlineSpace("[DR_OUTLINE_ON]Space", Float) = 0.0
|
||||
_CameraDistanceImpact("[DR_OUTLINE_ON][_OUTLINESPACE_SCREEN]Camera Distance Impact", Range(0, 1)) = 0.0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_VERTEX_COLORS_ON)] _VertexColorsEnabled("Enable Vertex Colors", Int) = 0
|
||||
|
||||
_LightContribution("[FOLDOUT(Advanced Lighting){6}]Light Color Contribution", Range(0, 1)) = 0
|
||||
_LightFalloffSize("Point / Spot Light Edge", Range(0, 1)) = 0
|
||||
|
||||
// Used to provide light direction to cel shading if all light in the scene is baked.
|
||||
[Toggle(DR_ENABLE_LIGHTMAP_DIR)]_OverrideLightmapDir("Override Light Direction", Int) = 0
|
||||
_LightmapDirectionPitch("[DR_ENABLE_LIGHTMAP_DIR]Pitch", Range(0, 360)) = 0
|
||||
_LightmapDirectionYaw("[DR_ENABLE_LIGHTMAP_DIR]Yaw", Range(0, 360)) = 0
|
||||
[HideInInspector] _LightmapDirection("Direction", Vector) = (0, 1, 0, 0)
|
||||
|
||||
[KeywordEnum(None, Multiply, Color)] _UnityShadowMode ("[FOLDOUT(Unity Built-in Shadows){5}]Mode", Float) = 0
|
||||
_UnityShadowPower("[_UNITYSHADOWMODE_MULTIPLY]Power", Range(0, 1)) = 0.2
|
||||
_UnityShadowColor("[_UNITYSHADOWMODE_COLOR]Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_UnityShadowSharpness("Sharpness", Range(1, 10)) = 1.0
|
||||
[Toggle(_UNITYSHADOW_OCCLUSION)]_UnityShadowOcclusion("Shadow Occlusion", Int) = 0
|
||||
|
||||
[MainTexture] _BaseMap("[FOLDOUT(Texture Maps){11}]Albedo", 2D) = "white" {}
|
||||
[Toggle(_BASEMAP_PREMULTIPLY)]_BaseMapPremultiply("[_]Mix Into Shading", Int) = 0
|
||||
[KeywordEnum(Multiply, Add)]_TextureBlendingMode("[_]Blending Mode", Float) = 0
|
||||
_TextureImpact("[_]Texture Impact", Range(0, 1)) = 1.0
|
||||
|
||||
_DetailMap("Detail Map", 2D) = "white" {}
|
||||
_DetailMapColor("[]Detail Color", Color) = (1,1,1,1)
|
||||
[KeywordEnum(Multiply, Add, Interpolate)]_DetailMapBlendingMode("[]Blending Mode", Float) = 0
|
||||
_DetailMapImpact("[]Detail Impact", Range(0, 1)) = 0.0
|
||||
|
||||
_BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
|
||||
_EmissionMap ("Emission Map", 2D) = "white" {}
|
||||
[HDR]_EmissionColor("Emission Color", Color) = (1, 1, 1, 1)
|
||||
|
||||
[HideInInspector] _Cutoff ("Base Alpha Cutoff", Range (0, 1)) = .5
|
||||
|
||||
// Blending state
|
||||
[HideInInspector] _Surface("__surface", Float) = 0.0
|
||||
[HideInInspector] _Blend("__blend", Float) = 0.0
|
||||
[HideInInspector] _AlphaClip("__clip", Float) = 0.0
|
||||
[HideInInspector] _SrcBlend("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend("__dst", Float) = 0.0
|
||||
[HideInInspector] _ZWrite("__zw", Float) = 1.0
|
||||
[HideInInspector] _Cull("__cull", Float) = 2.0
|
||||
|
||||
// Editmode props
|
||||
[HideInInspector] _QueueOffset("Queue Offset", Float) = 0.0
|
||||
|
||||
/* start CurvedWorld */
|
||||
//[CurvedWorldBendSettings] _CurvedWorldBendSettings("0|1|1", Vector) = (0, 0, 0, 0)
|
||||
/* end CurvedWorld */
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{"RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True"}
|
||||
LOD 300
|
||||
|
||||
HLSLINCLUDE
|
||||
// #define FLAT_KIT_DOTS_INSTANCING_ON // Uncomment to enable DOTS instancing
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl"
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ForwardLit"
|
||||
Tags {"LightMode" = "UniversalForwardOnly"}
|
||||
|
||||
Blend[_SrcBlend][_DstBlend]
|
||||
ZWrite[_ZWrite]
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma shader_feature_local_fragment __ _CELPRIMARYMODE_SINGLE _CELPRIMARYMODE_STEPS _CELPRIMARYMODE_CURVE
|
||||
#pragma shader_feature_local_fragment DR_CEL_EXTRA_ON
|
||||
#pragma shader_feature_local_fragment DR_GRADIENT_ON
|
||||
#pragma shader_feature_local_fragment __ _GRADIENTSPACE_WORLD _GRADIENTSPACE_LOCAL
|
||||
#pragma shader_feature_local_fragment DR_SPECULAR_ON
|
||||
#pragma shader_feature_local_fragment DR_RIM_ON
|
||||
#pragma shader_feature_local DR_VERTEX_COLORS_ON
|
||||
#pragma shader_feature_local_fragment DR_ENABLE_LIGHTMAP_DIR
|
||||
#pragma shader_feature_local_fragment __ _UNITYSHADOWMODE_MULTIPLY _UNITYSHADOWMODE_COLOR
|
||||
#pragma shader_feature_local_fragment _TEXTUREBLENDINGMODE_MULTIPLY _TEXTUREBLENDINGMODE_ADD
|
||||
#pragma shader_feature_local_fragment _UNITYSHADOW_OCCLUSION
|
||||
#pragma shader_feature_local_fragment _BASEMAP_PREMULTIPLY
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ALPHAPREMULTIPLY_ON
|
||||
// #pragma shader_feature_local_fragment _ _SPECGLOSSMAP _SPECULAR_COLOR
|
||||
// #pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _EMISSION
|
||||
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
||||
#if UNITY_VERSION >= 600000
|
||||
#pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Pipeline keywords
|
||||
#if VERSION_GREATER_EQUAL(11, 0)
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#else
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
#endif
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
|
||||
#if VERSION_GREATER_EQUAL(12, 0)
|
||||
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
||||
#pragma multi_compile _ _LIGHT_LAYERS
|
||||
#pragma multi_compile_fragment _ _LIGHT_COOKIES
|
||||
#endif
|
||||
#if UNITY_VERSION >= 202220 && UNITY_VERSION < 600000
|
||||
#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
|
||||
#endif
|
||||
#if UNITY_VERSION >= 600000
|
||||
#pragma multi_compile _ _FORWARD_PLUS
|
||||
#pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX
|
||||
#define _ENVIRONMENTREFLECTIONS_OFF 1 // Fixes flickering when Probe Blending is enabled on Renderer.
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
||||
#else
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#endif
|
||||
#if UNITY_VERSION >= 60000012
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile_fog
|
||||
#if UNITY_VERSION >= 202220
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
#pragma multi_compile_fragment _ DEBUG_DISPLAY
|
||||
#pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
|
||||
#endif
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options renderinglayer
|
||||
#if defined(FLAT_KIT_DOTS_INSTANCING_ON)
|
||||
#pragma target 4.5
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
#endif
|
||||
|
||||
// Detail map.
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#pragma shader_feature_local_fragment _DETAILMAPBLENDINGMODE_MULTIPLY _DETAILMAPBLENDINGMODE_ADD _DETAILMAPBLENDINGMODE_INTERPOLATE
|
||||
|
||||
TEXTURE2D(_DetailMap);
|
||||
SAMPLER(sampler_DetailMap);
|
||||
|
||||
#pragma vertex StylizedPassVertex
|
||||
#pragma fragment StylizedPassFragment
|
||||
#if UNITY_VERSION >= 202230
|
||||
#define BUMP_SCALE_NOT_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
// TODO: Toggle _NORMALMAP from the editor script.
|
||||
#define _NORMALMAP
|
||||
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "LibraryUrp/LitForwardPass_DR.hlsl"
|
||||
#include "LibraryUrp/Lighting_DR.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
// Renderer Feature outline pass.
|
||||
Name "Outline"
|
||||
Tags{"LightMode" = "Outline"}
|
||||
|
||||
Cull Front
|
||||
|
||||
HLSLPROGRAM
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
|
||||
#pragma vertex VertexProgram
|
||||
#pragma fragment FragmentProgram
|
||||
|
||||
#pragma multi_compile _ DR_OUTLINE_ON
|
||||
#pragma multi_compile _ DR_OUTLINE_SMOOTH_NORMALS
|
||||
#pragma multi_compile __ _OUTLINESPACE_SCREEN _OUTLINESPACE_OBJECT
|
||||
#pragma multi_compile_fog
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
#if defined(DR_OUTLINE_SMOOTH_NORMALS)
|
||||
float4 uv2 : TEXCOORD2;
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float fogCoord : TEXCOORD1;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
float4 ObjectToClipPos(float4 pos)
|
||||
{
|
||||
return mul(UNITY_MATRIX_VP, mul(UNITY_MATRIX_M, float4(pos.xyz, 1)));
|
||||
}
|
||||
|
||||
float4 ObjectToClipDir(float3 dir)
|
||||
{
|
||||
return mul(UNITY_MATRIX_VP, mul(UNITY_MATRIX_M, float4(dir.xyz, 0)));
|
||||
}
|
||||
|
||||
VertexOutput VertexProgram(VertexInput v)
|
||||
{
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
CURVEDWORLD_TRANSFORM_VERTEX(v.position)
|
||||
#endif
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
|
||||
VertexOutput o = (VertexOutput)0;
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
#if defined(DR_OUTLINE_ON)
|
||||
#if defined(DR_OUTLINE_SMOOTH_NORMALS)
|
||||
float3 objectScale = abs(UNITY_MATRIX_M[0].xyz) + abs(UNITY_MATRIX_M[1].xyz) + abs(UNITY_MATRIX_M[2].xyz);
|
||||
v.normal = v.uv2.xyz / objectScale;
|
||||
#endif
|
||||
|
||||
#if defined(_OUTLINESPACE_OBJECT)
|
||||
float3 offset = v.normal * _OutlineWidth * 0.01;
|
||||
float4 clipPosition = ObjectToClipPos(v.position * _OutlineScale + float4(offset, 0));
|
||||
#else
|
||||
float4 clipPosition = ObjectToClipPos(v.position * _OutlineScale);
|
||||
const float3 clipNormal = ObjectToClipDir(v.normal).xyz;
|
||||
const float2 aspectRatio = float2(_ScreenParams.x / _ScreenParams.y, 1);
|
||||
const half cameraDistanceImpact = lerp(clipPosition.w, 4.0, _CameraDistanceImpact);
|
||||
const float2 offset = normalize(clipNormal.xy) / aspectRatio * _OutlineWidth * cameraDistanceImpact * 0.005;
|
||||
clipPosition.xy += offset;
|
||||
#endif
|
||||
|
||||
// Depth offset
|
||||
{
|
||||
const half outlineDepthOffset = _OutlineDepthOffset * .1;
|
||||
#if UNITY_REVERSED_Z
|
||||
clipPosition.z -= outlineDepthOffset;
|
||||
#else
|
||||
clipPosition.z += outlineDepthOffset * (1.0 - UNITY_NEAR_CLIP_VALUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
o.position = clipPosition;
|
||||
o.fogCoord = ComputeFogFactor(o.position.z);
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 FragmentProgram(VertexOutput i) : SV_TARGET
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half4 color = _OutlineColor;
|
||||
color.rgb = MixFog(color.rgb, i.fogCoord);
|
||||
return color;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// All the following passes are from URP SimpleLit.shader.
|
||||
// UsePass "Universal Render Pipeline/Simple Lit/..." - not included in build and produces z-buffer glitches in
|
||||
// local and global outlines combination.
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags{"LightMode" = "ShadowCaster"}
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
ColorMask 0
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#if defined(FLAT_KIT_DOTS_INSTANCING_ON)
|
||||
#pragma target 4.5
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Pipeline keywords
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#if UNITY_VERSION >= 202220
|
||||
#pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
|
||||
#endif
|
||||
|
||||
// This is used during shadow map generation to differentiate between directional and punctual light shadows, as they use different formulas to apply Normal Bias
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "GBuffer"
|
||||
Tags{"LightMode" = "UniversalGBuffer"}
|
||||
|
||||
ZWrite[_ZWrite]
|
||||
ZTest LEqual
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
// #pragma shader_feature _ALPHAPREMULTIPLY_ON
|
||||
// #pragma shader_feature_local_fragment _ _SPECGLOSSMAP _SPECULAR_COLOR
|
||||
// #pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _EMISSION
|
||||
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
||||
#if UNITY_VERSION >= 600000
|
||||
#pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Pipeline keywords
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
//#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
//#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
||||
#pragma multi_compile_fragment _ _LIGHT_LAYERS
|
||||
#if UNITY_VERSION >= 600000
|
||||
#define _ENVIRONMENTREFLECTIONS_OFF 1 // Fixes flickering when Probe Blending is enabled on Renderer.
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
||||
#else
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#endif
|
||||
#if UNITY_VERSION >= 60000012
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
||||
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
||||
#if UNITY_VERSION >= 600000
|
||||
#pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
|
||||
#endif
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options renderinglayer
|
||||
#if defined(FLAT_KIT_DOTS_INSTANCING_ON)
|
||||
#pragma target 4.5
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
#endif
|
||||
|
||||
#pragma vertex LitPassVertexSimple
|
||||
#pragma fragment LitPassFragmentSimple
|
||||
|
||||
#define BUMP_SCALE_NOT_SUPPORTED 1
|
||||
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitGBufferPass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "DepthOnly"
|
||||
Tags{"LightMode" = "DepthOnly"}
|
||||
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#if UNITY_VERSION >= 202220
|
||||
#pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
|
||||
#endif
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#if defined(FLAT_KIT_DOTS_INSTANCING_ON)
|
||||
#pragma target 4.5
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
#endif
|
||||
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// This pass is used when drawing to a _CameraNormalsTexture texture
|
||||
Pass
|
||||
{
|
||||
Name "DepthNormals"
|
||||
Tags{"LightMode" = "DepthNormals"}
|
||||
|
||||
ZWrite On
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#if UNITY_VERSION >= 202220
|
||||
#pragma multi_compile_fragment _ LOD_FADE_CROSSFADE
|
||||
// Universal Pipeline keywords
|
||||
#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
|
||||
#endif
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#if defined(FLAT_KIT_DOTS_INSTANCING_ON)
|
||||
#pragma target 4.5
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
#endif
|
||||
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthNormalsPass.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// This pass it not used during regular rendering, only for lightmap baking.
|
||||
Pass
|
||||
{
|
||||
Name "Meta"
|
||||
Tags{ "LightMode" = "Meta" }
|
||||
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex UniversalVertexMeta
|
||||
#pragma fragment UniversalFragmentMetaSimple
|
||||
#if UNITY_VERSION >= 202220
|
||||
#pragma shader_feature EDITOR_VISUALIZATION
|
||||
#endif
|
||||
|
||||
#pragma shader_feature_local_fragment _EMISSION
|
||||
#pragma shader_feature_local_fragment _SPECGLOSSMAP
|
||||
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitMetaPass.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "Universal2D"
|
||||
Tags{ "LightMode" = "Universal2D" }
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ALPHAPREMULTIPLY_ON
|
||||
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/Universal2D.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
Fallback "Hidden/Universal Render Pipeline/FallbackError"
|
||||
CustomEditor "StylizedSurfaceEditor"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bee44b4a58655ee4cbff107302a3e131
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,406 @@
|
||||
Shader "FlatKit/Stylized Surface With Outline"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[MainColor] _BaseColor ("Color", Color) = (1,1,1,1)
|
||||
|
||||
[Space(10)]
|
||||
[KeywordEnum(None, Single, Steps, Curve)]_CelPrimaryMode("Cel Shading Mode", Float) = 1
|
||||
_ColorDim ("[_CELPRIMARYMODE_SINGLE]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_ColorDimSteps ("[_CELPRIMARYMODE_STEPS]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_ColorDimCurve ("[_CELPRIMARYMODE_CURVE]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_SelfShadingSize ("[_CELPRIMARYMODE_SINGLE]Self Shading Size", Range(0, 1)) = 0.5
|
||||
_ShadowEdgeSize ("[_CELPRIMARYMODE_SINGLE]Shadow Edge Size", Range(0, 0.5)) = 0.05
|
||||
_Flatness ("[_CELPRIMARYMODE_SINGLE]Localized Shading", Range(0, 1)) = 1.0
|
||||
|
||||
[IntRange]_CelNumSteps ("[_CELPRIMARYMODE_STEPS]Number Of Steps", Range(1, 10)) = 3.0
|
||||
_CelStepTexture ("[_CELPRIMARYMODE_STEPS][LAST_PROP_STEPS]Cel steps", 2D) = "black" {}
|
||||
_CelCurveTexture ("[_CELPRIMARYMODE_CURVE][LAST_PROP_CURVE]Ramp", 2D) = "black" {}
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_CEL_EXTRA_ON)] _CelExtraEnabled("Enable Extra Cel Layer", Int) = 0
|
||||
_ColorDimExtra ("[DR_CEL_EXTRA_ON]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_SelfShadingSizeExtra ("[DR_CEL_EXTRA_ON]Self Shading Size", Range(0, 1)) = 0.6
|
||||
_ShadowEdgeSizeExtra ("[DR_CEL_EXTRA_ON]Shadow Edge Size", Range(0, 0.5)) = 0.05
|
||||
_FlatnessExtra ("[DR_CEL_EXTRA_ON]Localized Shading", Range(0, 1)) = 1.0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_SPECULAR_ON)] _SpecularEnabled("Enable Specular", Int) = 0
|
||||
[HDR] _FlatSpecularColor("[DR_SPECULAR_ON]Specular Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_FlatSpecularSize("[DR_SPECULAR_ON]Specular Size", Range(0.0, 1.0)) = 0.1
|
||||
_FlatSpecularEdgeSmoothness("[DR_SPECULAR_ON]Specular Edge Smoothness", Range(0.0, 1.0)) = 0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_RIM_ON)] _RimEnabled("Enable Rim", Int) = 0
|
||||
[HDR] _FlatRimColor("[DR_RIM_ON]Rim Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_FlatRimLightAlign("[DR_RIM_ON]Light Align", Range(0.0, 1.0)) = 0
|
||||
_FlatRimSize("[DR_RIM_ON]Rim Size", Range(0, 1)) = 0.5
|
||||
_FlatRimEdgeSmoothness("[DR_RIM_ON]Rim Edge Smoothness", Range(0, 1)) = 0.5
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_GRADIENT_ON)] _GradientEnabled("Enable Height Gradient", Int) = 0
|
||||
[HDR] _ColorGradient("[DR_GRADIENT_ON]Gradient Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_GradientCenterX("[DR_GRADIENT_ON]Center X", Float) = 0
|
||||
_GradientCenterY("[DR_GRADIENT_ON]Center Y", Float) = 0
|
||||
_GradientSize("[DR_GRADIENT_ON]Size", Float) = 10.0
|
||||
_GradientAngle("[DR_GRADIENT_ON]Gradient Angle", Range(0, 360)) = 0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_VERTEX_COLORS_ON)] _VertexColorsEnabled("Enable Vertex Colors", Int) = 0
|
||||
|
||||
_LightContribution("[FOLDOUT(Advanced Lighting){5}]Light Color Contribution", Range(0, 1)) = 0
|
||||
_LightFalloffSize("Light edge width (point / spot)", Range(0, 1)) = 0
|
||||
|
||||
// Used to provide light direction to cel shading if all light in the scene is baked.
|
||||
[Space(5)]
|
||||
[Toggle(DR_ENABLE_LIGHTMAP_DIR)]_OverrideLightmapDir("Override light direction", Int) = 0
|
||||
_LightmapDirectionPitch("[DR_ENABLE_LIGHTMAP_DIR]Pitch", Range(0, 360)) = 0
|
||||
_LightmapDirectionYaw("[DR_ENABLE_LIGHTMAP_DIR]Yaw", Range(0, 360)) = 0
|
||||
[HideInInspector] _LightmapDirection("Direction", Vector) = (0, 1, 0, 0)
|
||||
|
||||
[KeywordEnum(None, Multiply, Color)] _UnityShadowMode ("[FOLDOUT(Unity Built-in Shadows){4}]Mode", Float) = 0
|
||||
_UnityShadowPower("[_UNITYSHADOWMODE_MULTIPLY]Power", Range(0, 1)) = 0.2
|
||||
_UnityShadowColor("[_UNITYSHADOWMODE_COLOR]Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_UnityShadowSharpness("Sharpness", Range(1, 10)) = 1.0
|
||||
|
||||
[MainTexture] _BaseMap("[FOLDOUT(Texture maps){6}]Albedo", 2D) = "white" {}
|
||||
[Space][KeywordEnum(Multiply, Add)]_TextureBlendingMode("[_]Blending Mode", Float) = 0
|
||||
[Space]_TextureImpact("[_]Texture Impact", Range(0, 1)) = 1.0
|
||||
[Space(20)]_BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
_EmissionMap ("Emission Map", 2D) = "black" {}
|
||||
[HDR]_EmissionColor("Emission Color", Color) = (1, 1, 1, 1)
|
||||
|
||||
[HideInInspector] _Cutoff ("Base Alpha cutoff", Range (0, 1)) = .5
|
||||
|
||||
// Blending state
|
||||
[HideInInspector] _Surface("__surface", Float) = 0.0
|
||||
[HideInInspector] _Blend("__blend", Float) = 0.0
|
||||
[HideInInspector] _AlphaClip("__clip", Float) = 0.0
|
||||
[HideInInspector] _SrcBlend("__src", Float) = 1.0
|
||||
[HideInInspector] _DstBlend("__dst", Float) = 0.0
|
||||
[HideInInspector] _ZWrite("__zw", Float) = 1.0
|
||||
[HideInInspector] _Cull("__cull", Float) = 2.0
|
||||
|
||||
// Editmode props
|
||||
[HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
|
||||
|
||||
// --------------------- OUTLINE PROPS -----------------------
|
||||
_OutlineColor("[FOLDOUT(Outline){5}]Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_OutlineWidth("Width", Float) = 0.01
|
||||
_OutlineScale("Scale", Float) = 1.0
|
||||
_OutlineDepthOffset("Depth Offset", Range(0, 1)) = 0.0
|
||||
_CameraDistanceImpact("Camera Distance Impact", Range(0, 1)) = 0.0
|
||||
|
||||
/* start CurvedWorld */
|
||||
//[CurvedWorldBendSettings] _CurvedWorldBendSettings("0|1|1", Vector) = (0, 0, 0, 0)
|
||||
/* end CurvedWorld */
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True"
|
||||
}
|
||||
LOD 300
|
||||
|
||||
UsePass "FlatKit/Stylized Surface/ForwardLit"
|
||||
Pass
|
||||
{
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#include "UnityInstancing.cginc"
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
#pragma vertex VertexProgram
|
||||
#pragma fragment FragmentProgram
|
||||
|
||||
#pragma multi_compile_fog
|
||||
|
||||
UNITY_INSTANCING_BUFFER_START(OutlineProps)
|
||||
UNITY_DEFINE_INSTANCED_PROP(half4, _OutlineColor)
|
||||
UNITY_DEFINE_INSTANCED_PROP(half, _OutlineWidth)
|
||||
UNITY_DEFINE_INSTANCED_PROP(half, _OutlineScale)
|
||||
UNITY_DEFINE_INSTANCED_PROP(half, _OutlineDepthOffset)
|
||||
UNITY_DEFINE_INSTANCED_PROP(half, _CameraDistanceImpact)
|
||||
UNITY_INSTANCING_BUFFER_END(OutlineProps)
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
|
||||
/* start CurvedWorld */
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
#ifdef CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
float4 tangent : TANGENT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float3 normal : NORMAL;
|
||||
|
||||
UNITY_FOG_COORDS(0)
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
VertexOutput VertexProgram(VertexInput v)
|
||||
{
|
||||
VertexOutput o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
|
||||
/* start CurvedWorld */
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
#ifdef CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
CURVEDWORLD_TRANSFORM_VERTEX_AND_NORMAL(v.position, v.normal, v.tangent)
|
||||
#else
|
||||
CURVEDWORLD_TRANSFORM_VERTEX(v.position)
|
||||
#endif
|
||||
#endif
|
||||
/* end CurvedWorld */
|
||||
|
||||
UNITY_INITIALIZE_OUTPUT(VertexOutput, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
float4 clipPosition = UnityObjectToClipPos(v.position * _OutlineScale);
|
||||
const float3 clipNormal = mul((float3x3)UNITY_MATRIX_VP, mul((float3x3)UNITY_MATRIX_M, v.normal));
|
||||
const half outlineWidth = UNITY_ACCESS_INSTANCED_PROP(OutlineProps, _OutlineWidth);
|
||||
const half cameraDistanceImpact = lerp(clipPosition.w, 4.0, _CameraDistanceImpact);
|
||||
const float2 offset = normalize(clipNormal.xy) / _ScreenParams.xy * outlineWidth * cameraDistanceImpact
|
||||
* 2.0;
|
||||
clipPosition.xy += offset;
|
||||
const half outlineDepthOffset = UNITY_ACCESS_INSTANCED_PROP(OutlineProps, _OutlineDepthOffset);
|
||||
clipPosition.z -= outlineDepthOffset;
|
||||
o.position = clipPosition;
|
||||
o.normal = clipNormal;
|
||||
|
||||
UNITY_TRANSFER_FOG(o, o.position);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 FragmentProgram(VertexOutput i) : SV_TARGET
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half4 color = UNITY_ACCESS_INSTANCED_PROP(OutlineProps, _OutlineColor);
|
||||
UNITY_APPLY_FOG(i.fogCoord, color);
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// All the following passes are from URP SimpleLit.shader.
|
||||
// UsePass "Universal Render Pipeline/Simple Lit/..." - produces z-buffer glitches in local and global outlines combination.
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ShadowCaster"
|
||||
}
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
ColorMask 0
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "GBuffer"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "UniversalGBuffer"
|
||||
}
|
||||
|
||||
ZWrite[_ZWrite]
|
||||
ZTest LEqual
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
//#pragma shader_feature _ALPHAPREMULTIPLY_ON
|
||||
#pragma shader_feature_local_fragment _ _SPECGLOSSMAP _SPECULAR_COLOR
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _EMISSION
|
||||
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Pipeline keywords
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
//#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
//#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _SHADOWS_SOFT
|
||||
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#pragma vertex LitPassVertexSimple
|
||||
#pragma fragment LitPassFragmentSimple
|
||||
#define BUMP_SCALE_NOT_SUPPORTED 1
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitGBufferPass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "DepthOnly"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "DepthOnly"
|
||||
}
|
||||
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// This pass is used when drawing to a _CameraNormalsTexture texture
|
||||
Pass
|
||||
{
|
||||
Name "DepthNormals"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "DepthNormals"
|
||||
}
|
||||
|
||||
ZWrite On
|
||||
Cull[_Cull]
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex DepthNormalsVertex
|
||||
#pragma fragment DepthNormalsFragment
|
||||
|
||||
// -------------------------------------
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _GLOSSINESS_FROM_BASE_ALPHA
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthNormalsPass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// This pass it not used during regular rendering, only for lightmap baking.
|
||||
Pass
|
||||
{
|
||||
Name "Meta"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "Meta"
|
||||
}
|
||||
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex UniversalVertexMeta
|
||||
#pragma fragment UniversalFragmentMetaSimple
|
||||
|
||||
#pragma shader_feature_local_fragment _EMISSION
|
||||
#pragma shader_feature_local_fragment _SPECGLOSSMAP
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitMetaPass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "Universal2D"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "Universal2D"
|
||||
}
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "Transparent" "Queue" = "Transparent"
|
||||
}
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
||||
#pragma shader_feature_local_fragment _ALPHAPREMULTIPLY_ON
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/Universal2D.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
Fallback "Hidden/Universal Render Pipeline/FallbackError"
|
||||
CustomEditor "StylizedSurfaceEditor"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7e38193b7f064d7380403618fd8b69e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
397
Assets/FlatKit/Shaders/StylizedSurface/Terrain.shader
Normal file
397
Assets/FlatKit/Shaders/StylizedSurface/Terrain.shader
Normal file
@@ -0,0 +1,397 @@
|
||||
Shader "FlatKit/Terrain"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Space(10)]
|
||||
[KeywordEnum(None, Single, Steps, Curve)]_CelPrimaryMode("Cel Shading Mode", Float) = 1
|
||||
_ColorDim ("[_CELPRIMARYMODE_SINGLE]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_ColorDimSteps ("[_CELPRIMARYMODE_STEPS]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_ColorDimCurve ("[_CELPRIMARYMODE_CURVE]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_SelfShadingSize ("[_CELPRIMARYMODE_SINGLE]Self Shading Size", Range(0, 1)) = 0.5
|
||||
_ShadowEdgeSize ("[_CELPRIMARYMODE_SINGLE]Shadow Edge Size", Range(0, 0.5)) = 0.05
|
||||
_Flatness ("[_CELPRIMARYMODE_SINGLE]Localized Shading", Range(0, 1)) = 1.0
|
||||
|
||||
[IntRange]_CelNumSteps ("[_CELPRIMARYMODE_STEPS]Number Of Steps", Range(1, 10)) = 3.0
|
||||
_CelStepTexture ("[_CELPRIMARYMODE_STEPS][LAST_PROP_STEPS]Cel steps", 2D) = "black" {}
|
||||
_CelCurveTexture ("[_CELPRIMARYMODE_CURVE][LAST_PROP_CURVE]Ramp", 2D) = "black" {}
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_CEL_EXTRA_ON)] _CelExtraEnabled("Enable Extra Cel Layer", Int) = 0
|
||||
_ColorDimExtra ("[DR_CEL_EXTRA_ON]Color Shaded", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_SelfShadingSizeExtra ("[DR_CEL_EXTRA_ON]Self Shading Size", Range(0, 1)) = 0.6
|
||||
_ShadowEdgeSizeExtra ("[DR_CEL_EXTRA_ON]Shadow Edge Size", Range(0, 0.5)) = 0.05
|
||||
_FlatnessExtra ("[DR_CEL_EXTRA_ON]Localized Shading", Range(0, 1)) = 1.0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_SPECULAR_ON)] _SpecularEnabled("Enable Specular", Int) = 0
|
||||
[HDR] _FlatSpecularColor("[DR_SPECULAR_ON]Specular Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_FlatSpecularSize("[DR_SPECULAR_ON]Specular Size", Range(0.0, 1.0)) = 0.1
|
||||
_FlatSpecularEdgeSmoothness("[DR_SPECULAR_ON]Specular Edge Smoothness", Range(0.0, 1.0)) = 0
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_RIM_ON)] _RimEnabled("Enable Rim", Int) = 0
|
||||
[HDR] _FlatRimColor("[DR_RIM_ON]Rim Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_FlatRimLightAlign("[DR_RIM_ON]Light Align", Range(0.0, 1.0)) = 0
|
||||
_FlatRimSize("[DR_RIM_ON]Rim Size", Range(0, 1)) = 0.5
|
||||
_FlatRimEdgeSmoothness("[DR_RIM_ON]Rim Edge Smoothness", Range(0, 1)) = 0.5
|
||||
|
||||
[Space(10)]
|
||||
[Toggle(DR_GRADIENT_ON)] _GradientEnabled("Enable Height Gradient", Int) = 0
|
||||
[HDR] _ColorGradient("[DR_GRADIENT_ON]Gradient Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_GradientCenterX("[DR_GRADIENT_ON]Center X", Float) = 0
|
||||
_GradientCenterY("[DR_GRADIENT_ON]Center Y", Float) = 0
|
||||
_GradientSize("[DR_GRADIENT_ON]Size", Float) = 10.0
|
||||
_GradientAngle("[DR_GRADIENT_ON]Gradient Angle", Range(0, 360)) = 0
|
||||
|
||||
_LightContribution("[FOLDOUT(Advanced Lighting){5}]Light Color Contribution", Range(0, 1)) = 0
|
||||
_LightFalloffSize("Light edge width (point / spot)", Range(0, 1)) = 0
|
||||
|
||||
[Space(5)]
|
||||
// Used to provide light direction to cel shading if all light in the scene is baked.
|
||||
[Toggle(DR_ENABLE_LIGHTMAP_DIR)]_OverrideLightmapDir("Override Light Direction", Int) = 0
|
||||
_LightmapDirectionPitch("[DR_ENABLE_LIGHTMAP_DIR]Pitch", Range(0, 360)) = 0
|
||||
_LightmapDirectionYaw("[DR_ENABLE_LIGHTMAP_DIR]Yaw", Range(0, 360)) = 0
|
||||
[HideInInspector] _LightmapDirection("Direction", Vector) = (0, 1, 0, 0)
|
||||
|
||||
[KeywordEnum(None, Multiply, Color)] _UnityShadowMode ("[FOLDOUT(Unity Built-in Shadows){4}]Mode", Float) = 0
|
||||
_UnityShadowPower("[_UNITYSHADOWMODE_MULTIPLY]Power", Range(0, 1)) = 0.2
|
||||
_UnityShadowColor("[_UNITYSHADOWMODE_COLOR]Color", Color) = (0.85023, 0.85034, 0.85045, 0.85056)
|
||||
_UnityShadowSharpness("Sharpness", Range(1, 10)) = 1.0
|
||||
|
||||
// Editmode props
|
||||
[HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
// --------------------------------
|
||||
// --- From `TerrainLit.shader` ---
|
||||
// --------------------------------
|
||||
[HideInInspector] [ToggleUI] _EnableHeightBlend("EnableHeightBlend", Float) = 0.0
|
||||
[HideInInspector] _HeightTransition("Height Transition", Range(0, 1.0)) = 0.0
|
||||
// Layer count is passed down to guide height-blend enable/disable, due
|
||||
// to the fact that heigh-based blend will be broken with multipass.
|
||||
[HideInInspector] [PerRendererData] _NumLayersCount ("Total Layer Count", Float) = 1.0
|
||||
|
||||
// set by terrain engine
|
||||
[HideInInspector] _Control("Control (RGBA)", 2D) = "red" {}
|
||||
[HideInInspector] _Splat3("Layer 3 (A)", 2D) = "grey" {}
|
||||
[HideInInspector] _Splat2("Layer 2 (B)", 2D) = "grey" {}
|
||||
[HideInInspector] _Splat1("Layer 1 (G)", 2D) = "grey" {}
|
||||
[HideInInspector] _Splat0("Layer 0 (R)", 2D) = "grey" {}
|
||||
[HideInInspector] _Normal3("Normal 3 (A)", 2D) = "bump" {}
|
||||
[HideInInspector] _Normal2("Normal 2 (B)", 2D) = "bump" {}
|
||||
[HideInInspector] _Normal1("Normal 1 (G)", 2D) = "bump" {}
|
||||
[HideInInspector] _Normal0("Normal 0 (R)", 2D) = "bump" {}
|
||||
[HideInInspector] _Mask3("Mask 3 (A)", 2D) = "grey" {}
|
||||
[HideInInspector] _Mask2("Mask 2 (B)", 2D) = "grey" {}
|
||||
[HideInInspector] _Mask1("Mask 1 (G)", 2D) = "grey" {}
|
||||
[HideInInspector] _Mask0("Mask 0 (R)", 2D) = "grey" {}
|
||||
[HideInInspector][Gamma] _Metallic0("Metallic 0", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector][Gamma] _Metallic1("Metallic 1", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector][Gamma] _Metallic2("Metallic 2", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector][Gamma] _Metallic3("Metallic 3", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector] _Smoothness0("Smoothness 0", Range(0.0, 1.0)) = 0.5
|
||||
[HideInInspector] _Smoothness1("Smoothness 1", Range(0.0, 1.0)) = 0.5
|
||||
[HideInInspector] _Smoothness2("Smoothness 2", Range(0.0, 1.0)) = 0.5
|
||||
[HideInInspector] _Smoothness3("Smoothness 3", Range(0.0, 1.0)) = 0.5
|
||||
|
||||
// used in fallback on old cards & base map
|
||||
[HideInInspector] _MainTex("BaseMap (RGB)", 2D) = "grey" {}
|
||||
[HideInInspector] _BaseColor("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
[HideInInspector] _TerrainHolesTexture("Holes Map (RGB)", 2D) = "white" {}
|
||||
|
||||
[HideInInspector] [ToggleUI] _EnableInstancedPerPixelNormal("Enable Instanced per-pixel normal", Float) = 1.0
|
||||
|
||||
/* start CurvedWorld */
|
||||
//[CurvedWorldBendSettings] _CurvedWorldBendSettings("0|1|1", Vector) = (0, 0, 0, 0)
|
||||
/* end CurvedWorld */
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#pragma multi_compile_fragment __ _ALPHATEST_ON
|
||||
|
||||
ENDHLSL
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry-100" "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "UniversalMaterialType" = "Lit" "IgnoreProjector" = "False" "TerrainCompatible" = "True"}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl"
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode" = "UniversalForwardOnly" }
|
||||
HLSLPROGRAM
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma vertex SplatmapVert
|
||||
#pragma fragment SplatmapFragment_DSTRM
|
||||
|
||||
#define _METALLICSPECGLOSSMAP 1
|
||||
#define _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 1
|
||||
|
||||
// -------------------------------------
|
||||
// Flat Kit
|
||||
#pragma shader_feature_local_fragment __ _CELPRIMARYMODE_SINGLE _CELPRIMARYMODE_STEPS _CELPRIMARYMODE_CURVE
|
||||
#pragma shader_feature_local_fragment DR_CEL_EXTRA_ON
|
||||
#pragma shader_feature_local_fragment DR_GRADIENT_ON
|
||||
#pragma shader_feature_local_fragment DR_SPECULAR_ON
|
||||
#pragma shader_feature_local_fragment DR_RIM_ON
|
||||
#pragma shader_feature_local_fragment DR_ENABLE_LIGHTMAP_DIR
|
||||
#pragma shader_feature_local __ _UNITYSHADOWMODE_MULTIPLY _UNITYSHADOWMODE_COLOR
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Pipeline keywords
|
||||
#if VERSION_GREATER_EQUAL(11, 0)
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#else
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
#endif
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
|
||||
#if VERSION_GREATER_EQUAL(12, 0)
|
||||
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
||||
#pragma multi_compile_fragment _ _LIGHT_LAYERS
|
||||
#pragma multi_compile_fragment _ _LIGHT_COOKIES
|
||||
#endif
|
||||
#if UNITY_VERSION >= 202220
|
||||
#pragma multi_compile _ _FORWARD_PLUS
|
||||
#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
|
||||
#endif
|
||||
#if UNITY_VERSION >= 60000000
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile_instancing
|
||||
#if UNITY_VERSION >= 202230
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
#pragma multi_compile_fragment _ DEBUG_DISPLAY
|
||||
#endif
|
||||
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
|
||||
|
||||
#pragma shader_feature_local_fragment _TERRAIN_BLEND_HEIGHT
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _MASKMAP
|
||||
// Sample normal in pixel shader when doing instancing
|
||||
#pragma shader_feature_local _TERRAIN_INSTANCED_PERPIXEL_NORMAL
|
||||
|
||||
// Detail map.
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#pragma shader_feature_local_fragment _DETAILMAPBLENDINGMODE_MULTIPLY _DETAILMAPBLENDINGMODE_ADD _DETAILMAPBLENDINGMODE_INTERPOLATE
|
||||
|
||||
TEXTURE2D(_DetailMap);
|
||||
SAMPLER(sampler_DetailMap);
|
||||
|
||||
#define FLATKIT_TERRAIN 1
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "LibraryUrp/Lighting_DR.hlsl"
|
||||
#include "LibraryUrp/TerrainLitPasses_DR.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// Passes from `TerrainLit.shader`.
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags{"LightMode" = "ShadowCaster"}
|
||||
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma vertex ShadowPassVertex
|
||||
#pragma fragment ShadowPassFragment
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Pipeline keywords
|
||||
|
||||
// This is used during shadow map generation to differentiate between directional and punctual light shadows, as they use different formulas to apply Normal Bias
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitPasses.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "DepthOnly"
|
||||
Tags{"LightMode" = "DepthOnly"}
|
||||
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitPasses.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// This pass is used when drawing to a _CameraNormalsTexture texture
|
||||
Pass
|
||||
{
|
||||
Name "DepthNormals"
|
||||
Tags{"LightMode" = "DepthNormals"}
|
||||
|
||||
ZWrite On
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 2.0
|
||||
#pragma vertex DepthNormalOnlyVertex
|
||||
#pragma fragment DepthNormalOnlyFragment
|
||||
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#if UNITY_VERSION >= 60000000
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
||||
#endif
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
|
||||
#if VERSION_GREATER_EQUAL(12, 0)
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitDepthNormalsPass.hlsl"
|
||||
#else
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitPasses.hlsl"
|
||||
#endif
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "SceneSelectionPass"
|
||||
Tags { "LightMode" = "SceneSelectionPass" }
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma vertex DepthOnlyVertex
|
||||
#pragma fragment DepthOnlyFragment
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
|
||||
|
||||
#define SCENESELECTIONPASS
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitPasses.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// This pass it not used during regular rendering, only for lightmap baking.
|
||||
Pass
|
||||
{
|
||||
Name "Meta"
|
||||
Tags{"LightMode" = "Meta"}
|
||||
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex TerrainVertexMeta
|
||||
#pragma fragment TerrainFragmentMeta
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
|
||||
#pragma shader_feature EDITOR_VISUALIZATION
|
||||
#define _METALLICSPECGLOSSMAP 1
|
||||
#define _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 1
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitMetaPass.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
UsePass "Hidden/Nature/Terrain/Utilities/PICKING"
|
||||
}
|
||||
Dependency "AddPassShader" = "Hidden/Flat Kit/Terrain/Lit (Add Pass)"
|
||||
Dependency "BaseMapShader" = "Hidden/Universal Render Pipeline/Terrain/Lit (Base Pass)"
|
||||
Dependency "BaseMapGenShader" = "Hidden/Universal Render Pipeline/Terrain/Lit (Basemap Gen)"
|
||||
|
||||
Fallback "Hidden/Universal Render Pipeline/FallbackError"
|
||||
CustomEditor "FlatKit.TerrainEditor"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fea9ee138d4a84d90a0c3f187fb3cd8a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
148
Assets/FlatKit/Shaders/StylizedSurface/TerrainLitAdd_DR.shader
Normal file
148
Assets/FlatKit/Shaders/StylizedSurface/TerrainLitAdd_DR.shader
Normal file
@@ -0,0 +1,148 @@
|
||||
Shader "Hidden/Flat Kit/Terrain/Lit (Add Pass)"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
// Layer count is passed down to guide height-blend enable/disable, due
|
||||
// to the fact that heigh-based blend will be broken with multipass.
|
||||
[HideInInspector] [PerRendererData] _NumLayersCount ("Total Layer Count", Float) = 1.0
|
||||
|
||||
// set by terrain engine
|
||||
[HideInInspector] _Control("Control (RGBA)", 2D) = "red" {}
|
||||
[HideInInspector] _Splat3("Layer 3 (A)", 2D) = "white" {}
|
||||
[HideInInspector] _Splat2("Layer 2 (B)", 2D) = "white" {}
|
||||
[HideInInspector] _Splat1("Layer 1 (G)", 2D) = "white" {}
|
||||
[HideInInspector] _Splat0("Layer 0 (R)", 2D) = "white" {}
|
||||
[HideInInspector] _Normal3("Normal 3 (A)", 2D) = "bump" {}
|
||||
[HideInInspector] _Normal2("Normal 2 (B)", 2D) = "bump" {}
|
||||
[HideInInspector] _Normal1("Normal 1 (G)", 2D) = "bump" {}
|
||||
[HideInInspector] _Normal0("Normal 0 (R)", 2D) = "bump" {}
|
||||
[HideInInspector][Gamma] _Metallic0("Metallic 0", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector][Gamma] _Metallic1("Metallic 1", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector][Gamma] _Metallic2("Metallic 2", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector][Gamma] _Metallic3("Metallic 3", Range(0.0, 1.0)) = 0.0
|
||||
[HideInInspector] _Mask3("Mask 3 (A)", 2D) = "grey" {}
|
||||
[HideInInspector] _Mask2("Mask 2 (B)", 2D) = "grey" {}
|
||||
[HideInInspector] _Mask1("Mask 1 (G)", 2D) = "grey" {}
|
||||
[HideInInspector] _Mask0("Mask 0 (R)", 2D) = "grey" {}
|
||||
[HideInInspector] _Smoothness0("Smoothness 0", Range(0.0, 1.0)) = 1.0
|
||||
[HideInInspector] _Smoothness1("Smoothness 1", Range(0.0, 1.0)) = 1.0
|
||||
[HideInInspector] _Smoothness2("Smoothness 2", Range(0.0, 1.0)) = 1.0
|
||||
[HideInInspector] _Smoothness3("Smoothness 3", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
// used in fallback on old cards & base map
|
||||
[HideInInspector] _BaseMap("BaseMap (RGB)", 2D) = "white" {}
|
||||
[HideInInspector] _BaseColor("Main Color", Color) = (1,1,1,1)
|
||||
|
||||
[HideInInspector] _TerrainHolesTexture("Holes Map (RGB)", 2D) = "white" {}
|
||||
|
||||
/* start CurvedWorld */
|
||||
//[CurvedWorldBendSettings] _CurvedWorldBendSettings("0|1|1", Vector) = (0, 0, 0, 0)
|
||||
/* end CurvedWorld */
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#pragma multi_compile_fragment __ _ALPHATEST_ON
|
||||
|
||||
ENDHLSL
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry-99" "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "UniversalMaterialType" = "Lit" "IgnoreProjector" = "True"}
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl"
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "TerrainAddLit"
|
||||
Tags { "LightMode" = "UniversalForwardOnly" }
|
||||
Blend One One
|
||||
HLSLPROGRAM
|
||||
#pragma target 3.0
|
||||
|
||||
#pragma vertex SplatmapVert
|
||||
#pragma fragment SplatmapFragment_DSTRM
|
||||
|
||||
// -------------------------------------
|
||||
// Flat Kit
|
||||
#pragma shader_feature_local __ _CELPRIMARYMODE_SINGLE _CELPRIMARYMODE_STEPS _CELPRIMARYMODE_CURVE
|
||||
#pragma shader_feature_local DR_CEL_EXTRA_ON
|
||||
#pragma shader_feature_local DR_GRADIENT_ON
|
||||
#pragma shader_feature_local DR_SPECULAR_ON
|
||||
#pragma shader_feature_local DR_RIM_ON
|
||||
#pragma shader_feature_local __ _UNITYSHADOWMODE_MULTIPLY _UNITYSHADOWMODE_COLOR
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Pipeline keywords
|
||||
#if UNITY_VERSION >= 202130
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#else
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
#endif
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
|
||||
#if UNITY_VERSION >= 202130
|
||||
#pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
|
||||
#pragma multi_compile_fragment _ _LIGHT_LAYERS
|
||||
#pragma multi_compile_fragment _ _LIGHT_COOKIES
|
||||
#endif
|
||||
#if UNITY_VERSION >= 202220
|
||||
#pragma multi_compile _ _FORWARD_PLUS
|
||||
#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
|
||||
#endif
|
||||
|
||||
// -------------------------------------
|
||||
// Unity defined keywords
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile_fog
|
||||
#pragma multi_compile_instancing
|
||||
#if UNITY_VERSION >= 202230
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
#pragma multi_compile_fragment _ DEBUG_DISPLAY
|
||||
#endif
|
||||
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
|
||||
|
||||
#pragma shader_feature_local_fragment _TERRAIN_BLEND_HEIGHT
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _MASKMAP
|
||||
// Sample normal in pixel shader when doing instancing
|
||||
#pragma shader_feature_local _TERRAIN_INSTANCED_PERPIXEL_NORMAL
|
||||
#define TERRAIN_SPLAT_ADDPASS
|
||||
|
||||
#define FLATKIT_TERRAIN 1
|
||||
|
||||
// Detail map.
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#pragma shader_feature_local_fragment _DETAILMAPBLENDINGMODE_MULTIPLY _DETAILMAPBLENDINGMODE_ADD _DETAILMAPBLENDINGMODE_INTERPOLATE
|
||||
|
||||
TEXTURE2D(_DetailMap);
|
||||
SAMPLER(sampler_DetailMap);
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitPasses.hlsl"
|
||||
#include "LibraryUrp/StylizedInput.hlsl"
|
||||
#include "LibraryUrp/Lighting_DR.hlsl"
|
||||
#include "LibraryUrp/TerrainLitPasses_DR.hlsl"
|
||||
|
||||
/* start CurvedWorld */
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
/* end CurvedWorld */
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
Fallback "Hidden/Universal Render Pipeline/FallbackError"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dadb9806728143bfafa4261c249e63b
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user