TimelineImprovements

This commit is contained in:
ThomasCharester committed 2026-11-20 14:28:56 +03:00
1 parent e312131725
commit f927552adc
2211 files changed
+115416 -540944

No files matched your search

+89 -20
View File
@@ -25,16 +25,19 @@
#if defined(MK_DEPTH_NORMALS_PASS) || defined(MK_LIT)
half3 normalWorld;
#endif
#ifdef MK_TBN
half3 tangentWorld;
half3 bitangentWorld;
#endif
#ifdef MK_LIT
#if defined(MK_URP) && UNITY_VERSION >= 60070000
MK_LIGHT_ACCUM3 bakedGI;
#endif
#ifdef MK_LIGHTMAP_UV
float4 lightmapUV;
#endif
#ifdef MK_VERTEX_LIGHTING
half3 vertexLighting;
#endif
#ifdef MK_TBN
half3 tangentWorld;
half3 bitangentWorld;
MK_LIGHT_ACCUM3 vertexLighting;
#endif
#ifdef MK_PARALLAX
half height;
@@ -124,8 +127,8 @@
half smoothness;
half metallic;
half3 specular;
half3 diffuseRadiance;
half3 specularRadiance;
MK_LIGHT_ACCUM3 diffuseRadiance;
MK_LIGHT_ACCUM3 specularRadiance;
#ifdef MK_FRESNEL_HIGHLIGHTS
half3 fresnel;
#endif
@@ -134,14 +137,14 @@
//dynamic surface struct
struct Surface
{
half4 final;
half3 albedo;
MK_LIGHT_ACCUM4 final;
MK_LIGHT_ACCUM3 albedo;
#ifdef MK_DETAIL_MAP
half4 detail;
#endif
half alpha;
#ifdef MK_REFRACTION
half3 refraction;
MK_LIGHT_ACCUM3 refraction;
#endif
// RGB - RAW
@@ -150,15 +153,15 @@
#ifdef MK_THRESHOLD_MAP
half thresholdOffset;
#endif
half4 goochBright;
half4 goochDark;
MK_LIGHT_ACCUM4 goochBright;
MK_LIGHT_ACCUM4 goochDark;
half2 occlusion;
#ifdef MK_EMISSION
half3 emission;
MK_LIGHT_ACCUM3 emission;
#endif
half3 indirect;
half4 direct;
MK_LIGHT_ACCUM3 indirect;
MK_LIGHT_ACCUM4 direct;
#ifdef MK_ARTISTIC
#if defined(MK_ARTISTIC_DRAWN) || defined(MK_ARTISTIC_SKETCH)
@@ -286,7 +289,7 @@
}
//Texture color
inline void SurfaceColor(out half3 albedo, out half alpha, DECLARE_SAMPLER_2D_ARGS(albedoMap), float2 uv, float3 blendUV, half4 color)
inline void SurfaceColor(out MK_LIGHT_ACCUM3 albedo, out half alpha, DECLARE_SAMPLER_2D_ARGS(albedoMap), float2 uv, float3 blendUV, half4 color)
{
half4 c;
#ifdef MK_OUTLINE_PASS
@@ -303,7 +306,7 @@
#endif
}
inline void SurfaceColor(out half3 albedo, out half alpha, DECLARE_SAMPLER_2D_ARGS(albedoMap), DECLARE_SAMPLER_2D_ARGS(albedoMap1), DECLARE_SAMPLER_2D_ARGS(albedoMap2), DECLARE_SAMPLER_2D_ARGS(albedoMap3), float2 uv, half4 blendColor, float3 blendUV, half4 color)
inline void SurfaceColor(out MK_LIGHT_ACCUM3 albedo, out half alpha, DECLARE_SAMPLER_2D_ARGS(albedoMap), DECLARE_SAMPLER_2D_ARGS(albedoMap1), DECLARE_SAMPLER_2D_ARGS(albedoMap2), DECLARE_SAMPLER_2D_ARGS(albedoMap3), float2 uv, half4 blendColor, float3 blendUV, half4 color)
{
half4 c0, c1, c2, c3;
#ifdef MK_OUTLINE_PASS
@@ -329,7 +332,7 @@
}
//Non texture color
inline void SurfaceColor(out half3 albedo, out half alpha, half4 vertexColor, half4 color)
inline void SurfaceColor(out MK_LIGHT_ACCUM3 albedo, out half alpha, half4 vertexColor, half4 color)
{
half4 c = vertexColor * color;
albedo = c.rgb;
@@ -365,7 +368,7 @@
, in half3 normalWorld
#endif
#ifdef MK_VERTEX_LIGHTING
, in half3 vertexLighting
, in MK_LIGHT_ACCUM3 vertexLighting
#endif
#if defined(MK_TBN)
, in half3 tangentWorld
@@ -496,6 +499,13 @@
#if defined(MK_SCREEN_SPACE_OCCLUSION) && defined(MK_URP_2020_2_Or_Newer)
surfaceData.ambientOcclusion = GetScreenSpaceAmbientOcclusion(surfaceData.screenUV.xy);
#if defined(MK_URP) && UNITY_VERSION >= 60070000 && defined(DEBUG_DISPLAY)
if (!IsLightingFeatureEnabled(DEBUGLIGHTINGFEATUREFLAGS_AMBIENT_OCCLUSION))
{
surfaceData.ambientOcclusion.directAmbientOcclusion = 1;
surfaceData.ambientOcclusion.indirectAmbientOcclusion = 1;
}
#endif
#endif
#if defined(MK_ARTISTIC)
@@ -689,7 +699,9 @@
half4 pbsInput;
#if defined(MK_WORKFLOW_METALLIC)
#if defined(MK_URP) && UNITY_VERSION >= 60070000 && !defined(MK_LIT)
pbsInput = half4(0, 0, 0, 1);
#elif defined(MK_WORKFLOW_METALLIC)
#ifdef MK_PBS_MAP_0
pbsInput = SAMPLE_TEX2D_FLIPBOOK(_MetallicMap, SAMPLER_REPEAT_MAIN, surfaceData.baseUV.xy, SURFACE_FLIPBOOK_UV).rrra;
pbsInput.a *= _Smoothness;
@@ -776,6 +788,53 @@
#endif
#endif
#if defined(MK_URP) && UNITY_VERSION >= 60070000 && defined(DEBUG_DISPLAY)
InputData debugInput;
INITIALIZE_STRUCT(InputData, debugInput);
SurfaceData debugSurface;
INITIALIZE_STRUCT(SurfaceData, debugSurface);
debugInput.positionWS = surfaceData.positionWorld;
debugInput.normalWS = surfaceData.vertexNormalWorld;
#ifdef MK_LIT
debugInput.normalWS = surfaceData.normalWorld;
debugSurface.occlusion = surface.occlusion.r;
#ifdef MK_EMISSION
debugSurface.emission = surface.emission;
#endif
#endif
#ifdef MK_TBN
debugInput.tangentToWorld = half3x3(surfaceData.tangentWorld, surfaceData.bitangentWorld, surfaceData.vertexNormalWorld);
#endif
debugSurface.albedo = surface.albedo;
debugSurface.alpha = surface.alpha;
debugSurface.metallic = pbsData.metallic;
debugSurface.specular = pbsData.specular;
debugSurface.smoothness = pbsData.smoothness;
UpdateSurfaceAndInputDataForDebug(debugSurface, debugInput);
if (!IsLightingFeatureEnabled(DEBUGLIGHTINGFEATUREFLAGS_AMBIENT_OCCLUSION))
debugSurface.occlusion = 1;
if (_DebugLightingMode == DEBUGLIGHTINGMODE_SHADOW_CASCADES)
debugSurface.albedo = CalculateDebugShadowCascadeColor(debugInput);
surface.albedo = debugSurface.albedo;
pbsData.metallic = debugSurface.metallic;
pbsData.specular = debugSurface.specular;
pbsData.smoothness = debugSurface.smoothness;
#ifdef MK_LIT
surfaceData.normalWorld = debugInput.normalWS;
surface.occlusion.r = debugSurface.occlusion;
#ifdef MK_EMISSION
surface.emission = debugSurface.emission;
#endif
#ifdef MK_V_DOT_N
surfaceData.VoN = saturate(dot(surfaceData.viewWorld, surfaceData.normalWorld));
surfaceData.OneMinusVoN = 1.0 - surfaceData.VoN;
#endif
#ifdef MK_MV_REF_N
surfaceData.MVrN = reflect(-surfaceData.viewWorld, surfaceData.normalWorld);
#endif
#endif
#endif
#if defined(MK_WORKFLOW_METALLIC)
pbsData.oneMinusReflectivity = K_SPEC_DIELECTRIC_MAX - pbsData.metallic * K_SPEC_DIELECTRIC_MAX;
pbsData.reflectivity = 1.0 - pbsData.oneMinusReflectivity;
@@ -798,6 +857,16 @@
pbsData.specularRadiance = pbsData.specular.rgb;
#endif
#if defined(MK_URP) && UNITY_VERSION >= 60070000 && defined(DEBUG_DISPLAY)
if (_DebugLightingMode == DEBUGLIGHTINGMODE_REFLECTIONS || _DebugLightingMode == DEBUGLIGHTINGMODE_REFLECTIONS_WITH_SMOOTHNESS)
{
pbsData.diffuseRadiance = 0;
pbsData.specularRadiance = 1;
pbsData.reflectivity = 1;
pbsData.oneMinusReflectivity = 0;
}
#endif
pbsData.roughness = 1.0 - pbsData.smoothness;
#if defined(MK_ENVIRONMENT_REFLECTIONS) || defined(MK_SPECULAR) || defined(MK_DIFFUSE_OREN_NAYAR) || defined(MK_DIFFUSE_MINNAERT)
pbsData.roughnessPow2 = FastPow2(pbsData.roughness);