浏览代码
Merge pull request #398 from Unity-Technologies/Branch_DeferredDirShadow
Merge pull request #398 from Unity-Technologies/Branch_DeferredDirShadow
Branch deferreddirshadow/main
GitHub
7 年前
当前提交
02239cb4
共有 25 个文件被更改,包括 835 次插入 和 47 次删除
-
480SampleScenes/HDTest/ShadowsTest.unity
-
41ScriptableRenderPipeline/Core/ShaderLibrary/Shadow/ShadowAlgorithms.hlsl
-
11ScriptableRenderPipeline/Core/Shadow/Shadow.cs
-
1ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
-
13ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs.hlsl
-
5ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugFullScreen.shader
-
29ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
4ScriptableRenderPipeline/HDRenderPipeline/HDShaderIDs.cs
-
42ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.hlsl
-
2ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
2ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
4ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
2ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
2ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
10ScriptableRenderPipeline/HDRenderPipeline/Material/Material.hlsl
-
6ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Editor/BaseUnlitUI.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Unlit.shader
-
2ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/HDRenderPipelineResources.asset
-
5ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/RenderPipelineResources.cs
-
159SampleScenes/HDTest/Material/HDRenderLoopMaterials/Grid_Red_Transparent_Planar.mat
-
10SampleScenes/HDTest/Material/HDRenderLoopMaterials/Grid_Red_Transparent_Planar.mat.meta
-
10SampleScenes/HDTest/ShadowsTest.meta
-
28ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/DeferredDirectionalShadow.compute
-
10ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/DeferredDirectionalShadow.compute.meta
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!21 &2100000 |
|||
Material: |
|||
serializedVersion: 6 |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_Name: Grid_Red_Transparent_Planar |
|||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3} |
|||
m_ShaderKeywords: _ALPHACUTOFFENABLE_OFF _BLENDMODE_LERP _DEPTHOFFSETENABLE_OFF |
|||
_DISTORTIONDEPTHTEST_OFF _DISTORTIONENABLE_OFF _DISTORTIONONLY_OFF _DOUBLESIDEDENABLE_OFF |
|||
_ENABLEPERPIXELDISPLACEMENT_OFF _ENABLEWIND_OFF _MAPPING_PLANAR _NORMALMAP_TANGENT_SPACE |
|||
m_LightmapFlags: 4 |
|||
m_EnableInstancingVariants: 0 |
|||
m_DoubleSidedGI: 0 |
|||
m_CustomRenderQueue: 3000 |
|||
stringTagMap: |
|||
RenderType: Transparent |
|||
disabledShaderPasses: |
|||
- DistortionVectors |
|||
m_SavedProperties: |
|||
serializedVersion: 3 |
|||
m_TexEnvs: |
|||
- _AnisotropyMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BaseColorMap: |
|||
m_Texture: {fileID: 2800000, guid: fef12d96364197f49b3aac63e72bf9d9, type: 3} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BentNormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _BentNormalMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DetailMask: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _DistortionVectorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _EmissiveColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _HeightMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _MaskMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _NormalMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _NormalMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecularColorMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SpecularOcclusionMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _SubsurfaceRadiusMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _TangentMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _TangentMapOS: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
- _ThicknessMap: |
|||
m_Texture: {fileID: 0} |
|||
m_Scale: {x: 1, y: 1} |
|||
m_Offset: {x: 0, y: 0} |
|||
m_Floats: |
|||
- _AlbedoAffectEmissive: 0 |
|||
- _AlphaCutoff: 0.5 |
|||
- _AlphaCutoffEnable: 0 |
|||
- _Anisotropy: 0 |
|||
- _BlendMode: 0 |
|||
- _CoatCoverage: 1 |
|||
- _CoatIOR: 0.5 |
|||
- _CullMode: 2 |
|||
- _DepthOffsetEnable: 0 |
|||
- _DetailAlbedoScale: 1 |
|||
- _DetailNormalScale: 1 |
|||
- _DetailSmoothnessScale: 1 |
|||
- _DistortionDepthTest: 0 |
|||
- _DistortionEnable: 0 |
|||
- _DistortionOnly: 0 |
|||
- _DoubleSidedEnable: 0 |
|||
- _DoubleSidedNormalMode: 1 |
|||
- _Drag: 1 |
|||
- _DstBlend: 10 |
|||
- _EmissiveColorMode: 1 |
|||
- _EmissiveIntensity: 0 |
|||
- _EnablePerPixelDisplacement: 0 |
|||
- _EnableSpecularOcclusion: 0 |
|||
- _EnableWind: 0 |
|||
- _HeightAmplitude: 0.01 |
|||
- _HeightCenter: 0.5 |
|||
- _HeightMax: 1 |
|||
- _HeightMin: -1 |
|||
- _HorizonFade: 1 |
|||
- _InitialBend: 1 |
|||
- _MaterialID: 1 |
|||
- _Metallic: 0 |
|||
- _NormalMapSpace: 0 |
|||
- _NormalScale: 1 |
|||
- _PPDLodThreshold: 5 |
|||
- _PPDMaxSamples: 15 |
|||
- _PPDMinSamples: 5 |
|||
- _ShiverDirectionality: 0.5 |
|||
- _ShiverDrag: 0.2 |
|||
- _Smoothness: 0 |
|||
- _SmoothnessRemapMax: 1 |
|||
- _SmoothnessRemapMin: 0 |
|||
- _SrcBlend: 5 |
|||
- _StencilRef: 2 |
|||
- _Stiffness: 1 |
|||
- _SubsurfaceProfile: 0 |
|||
- _SubsurfaceRadius: 1 |
|||
- _SurfaceType: 1 |
|||
- _TexWorldScale: 1 |
|||
- _Thickness: 1 |
|||
- _UVBase: 4 |
|||
- _UVDetail: 0 |
|||
- _ZTestMode: 8 |
|||
- _ZWrite: 0 |
|||
m_Colors: |
|||
- _BaseColor: {r: 1, g: 0.46274495, b: 0.46274495, a: 0.816} |
|||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} |
|||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1} |
|||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1} |
|||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0} |
|||
- _UVMappingMask: {r: 0, g: 0, b: 0, a: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: f473ec9e1cd032545b8de43885028638 |
|||
timeCreated: 1504540207 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 2100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 37b64947bf0ad024fb931d24f17a52b7 |
|||
folderAsset: yes |
|||
timeCreated: 1504864302 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// Each #kernel tells which function to compile; you can have many kernels |
|||
#pragma kernel DeferredDirectionalShadow |
|||
|
|||
#include "../../../Core/ShaderLibrary/Common.hlsl" |
|||
#include "../../ShaderVariables.hlsl" |
|||
#include "../../Lighting/Lighting.hlsl" |
|||
|
|||
RWTexture2D<float4> _DeferredShadowTextureUAV; |
|||
float _DirectionalShadowIndex; |
|||
|
|||
#define DEFERRED_SHADOW_TILE_SIZE 16 |
|||
|
|||
[numthreads(DEFERRED_SHADOW_TILE_SIZE, DEFERRED_SHADOW_TILE_SIZE, 1)] |
|||
void DeferredDirectionalShadow(uint2 groupThreadId : SV_GroupThreadID, uint2 groupId : SV_GroupID) |
|||
{ |
|||
uint2 pixelCoord = groupId * DEFERRED_SHADOW_TILE_SIZE + groupThreadId; |
|||
uint2 tileCoord = groupId; |
|||
|
|||
PositionInputs posInput = GetPositionInput(pixelCoord.xy, _ScreenSize.zw, tileCoord); |
|||
|
|||
float depth = LOAD_TEXTURE2D(_MainDepthTexture, posInput.unPositionSS).x; |
|||
UpdatePositionInput(depth, _InvViewProjMatrix, _ViewProjMatrix, posInput); |
|||
|
|||
ShadowContext shadowContext = InitShadowContext(); |
|||
float shadow = GetDirectionalShadowAttenuation(shadowContext, posInput.positionWS, float3(0.0, 0.0, 0.0), (uint)_DirectionalShadowIndex, float3(0.0, 0.0, 0.0)); |
|||
|
|||
_DeferredShadowTextureUAV[pixelCoord] = float4(shadow.xxx, 0.0); |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fbde6fae193b2a94e9fd97c163c204f4 |
|||
timeCreated: 1505129983 |
|||
licenseType: Pro |
|||
ComputeShaderImporter: |
|||
externalObjects: {} |
|||
currentAPIMask: 8196 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue