{
public const uint k_MaxCascadesInShader = 4;
protected readonly int m_TempDepthId;
protected readonly int m_ZClipId;
protected RenderTexture m_Shadowmap;
protected RenderTargetIdentifier m_ShadowmapId;
protected VectorArray<CachedEntry> m_EntryCache = new VectorArray<CachedEntry>( 0, true );
public Key key;
public Data current;
public Data previous;
public bool zclip;
public int CompareTo( CachedEntry other )
public ShadowAtlas( ref AtlasInit init ) : base( ref init.baseInit )
m_ZClipId = Shader.PropertyToID( "_ZClip" );
if( !IsNativeDepth() )
m_TempDepthId = Shader.PropertyToID( "Temporary Shadowmap Depth" );
// read
float texelSizeX = 1.0f, texelSizeY = 1.0f;
CachedEntry ce = m_EntryCache[ceIdx];
ce.zclip = sr.shadowType != GPUShadowType.Directional;
// modify
Matrix4x4 vp, invvp;
if( sr.shadowType == GPUShadowType.Point )
cmd.SetViewport( m_EntryCache[i].current.viewport );
cmd.SetViewProjectionMatrices( m_EntryCache[i].current.view, m_EntryCache[i].current.proj );
cmd.SetGlobalVector( "g_vLightDirWs", m_EntryCache[i].current.lightDir );
cmd.SetGlobalFloat( m_ZClipId, m_EntryCache[i].zclip ? 1.0f : 0.0f );
//cmd.EndSample(cbName);
dss.lightIndex = m_EntryCache[i].key.visibleIdx;
cmd.EndSample("Shadowmap.DisableShaderKeyword");
}
cmd.SetGlobalFloat( m_ZClipId, 1.0f ); // Re-enable zclip globally
m_ActiveEntriesCount = 0;
profilingSample.Dispose();
Cull[_CullMode]
ZClip Off
ZClip [_ZClip]
ZWrite On
ZTest LEqual