Added UtsSingleLightLoop
This commit is contained in:
59
Runtime/Shaders/Includes/Lighting/UtsSingleLightLoop.hlsl
Normal file
59
Runtime/Shaders/Includes/Lighting/UtsSingleLightLoop.hlsl
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef UTS_SINGLE_LIGHT_LOOP
|
||||
#define UTS_SINGLE_LIGHT_LOOP
|
||||
|
||||
#include "Packages/com.misaki.hdrp-toon/Runtime/Models/SurfaceFeature.cs.hlsl"
|
||||
#include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Common/UtsSurfaceFeatureEvaluation.hlsl"
|
||||
#include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Lighting/UtsLightEvaluation.hlsl"
|
||||
|
||||
struct UtsSingleMainLight
|
||||
{
|
||||
GPULightType lightType;
|
||||
uint lightIndex;
|
||||
};
|
||||
|
||||
int GetMainLightIndex(BuiltinData builtinData)
|
||||
{
|
||||
int mainLightIndex = -1;
|
||||
|
||||
if (featureFlags & LIGHTFEATUREFLAGS_DIRECTIONAL)
|
||||
{
|
||||
DirectionalLightData light = _DirectionalLightDatas[_DirectionalShadowIndex];
|
||||
|
||||
if ((light.lightDimmer > 0) && (light.shadowDimmer > 0) && IsMatchingLightLayer(light.lightLayers, builtinData.renderingLayers))
|
||||
{
|
||||
SHADOW_TYPE shadowValue = GetDirectionalShadowAttenuation(context.shadowContext,
|
||||
posInput.positionSS, _ObjectCenterPositionWS + L * _ShadowDistanceBias, UtsGetShadowNormal(bsdfData),
|
||||
light.shadowIndex, L);
|
||||
|
||||
if (length(shadowValue) > 0.0)
|
||||
{
|
||||
mainLightIndex = _DirectionalShadowIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mainLightIndex;
|
||||
}
|
||||
|
||||
// TODO: The process of finding main light index should be move to vertex stage
|
||||
void UtsSingleLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bsdfData, BuiltinData builtinData,
|
||||
float3 V, uint featureFlags, out LightLoopOutput lightLoopOutput)
|
||||
{
|
||||
PreLightData preLightData = GetPreLightData_UTS(V, posInput, bsdfData);
|
||||
|
||||
AggregateLighting aggregateLighting;
|
||||
ZERO_INITIALIZE(AggregateLighting, aggregateLighting);
|
||||
|
||||
#if _USER_LIGHT_SOURCE_LOOP_ON
|
||||
|
||||
#else
|
||||
int mainLightIndex = GetMainLightIndex(builtinData);
|
||||
|
||||
if (mainLightIndex != -1 && featureFlags & LIGHTFEATUREFLAGS_PUNCTUAL)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user