TimelineImprovements
This commit is contained in:
1 parent
e312131725
commit
f927552adc
2211 files changed
+115416
-540944
No files matched your search
@@ -188,6 +188,10 @@
|
||||
Surface surface = InitSurface(surfaceData, PASS_SAMPLER_2D(_AlbedoMap), _AlbedoColor, vertexOutputLight.SV_CLIP_POS);
|
||||
MKPBSData pbsData = ComputePBSData(surface, surfaceData);
|
||||
|
||||
#if defined(MK_URP) && UNITY_VERSION >= 60070000 && defined(MK_LIT)
|
||||
ComputeBakedGI(surfaceData);
|
||||
#endif
|
||||
|
||||
#ifdef MK_LIT
|
||||
//Init per mainLight
|
||||
MKLight mainLight = ComputeMainLight(surfaceData, vertexOutputLight);
|
||||
@@ -209,10 +213,10 @@
|
||||
}
|
||||
|
||||
#if defined(_ADDITIONAL_LIGHTS)
|
||||
half4 gD = surface.goochDark;
|
||||
MK_LIGHT_ACCUM4 gD = surface.goochDark;
|
||||
surface.goochDark = 0;
|
||||
uint additionalLightCount = GetAdditionalLightsCount();
|
||||
half4 additionalDirect = 0;
|
||||
MK_LIGHT_ACCUM4 additionalDirect = 0;
|
||||
|
||||
MKLight additionalLight;
|
||||
MKLightData additionalLightData;
|
||||
@@ -261,10 +265,10 @@
|
||||
}
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS
|
||||
half4 gD = surface.goochDark;
|
||||
MK_LIGHT_ACCUM4 gD = surface.goochDark;
|
||||
surface.goochDark = 0;
|
||||
uint additionalLightCount = GetAdditionalLightsCount();
|
||||
half4 additionalDirect = 0;
|
||||
MK_LIGHT_ACCUM4 additionalDirect = 0;
|
||||
|
||||
MKLight additionalLight;
|
||||
MKLightData additionalLightData;
|
||||
@@ -300,10 +304,10 @@
|
||||
#else
|
||||
LightingDirect(surface, surfaceData, pbsData, mainLight, lightData, surface.direct);
|
||||
#ifdef _ADDITIONAL_LIGHTS
|
||||
half4 gD = surface.goochDark;
|
||||
MK_LIGHT_ACCUM4 gD = surface.goochDark;
|
||||
surface.goochDark = 0;
|
||||
uint additionalLightCount = GetAdditionalLightsCount();
|
||||
half4 additionalDirect = 0;
|
||||
MK_LIGHT_ACCUM4 additionalDirect = 0;
|
||||
|
||||
for (uint lightIndex = 0u; lightIndex < additionalLightCount; ++lightIndex)
|
||||
{
|
||||
@@ -323,6 +327,61 @@
|
||||
//Finalize the output
|
||||
Composite(surface, surfaceData, pbsData);
|
||||
|
||||
#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.positionCS = surfaceData.svPositionClip;
|
||||
debugInput.normalWS = surfaceData.vertexNormalWorld;
|
||||
debugInput.viewDirectionWS = GetWorldSpaceNormalizeViewDir(surfaceData.positionWorld);
|
||||
debugInput.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(surfaceData.svPositionClip);
|
||||
debugInput.preExposureMultiplier = GetPreExposureMultiplier();
|
||||
debugSurface.albedo = surface.albedo;
|
||||
debugSurface.alpha = surface.alpha;
|
||||
debugSurface.metallic = pbsData.metallic;
|
||||
debugSurface.specular = pbsData.specular;
|
||||
debugSurface.smoothness = pbsData.smoothness;
|
||||
debugSurface.normalTS = half3(0, 0, 1);
|
||||
debugSurface.occlusion = 1;
|
||||
#ifdef MK_LIT
|
||||
debugInput.normalWS = surfaceData.normalWorld;
|
||||
debugInput.bakedGI = surfaceData.bakedGI;
|
||||
debugSurface.occlusion = surface.occlusion.r;
|
||||
#ifdef MK_TBN
|
||||
debugSurface.normalTS = mul(half3x3(surfaceData.tangentWorld, surfaceData.bitangentWorld, surfaceData.vertexNormalWorld), surfaceData.normalWorld);
|
||||
#endif
|
||||
#ifdef MK_EMISSION
|
||||
debugSurface.emission = surface.emission;
|
||||
#endif
|
||||
#endif
|
||||
SETUP_DEBUG_TEXTURE_DATA(debugInput, surfaceData.rawUV);
|
||||
debugInput.originalColor = surface.albedo;
|
||||
SetupDebugDataBrdf(debugInput, pbsData.diffuseRadiance, pbsData.specularRadiance);
|
||||
half4 debugColor = 0;
|
||||
bool debugOverride = CalculateColorForDebug(debugInput, debugSurface, debugColor);
|
||||
if (_DebugMaterialMode == DEBUGMATERIALMODE_LIGHTING_COMPLEXITY)
|
||||
{
|
||||
debugColor = CalculateDebugLightingComplexityColor(debugInput, debugSurface);
|
||||
debugOverride = true;
|
||||
}
|
||||
else if (_DebugLightingMode == DEBUGLIGHTINGMODE_GLOBAL_ILLUMINATION)
|
||||
{
|
||||
debugColor = half4(ClampExposed(debugInput.bakedGI * debugInput.preExposureMultiplier), surface.alpha);
|
||||
debugOverride = true;
|
||||
}
|
||||
#ifdef MK_LIT
|
||||
if (IsOnlyAOLightingFeatureEnabled())
|
||||
{
|
||||
debugColor = half4(surface.occlusion.rrr, surface.alpha);
|
||||
debugOverride = true;
|
||||
}
|
||||
#endif
|
||||
if (debugOverride)
|
||||
surface.final = debugColor;
|
||||
#endif
|
||||
|
||||
mkFragmentOutput.svTarget0 = surface.final;
|
||||
#ifdef MK_WRITE_RENDERING_LAYERS
|
||||
#if UNITY_VERSION >= 60020000
|
||||
|
||||
Reference in new issue
Block a user