浏览代码

Remove ShadowAlgorithmsCustom

/main
Peter Bay Bastian 7 年前
当前提交
0bdd58c1
共有 3 个文件被更改,包括 0 次插入50 次删除
  1. 1
      ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/Shadow.hlsl
  2. 9
      ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/ShadowAlgorithmsCustom.hlsl.meta
  3. 40
      ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/ShadowAlgorithmsCustom.hlsl

1
ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/Shadow.hlsl


#include "ShadowSampling.hlsl" // sampling patterns (don't modify)
#include "ShadowAlgorithms.hlsl" // engine default algorithms (don't modify)
#include "ShadowAlgorithmsCustom.hlsl" // project specific custom algorithms (project can modify this)
#ifndef SHADOW_DISPATCH_USE_CUSTOM_PUNCTUAL
float GetPunctualShadowAttenuation( ShadowContext shadowContext, float3 positionWS, float3 normalWS, int shadowDataIndex, float4 L )

9
ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/ShadowAlgorithmsCustom.hlsl.meta


fileFormatVersion: 2
guid: aa4f463e1cdf08f42934e66c91cd612e
timeCreated: 1491321444
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

40
ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/ShadowAlgorithmsCustom.hlsl


// This file is empty on purpose. Projects can put their custom shadow algorithms in here so they get automatically included by Shadow.hlsl.
float EvalShadow_CascadedMoment( ShadowContext shadowContext, float3 positionWS, float3 normalWS, int shadowDataIndex, float3 L )
{
ShadowData sd = shadowContext.shadowDatas[shadowDataIndex];
// normal based bias
positionWS += EvalShadow_NormalBias( normalWS, saturate( dot( normalWS, L ) ), sd.texelSizeRcp.zw, sd.normalBias );
// load the right shadow data for the current face
float4 dirShadowSplitSpheres[4];
uint payloadOffset = EvalShadow_LoadSplitSpheres( shadowContext, shadowDataIndex, dirShadowSplitSpheres );
int shadowSplitIndex = EvalShadow_GetSplitSphereIndexForDirshadows( positionWS, dirShadowSplitSpheres );
if (shadowSplitIndex < 0)
return 1.0;
// get the shadowmap data for the correct cascade
sd = shadowContext.shadowDatas[shadowDataIndex + 1 + shadowSplitIndex];
// get shadowmap texcoords
float3 posTC = EvalShadow_GetTexcoords( sd, positionWS );
// sample the texture
uint texIdx, sampIdx;
float slice;
UnpackShadowmapId( sd.id, texIdx, sampIdx, slice );
uint shadowType, shadowAlgorithm;
UnpackShadowType( sd.shadowType, shadowType, shadowAlgorithm );
switch( shadowAlgorithm )
{
case (GPUSHADOWALGORITHM_CUSTOM + 1): return 1.0;
default: return SampleShadow_SelectAlgorithm( shadowContext, sd, payloadOffset, posTC, sd.bias, slice, shadowAlgorithm, texIdx, sampIdx );
}
}
float EvalShadow_CascadedMoment( ShadowContext shadowContext, float3 positionWS, float3 normalWS, int shadowDataIndex, float3 L, float2 unPositionSS )
{
return EvalShadow_CascadedMoment( shadowContext, positionWS, normalWS, shadowDataIndex, L );
}
正在加载...
取消
保存