Filip Iliescu
7 年前
当前提交
28a25cc0
共有 82 个文件被更改,包括 5328 次插入 和 1324 次删除
-
4Assets/GraphicsTests/RenderPipeline/HDRenderPipeline/HDRPAsset/HDRenderPipelineResourcesTest.asset
-
108Assets/ScriptableRenderPipeline/BasicRenderPipeline/BasicRenderPipeline.cs
-
4Assets/ScriptableRenderPipeline/BasicRenderPipeline/BasicRenderPipelineShader.shader
-
11Assets/ScriptableRenderPipeline/Core/Shadow/AdditionalShadowData.cs
-
45Assets/ScriptableRenderPipeline/Core/Shadow/Shadow.cs
-
2Assets/ScriptableRenderPipeline/Core/Shadow/ShadowBase.cs
-
12Assets/ScriptableRenderPipeline/Core/Shadow/ShadowBase.cs.hlsl
-
56Assets/ScriptableRenderPipeline/Core/Shadow/ShadowUtilities.cs
-
5Assets/ScriptableRenderPipeline/Core/Shadow/VectorArray.cs
-
2Assets/ScriptableRenderPipeline/Fptl/ShadowDispatch.hlsl
-
5Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewMaterialGBuffer.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewTiles.shader
-
33Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
-
320Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
581Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.asset
-
15Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusion.cs
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusion.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/ScreenSpaceAmbientOcclusionSettings.cs
-
18Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Deferred.shader
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Forward.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/ShadowDispatch.hlsl
-
532Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs.hlsl
-
34Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.hlsl
-
265Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/materialflags.compute
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
95Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
27Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CopyStencilBuffer.shader
-
223Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.shader
-
154Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SSSProfile/SkinSSSProfile.asset
-
117Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Unlit.shader
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/CameraMotionVectors.shader
-
5Assets/ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/HDRenderPipelineResources.asset
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/RenderPipelineResources.cs
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariables.hlsl
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISkyRenderer.cs
-
5Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
-
96Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs
-
4Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipeline.shader
-
2Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPipelineCore.cginc
-
7Assets/ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader
-
1Assets/ScriptableRenderPipeline/ShaderLibrary/API/D3D11.hlsl
-
1Assets/ScriptableRenderPipeline/ShaderLibrary/API/Metal.hlsl
-
1Assets/ScriptableRenderPipeline/ShaderLibrary/API/PSSL.hlsl
-
14Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl
-
2Assets/ScriptableRenderPipeline/ShaderLibrary/Shadow/Shadow.hlsl
-
442Assets/ScriptableRenderPipeline/ShaderLibrary/Shadow/ShadowAlgorithms.hlsl
-
19Assets/ScriptableRenderPipeline/ShaderLibrary/Shadow/ShadowTexFetch.hlsl
-
2Assets/TestScenes/HDTest/GraphicTest/SSS/Materials/SSSHead.mat
-
2Assets/TestScenes/HDTest/Material/HDRenderLoopMaterials/GGX Test/GGX_a02_s00.mat
-
34ProjectSettings/DynamicsManager.asset
-
6ProjectSettings/ProjectSettings.asset
-
2ProjectSettings/ProjectVersion.txt
-
177Assets/ScriptableRenderPipeline/HDRenderPipeline/HDShaderIDs.cs
-
13Assets/ScriptableRenderPipeline/HDRenderPipeline/HDShaderIDs.cs.meta
-
172Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Deferred.compute
-
428Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.compute
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.compute.meta
-
66Assets/ScriptableRenderPipeline/ShaderLibrary/Noise.hlsl
-
10Assets/ScriptableRenderPipeline/ShaderLibrary/Noise.hlsl.meta
-
72Assets/ScriptableRenderPipeline/ShaderLibrary/SpaceFillingCurves.hlsl
-
10Assets/ScriptableRenderPipeline/ShaderLibrary/SpaceFillingCurves.hlsl.meta
-
116Assets/TestScenes/HDTest/GraphicTest/SSS/ProfilingSkinSSSProfile.asset
-
9Assets/TestScenes/HDTest/GraphicTest/SSS/ProfilingSkinSSSProfile.asset.meta
-
1001Assets/TestScenes/HDTest/GraphicTest/SSS/Test - SSS model .prefab
-
10Assets/TestScenes/HDTest/GraphicTest/SSS/Test - SSS model .prefab.meta
-
1001Assets/TestScenes/HDTest/SSSProfiling.unity
-
9Assets/TestScenes/HDTest/SSSProfiling.unity.meta
-
159Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/shadeopaque.compute
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SSSProfile/Resources.meta
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Resources.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Deferred.compute.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.shader.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.shader
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!55 &1 |
|||
PhysicsManager: |
|||
m_ObjectHideFlags: 0 |
|||
m_Gravity: {x: 0, y: -9.81000042, z: 0} |
|||
m_DefaultMaterial: {fileID: 0} |
|||
m_BounceThreshold: 2 |
|||
m_SleepThreshold: .00499999989 |
|||
m_DefaultContactOffset: .00999999978 |
|||
m_SolverIterationCount: 6 |
|||
m_RaycastsHitTriggers: 1 |
|||
m_EnableAdaptiveForce: 0 |
|||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!55 &1 |
|||
PhysicsManager: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 3 |
|||
m_Gravity: {x: 0, y: -9.81, z: 0} |
|||
m_DefaultMaterial: {fileID: 0} |
|||
m_BounceThreshold: 2 |
|||
m_SleepThreshold: 0.005 |
|||
m_DefaultContactOffset: 0.01 |
|||
m_DefaultSolverIterations: 6 |
|||
m_DefaultSolverVelocityIterations: 1 |
|||
m_QueriesHitBackfaces: 0 |
|||
m_QueriesHitTriggers: 1 |
|||
m_EnableAdaptiveForce: 0 |
|||
m_EnablePCM: 1 |
|||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
|||
m_AutoSimulation: 1 |
|||
m_AutoSyncTransforms: 1 |
|
|||
m_EditorVersion: 2017.3.0a2 |
|||
m_EditorVersion: 2017.3.0a3 |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
// Pre-hashed shader ids - naming conventions are a bit off in this file as we use the same
|
|||
// fields names as in the shaders for ease of use... Would be nice to clean this up at some
|
|||
// point.
|
|||
static class HDShaderIDs |
|||
{ |
|||
internal static readonly int _ShadowDatasExp = Shader.PropertyToID("_ShadowDatasExp"); |
|||
internal static readonly int _ShadowPayloads = Shader.PropertyToID("_ShadowPayloads"); |
|||
internal static readonly int _ShadowmapExp_VSM_0 = Shader.PropertyToID("_ShadowmapExp_VSM_0"); |
|||
internal static readonly int _ShadowmapExp_VSM_1 = Shader.PropertyToID("_ShadowmapExp_VSM_1"); |
|||
internal static readonly int _ShadowmapExp_VSM_2 = Shader.PropertyToID("_ShadowmapExp_VSM_2"); |
|||
internal static readonly int _ShadowmapExp_PCF = Shader.PropertyToID("_ShadowmapExp_PCF"); |
|||
|
|||
internal static readonly int g_LayeredSingleIdxBuffer = Shader.PropertyToID("g_LayeredSingleIdxBuffer"); |
|||
internal static readonly int _EnvLightIndexShift = Shader.PropertyToID("_EnvLightIndexShift"); |
|||
internal static readonly int g_iNrVisibLights = Shader.PropertyToID("g_iNrVisibLights"); |
|||
internal static readonly int g_mScrProjection = Shader.PropertyToID("g_mScrProjection"); |
|||
internal static readonly int g_mInvScrProjection = Shader.PropertyToID("g_mInvScrProjection"); |
|||
internal static readonly int g_iLog2NumClusters = Shader.PropertyToID("g_iLog2NumClusters"); |
|||
internal static readonly int g_fNearPlane = Shader.PropertyToID("g_fNearPlane"); |
|||
internal static readonly int g_fFarPlane = Shader.PropertyToID("g_fFarPlane"); |
|||
internal static readonly int g_fClustScale = Shader.PropertyToID("g_fClustScale"); |
|||
internal static readonly int g_fClustBase = Shader.PropertyToID("g_fClustBase"); |
|||
internal static readonly int g_depth_tex = Shader.PropertyToID("g_depth_tex"); |
|||
internal static readonly int g_vLayeredLightList = Shader.PropertyToID("g_vLayeredLightList"); |
|||
internal static readonly int g_LayeredOffset = Shader.PropertyToID("g_LayeredOffset"); |
|||
internal static readonly int g_vBigTileLightList = Shader.PropertyToID("g_vBigTileLightList"); |
|||
internal static readonly int g_logBaseBuffer = Shader.PropertyToID("g_logBaseBuffer"); |
|||
internal static readonly int g_vBoundsBuffer = Shader.PropertyToID("g_vBoundsBuffer"); |
|||
internal static readonly int _LightVolumeData = Shader.PropertyToID("_LightVolumeData"); |
|||
internal static readonly int g_data = Shader.PropertyToID("g_data"); |
|||
internal static readonly int g_mProjection = Shader.PropertyToID("g_mProjection"); |
|||
internal static readonly int g_mInvProjection = Shader.PropertyToID("g_mInvProjection"); |
|||
internal static readonly int g_viDimensions = Shader.PropertyToID("g_viDimensions"); |
|||
internal static readonly int g_vLightList = Shader.PropertyToID("g_vLightList"); |
|||
|
|||
internal static readonly int g_BaseFeatureFlags = Shader.PropertyToID("g_BaseFeatureFlags"); |
|||
internal static readonly int g_TileFeatureFlags = Shader.PropertyToID("g_TileFeatureFlags"); |
|||
|
|||
internal static readonly int _GBufferTexture0 = Shader.PropertyToID("_GBufferTexture0"); |
|||
internal static readonly int _GBufferTexture1 = Shader.PropertyToID("_GBufferTexture1"); |
|||
internal static readonly int _GBufferTexture2 = Shader.PropertyToID("_GBufferTexture2"); |
|||
internal static readonly int _GBufferTexture3 = Shader.PropertyToID("_GBufferTexture3"); |
|||
|
|||
internal static readonly int g_DispatchIndirectBuffer = Shader.PropertyToID("g_DispatchIndirectBuffer"); |
|||
internal static readonly int g_TileList = Shader.PropertyToID("g_TileList"); |
|||
internal static readonly int g_NumTiles = Shader.PropertyToID("g_NumTiles"); |
|||
internal static readonly int g_NumTilesX = Shader.PropertyToID("g_NumTilesX"); |
|||
|
|||
internal static readonly int _NumTiles = Shader.PropertyToID("_NumTiles"); |
|||
|
|||
internal static readonly int _CookieTextures = Shader.PropertyToID("_CookieTextures"); |
|||
internal static readonly int _CookieCubeTextures = Shader.PropertyToID("_CookieCubeTextures"); |
|||
internal static readonly int _EnvTextures = Shader.PropertyToID("_EnvTextures"); |
|||
internal static readonly int _DirectionalLightDatas = Shader.PropertyToID("_DirectionalLightDatas"); |
|||
internal static readonly int _DirectionalLightCount = Shader.PropertyToID("_DirectionalLightCount"); |
|||
internal static readonly int _LightDatas = Shader.PropertyToID("_LightDatas"); |
|||
internal static readonly int _PunctualLightCount = Shader.PropertyToID("_PunctualLightCount"); |
|||
internal static readonly int _AreaLightCount = Shader.PropertyToID("_AreaLightCount"); |
|||
internal static readonly int g_vLightListGlobal = Shader.PropertyToID("g_vLightListGlobal"); |
|||
internal static readonly int _EnvLightDatas = Shader.PropertyToID("_EnvLightDatas"); |
|||
internal static readonly int _EnvLightCount = Shader.PropertyToID("_EnvLightCount"); |
|||
internal static readonly int _ShadowDatas = Shader.PropertyToID("_ShadowDatas"); |
|||
internal static readonly int _DirShadowSplitSpheres = Shader.PropertyToID("_DirShadowSplitSpheres"); |
|||
internal static readonly int _NumTileFtplX = Shader.PropertyToID("_NumTileFtplX"); |
|||
internal static readonly int _NumTileFtplY = Shader.PropertyToID("_NumTileFtplY"); |
|||
internal static readonly int _NumTileClusteredX = Shader.PropertyToID("_NumTileClusteredX"); |
|||
internal static readonly int _NumTileClusteredY = Shader.PropertyToID("_NumTileClusteredY"); |
|||
|
|||
internal static readonly int g_isLogBaseBufferEnabled = Shader.PropertyToID("g_isLogBaseBufferEnabled"); |
|||
internal static readonly int g_vLayeredOffsetsBuffer = Shader.PropertyToID("g_vLayeredOffsetsBuffer"); |
|||
|
|||
internal static readonly int _ViewTilesFlags = Shader.PropertyToID("_ViewTilesFlags"); |
|||
internal static readonly int _MousePixelCoord = Shader.PropertyToID("_MousePixelCoord"); |
|||
|
|||
internal static readonly int _DebugViewMaterial = Shader.PropertyToID("_DebugViewMaterial"); |
|||
internal static readonly int _DebugLightingMode = Shader.PropertyToID("_DebugLightingMode"); |
|||
internal static readonly int _DebugLightingAlbedo = Shader.PropertyToID("_DebugLightingAlbedo"); |
|||
internal static readonly int _DebugLightingSmoothness = Shader.PropertyToID("_DebugLightingSmoothness"); |
|||
internal static readonly int _AmbientOcclusionTexture = Shader.PropertyToID("_AmbientOcclusionTexture"); |
|||
|
|||
internal static readonly int _UseTileLightList = Shader.PropertyToID("_UseTileLightList"); |
|||
internal static readonly int _Time = Shader.PropertyToID("_Time"); |
|||
internal static readonly int _SinTime = Shader.PropertyToID("_SinTime"); |
|||
internal static readonly int _CosTime = Shader.PropertyToID("_CosTime"); |
|||
internal static readonly int unity_DeltaTime = Shader.PropertyToID("unity_DeltaTime"); |
|||
internal static readonly int _EnvLightSkyEnabled = Shader.PropertyToID("_EnvLightSkyEnabled"); |
|||
internal static readonly int _AmbientOcclusionDirectLightStrenght = Shader.PropertyToID("_AmbientOcclusionDirectLightStrenght"); |
|||
internal static readonly int _SkyTexture = Shader.PropertyToID("_SkyTexture"); |
|||
|
|||
internal static readonly int _EnableSSSAndTransmission = Shader.PropertyToID("_EnableSSSAndTransmission"); |
|||
internal static readonly int _TexturingModeFlags = Shader.PropertyToID("_TexturingModeFlags"); |
|||
internal static readonly int _TransmissionFlags = Shader.PropertyToID("_TransmissionFlags"); |
|||
internal static readonly int _ThicknessRemaps = Shader.PropertyToID("_ThicknessRemaps"); |
|||
internal static readonly int _ShapeParams = Shader.PropertyToID("_ShapeParams"); |
|||
internal static readonly int _TransmissionTints = Shader.PropertyToID("_TransmissionTints"); |
|||
internal static readonly int specularLightingUAV = Shader.PropertyToID("specularLightingUAV"); |
|||
internal static readonly int diffuseLightingUAV = Shader.PropertyToID("diffuseLightingUAV"); |
|||
|
|||
internal static readonly int g_TileListOffset = Shader.PropertyToID("g_TileListOffset"); |
|||
|
|||
internal static readonly int _LtcData = Shader.PropertyToID("_LtcData"); |
|||
internal static readonly int _PreIntegratedFGD = Shader.PropertyToID("_PreIntegratedFGD"); |
|||
internal static readonly int _LtcGGXMatrix = Shader.PropertyToID("_LtcGGXMatrix"); |
|||
internal static readonly int _LtcDisneyDiffuseMatrix = Shader.PropertyToID("_LtcDisneyDiffuseMatrix"); |
|||
internal static readonly int _LtcMultiGGXFresnelDisneyDiffuse = Shader.PropertyToID("_LtcMultiGGXFresnelDisneyDiffuse"); |
|||
|
|||
internal static readonly int _MainDepthTexture = Shader.PropertyToID("_MainDepthTexture"); |
|||
|
|||
internal static readonly int unity_OrthoParams = Shader.PropertyToID("unity_OrthoParams"); |
|||
internal static readonly int _ZBufferParams = Shader.PropertyToID("_ZBufferParams"); |
|||
internal static readonly int _ScreenParams = Shader.PropertyToID("_ScreenParams"); |
|||
internal static readonly int _ProjectionParams = Shader.PropertyToID("_ProjectionParams"); |
|||
internal static readonly int _WorldSpaceCameraPos = Shader.PropertyToID("_WorldSpaceCameraPos"); |
|||
|
|||
|
|||
internal static readonly int _StencilRef = Shader.PropertyToID("_StencilRef"); |
|||
internal static readonly int _StencilCmp = Shader.PropertyToID("_StencilCmp"); |
|||
|
|||
internal static readonly int _SrcBlend = Shader.PropertyToID("_SrcBlend"); |
|||
internal static readonly int _DstBlend = Shader.PropertyToID("_DstBlend"); |
|||
|
|||
internal static readonly int _HTile = Shader.PropertyToID("_HTile"); |
|||
internal static readonly int _StencilTexture = Shader.PropertyToID("_StencilTexture"); |
|||
|
|||
internal static readonly int _ViewMatrix = Shader.PropertyToID("_ViewMatrix"); |
|||
internal static readonly int _InvViewMatrix = Shader.PropertyToID("_InvViewMatrix"); |
|||
internal static readonly int _ProjMatrix = Shader.PropertyToID("_ProjMatrix"); |
|||
internal static readonly int _InvProjMatrix = Shader.PropertyToID("_InvProjMatrix"); |
|||
internal static readonly int _NonJitteredViewProjMatrix = Shader.PropertyToID("_NonJitteredViewProjMatrix"); |
|||
internal static readonly int _ViewProjMatrix = Shader.PropertyToID("_ViewProjMatrix"); |
|||
internal static readonly int _InvViewProjMatrix = Shader.PropertyToID("_InvViewProjMatrix"); |
|||
internal static readonly int _InvProjParam = Shader.PropertyToID("_InvProjParam"); |
|||
internal static readonly int _ScreenSize = Shader.PropertyToID("_ScreenSize"); |
|||
internal static readonly int _PrevViewProjMatrix = Shader.PropertyToID("_PrevViewProjMatrix"); |
|||
internal static readonly int _FrustumPlanes = Shader.PropertyToID("_FrustumPlanes"); |
|||
|
|||
|
|||
internal static readonly int _CameraColorTexture = Shader.PropertyToID("_CameraColorTexture"); |
|||
internal static readonly int _CameraDiffuseIrradianceTexture = Shader.PropertyToID("_CameraDiffuseIrradianceTexture"); |
|||
internal static readonly int _CameraFilteringBuffer = Shader.PropertyToID("_CameraFilteringBuffer"); |
|||
internal static readonly int _VelocityTexture = Shader.PropertyToID("_VelocityTexture"); |
|||
|
|||
|
|||
internal static readonly int _DistortionTexture = Shader.PropertyToID("_DistortionTexture"); |
|||
internal static readonly int _DebugFullScreenTexture = Shader.PropertyToID("_DebugFullScreenTexture"); |
|||
|
|||
internal static readonly int _WorldScales = Shader.PropertyToID("_WorldScales"); |
|||
internal static readonly int _FilterKernels = Shader.PropertyToID("_FilterKernels"); |
|||
internal static readonly int _DepthTexture = Shader.PropertyToID("_DepthTexture"); |
|||
internal static readonly int _IrradianceSource = Shader.PropertyToID("_IrradianceSource"); |
|||
internal static readonly int _FilterKernelsBasic = Shader.PropertyToID("_FilterKernelsBasic"); |
|||
internal static readonly int _HalfRcpWeightedVariances = Shader.PropertyToID("_HalfRcpWeightedVariances"); |
|||
|
|||
internal static readonly int _CameraPosDiff = Shader.PropertyToID("_CameraPosDiff"); |
|||
|
|||
internal static readonly int _CameraDepthTexture = Shader.PropertyToID("_CameraDepthTexture"); |
|||
internal static readonly int _CameraMotionVectorsTexture = Shader.PropertyToID("_CameraMotionVectorsTexture"); |
|||
internal static readonly int _FullScreenDebugMode = Shader.PropertyToID("_FullScreenDebugMode"); |
|||
|
|||
internal static readonly int _InputCubemap = Shader.PropertyToID("_InputCubemap"); |
|||
internal static readonly int _Mipmap = Shader.PropertyToID("_Mipmap"); |
|||
|
|||
|
|||
internal static readonly int _MaxRadius = Shader.PropertyToID("_MaxRadius"); |
|||
internal static readonly int _ShapeParam = Shader.PropertyToID("_ShapeParam"); |
|||
internal static readonly int _StdDev1 = Shader.PropertyToID("_StdDev1"); |
|||
internal static readonly int _StdDev2 = Shader.PropertyToID("_StdDev2"); |
|||
internal static readonly int _LerpWeight = Shader.PropertyToID("_LerpWeight"); |
|||
internal static readonly int _TransmissionTint = Shader.PropertyToID("_TransmissionTint"); |
|||
internal static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap"); |
|||
|
|||
internal static readonly int _Cubemap = Shader.PropertyToID("_Cubemap"); |
|||
internal static readonly int _SkyParam = Shader.PropertyToID("_SkyParam"); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a586982c0c38ee64095f06495d043462 |
|||
timeCreated: 1501072635 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#pragma kernel Deferred_Direct_Fptl SHADE_OPAQUE_ENTRY=Deferred_Direct_Fptl USE_FPTL_LIGHTLIST |
|||
#pragma kernel Deferred_Direct_Fptl_DebugDisplay SHADE_OPAQUE_ENTRY=Deferred_Direct_Fptl_DebugDisplay USE_FPTL_LIGHTLIST DEBUG_DISPLAY |
|||
#pragma kernel Deferred_Direct_Clustered SHADE_OPAQUE_ENTRY=Deferred_Direct_Clustered USE_CLUSTERED_LIGHTLIST |
|||
#pragma kernel Deferred_Direct_Clustered_DebugDisplay SHADE_OPAQUE_ENTRY=Deferred_Direct_Clustered_DebugDisplay USE_CLUSTERED_LIGHTLIST DEBUG_DISPLAY |
|||
|
|||
#pragma kernel Deferred_Indirect_Fptl_Variant0 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant0 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=0 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant1 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant1 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=1 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant2 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant2 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=2 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant3 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant3 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=3 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant4 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant4 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=4 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant5 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant5 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=5 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant6 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant6 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=6 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant7 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant7 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=7 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant8 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant8 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=8 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant9 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant9 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=9 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant10 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant10 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=10 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant11 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant11 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=11 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant12 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant12 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=12 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant13 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant13 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=13 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant14 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant14 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=14 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant15 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant15 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=15 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant16 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant16 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=16 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant17 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant17 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=17 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant18 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant18 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=18 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant19 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant19 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=19 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant20 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant20 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=20 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant21 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant21 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=21 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant22 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant22 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=22 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant23 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant23 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=23 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant24 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant24 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=24 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant25 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant25 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=25 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant26 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant26 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=26 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant27 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant27 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=27 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant28 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant28 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=28 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant29 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant29 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=29 |
|||
#pragma kernel Deferred_Indirect_Fptl_Variant30 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant30 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=30 |
|||
|
|||
/* Tag: SUPPORT_COMPUTE_CLUSTER_OPAQUE - Uncomment this if you want to do cluster opaque with compute shader (by default we support only fptl on opaque) |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant0 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant0 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=0 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant1 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant1 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=1 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant2 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant2 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=2 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant3 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant3 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=3 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant4 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant4 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=4 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant5 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant5 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=5 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant6 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant6 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=6 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant7 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant7 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=7 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant8 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant8 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=8 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant9 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant9 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=9 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant10 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant10 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=10 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant11 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant11 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=11 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant12 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant12 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=12 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant13 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant13 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=13 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant14 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant14 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=14 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant15 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant15 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=15 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant16 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant16 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=16 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant17 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant17 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=17 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant18 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant18 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=18 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant19 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant19 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=19 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant20 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant20 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=20 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant21 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant21 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=21 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant22 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant22 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=22 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant23 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant23 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=23 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant24 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant24 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=24 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant25 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant25 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=25 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant26 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant26 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=26 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant27 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant27 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=27 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant28 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant28 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=28 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant29 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant29 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=29 |
|||
#pragma kernel Deferred_Indirect_Clustered_Variant30 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Clustered_Variant30 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=30 |
|||
*/ |
|||
|
|||
#define LIGHTLOOP_TILE_PASS 1 |
|||
|
|||
//#pragma enable_d3d11_debug_symbols |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// Include |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
#include "../../../ShaderLibrary/Common.hlsl" |
|||
#include "../../Debug/DebugDisplay.hlsl" |
|||
|
|||
// Note: We have fix as guidelines that we have only one deferred material (with control of GBuffer enabled). Mean a users that add a new |
|||
// deferred material must replace the old one here. If in the future we want to support multiple layout (cause a lot of consistency problem), |
|||
// the deferred shader will require to use multicompile. |
|||
#define UNITY_MATERIAL_LIT // Need to be define before including Material.hlsl |
|||
#include "../../ShaderConfig.cs.hlsl" |
|||
#include "../../ShaderVariables.hlsl" |
|||
#include "../../Lighting/Lighting.hlsl" // This include Material.hlsl |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// variable declaration |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); |
|||
|
|||
RWTexture2D<float3> diffuseLightingUAV; |
|||
RWTexture2D<float4> specularLightingUAV; |
|||
|
|||
CBUFFER_START(UnityDeferredCompute) |
|||
uint g_TileListOffset; |
|||
CBUFFER_END |
|||
|
|||
#if USE_INDIRECT |
|||
|
|||
StructuredBuffer<uint> g_TileList; |
|||
// Indirect |
|||
[numthreads(16, 16, 1)] |
|||
void SHADE_OPAQUE_ENTRY(uint2 groupThreadId : SV_GroupThreadID, uint groupId : SV_GroupID) |
|||
{ |
|||
uint tileIndex = g_TileList[g_TileListOffset + groupId]; |
|||
uint2 tileCoord = uint2(tileIndex & 0xFFFF, tileIndex >> 16); |
|||
uint2 pixelCoord = tileCoord * GetTileSize() + groupThreadId; |
|||
|
|||
uint featureFlags = TileVariantToFeatureFlags(VARIANT); |
|||
#else |
|||
|
|||
// Direct |
|||
[numthreads(16, 16, 1)] |
|||
void SHADE_OPAQUE_ENTRY(uint2 dispatchThreadId : SV_DispatchThreadID, uint2 groupId : SV_GroupID) |
|||
{ |
|||
uint2 tileCoord = (16 * groupId) / GetTileSize(); |
|||
uint2 pixelCoord = dispatchThreadId; |
|||
uint featureFlags = 0xFFFFFFFF; |
|||
|
|||
#endif |
|||
|
|||
// This need to stay in sync with deferred.shader |
|||
|
|||
PositionInputs posInput = GetPositionInput(pixelCoord.xy, _ScreenSize.zw, tileCoord); |
|||
|
|||
float depth = LOAD_TEXTURE2D(_MainDepthTexture, posInput.unPositionSS).x; |
|||
|
|||
// For indirect case: we can still overlap inside a tile with the sky/background, reject it |
|||
// Can't rely on stencil as we are in compute shader |
|||
// TODO : if we have depth bounds test we could remove such a test ? |
|||
if (depth == UNITY_RAW_FAR_CLIP_VALUE) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
UpdatePositionInput(depth, _InvViewProjMatrix, _ViewProjMatrix, posInput); |
|||
float3 V = GetWorldSpaceNormalizeViewDir(posInput.positionWS); |
|||
|
|||
FETCH_GBUFFER(gbuffer, _GBufferTexture, posInput.unPositionSS); |
|||
BSDFData bsdfData; |
|||
float3 bakeDiffuseLighting; |
|||
DECODE_FROM_GBUFFER(gbuffer, featureFlags, bsdfData, bakeDiffuseLighting); |
|||
|
|||
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); |
|||
|
|||
float3 diffuseLighting; |
|||
float3 specularLighting; |
|||
LightLoop(V, posInput, preLightData, bsdfData, bakeDiffuseLighting, featureFlags, diffuseLighting, specularLighting); |
|||
|
|||
if (_EnableSSSAndTransmission != 0 && bsdfData.materialId == MATERIALID_LIT_SSS) |
|||
{ |
|||
// We SSSSS is enabled with use split lighting. |
|||
// SSSSS algorithm need to know which pixels contribute to SSS and which doesn't. We could use the stencil for that but it mean that it will increase the cost of SSSSS |
|||
// A simpler solution is to add a slight contribution here that isn't visible (here we chose fp16 min (which is also fp11 and fp10 min). |
|||
// The SSSSS algorithm will check if diffuse lighting is black and discard the pixel if it is the case |
|||
diffuseLighting.r = max(diffuseLighting.r, HFLT_MIN); |
|||
|
|||
specularLightingUAV[pixelCoord] = float4(specularLighting, 1.0); |
|||
diffuseLightingUAV[pixelCoord] = diffuseLighting; |
|||
} |
|||
else |
|||
{ |
|||
specularLightingUAV[pixelCoord] = float4(diffuseLighting + specularLighting, 1.0); |
|||
} |
|||
} |
|||
|
|
|||
// ===================== Performs integration of the Disney BSSRDF over a disk ===================== |
|||
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Definitions |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
// #pragma enable_d3d11_debug_symbols |
|||
|
|||
// Tweak parameters. |
|||
#define SSS_BILATERAL_FILTER 1 |
|||
#define SSS_USE_LDS_CACHE 1 |
|||
#define SSS_ENABLE_NEAR_FIELD 0 |
|||
#define SSS_SAMPLE_TEST_HTILE 0 |
|||
#define SSS_USE_TANGENT_PLANE 0 |
|||
#define SSS_CLAMP_ARTIFACT 0 |
|||
#define SSS_DEBUG_LOD 0 |
|||
#define SSS_DEBUG_NORMAL_VS 0 |
|||
|
|||
// Do not modify these. |
|||
#define SSS_PASS 1 |
|||
#define MILLIMETERS_PER_METER 1000 |
|||
#define CENTIMETERS_PER_METER 100 |
|||
#define GROUP_SIZE_1D 16 |
|||
#define GROUP_SIZE_2D (GROUP_SIZE_1D * GROUP_SIZE_1D) |
|||
#define TEXTURE_CACHE_BORDER 2 |
|||
#define TEXTURE_CACHE_SIZE_1D (GROUP_SIZE_1D + 2 * TEXTURE_CACHE_BORDER) |
|||
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Included headers |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
#include "../../../../ShaderLibrary/Packing.hlsl" |
|||
#include "../../../../ShaderLibrary/SpaceFillingCurves.hlsl" |
|||
#include "../../../ShaderVariables.hlsl" |
|||
#define UNITY_MATERIAL_LIT |
|||
#include "../../../Material/Material.hlsl" |
|||
#include "../../../Lighting/LightDefinition.cs.hlsl" |
|||
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Inputs & outputs |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
float4 _WorldScales[SSS_N_PROFILES]; // Size of the world unit in meters (only the X component is used) |
|||
float4 _FilterKernels[SSS_N_PROFILES][SSS_N_SAMPLES_NEAR_FIELD]; // XY = near field, ZW = far field; 0 = radius, 1 = reciprocal of the PDF |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); // Contains the albedo and SSS parameters |
|||
TEXTURE2D(_DepthTexture); // Z-buffer |
|||
TEXTURE2D(_StencilTexture); // DXGI_FORMAT_R8_UINT is not supported by Unity |
|||
TEXTURE2D(_HTile); // DXGI_FORMAT_R8_UINT is not supported by Unity |
|||
TEXTURE2D(_IrradianceSource); // Includes transmitted light |
|||
|
|||
// Contains the HDR color for non-SSS materials. |
|||
// In case of SSS, it only contains the specular lighting, which we additively blend with the SSS lighting. |
|||
RW_TEXTURE2D(float4, _CameraColorTexture); |
|||
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Implementation |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
// 6656 bytes used. It appears that the reserved LDS space must be a multiple of 512 bytes. |
|||
#if SSS_USE_LDS_CACHE |
|||
groupshared float4 textureCache[TEXTURE_CACHE_SIZE_1D * TEXTURE_CACHE_SIZE_1D]; // {irradiance, linearDepth} |
|||
#endif |
|||
groupshared bool processGroup; |
|||
|
|||
bool StencilTest(int2 pixelCoord, float stencilRef) |
|||
{ |
|||
bool passedStencilTest; |
|||
|
|||
#if SSS_SAMPLE_TEST_HTILE |
|||
int2 tileCoord = pixelCoord >> 3; // Divide by 8 |
|||
|
|||
// Perform the stencil test (reject at the tile rate). |
|||
passedStencilTest = stencilRef == LOAD_TEXTURE2D(_HTile, tileCoord).r; |
|||
|
|||
[branch] if (passedStencilTest) |
|||
#else |
|||
// It is extremely uncommon for individual samples to fail the HTile test. |
|||
// Unfortunately, our copy of HTile does not allow to accept at the tile rate. |
|||
// Therefore, we choose not to perform the HiS test here. |
|||
#endif |
|||
{ |
|||
// Unfortunately, our copy of HTile does not allow to accept at the tile rate. |
|||
// Therefore, we have to additionally perform the stencil test at the pixel rate. |
|||
passedStencilTest = stencilRef == UnpackByte(LOAD_TEXTURE2D(_StencilTexture, pixelCoord).r); |
|||
} |
|||
|
|||
return passedStencilTest; |
|||
} |
|||
|
|||
#if SSS_USE_LDS_CACHE |
|||
float4 LoadSampleFromCacheMemory(int2 cacheCoord) |
|||
{ |
|||
return textureCache[Mad24(TEXTURE_CACHE_SIZE_1D, cacheCoord.y, cacheCoord.x)]; |
|||
} |
|||
#endif |
|||
|
|||
float4 LoadSampleFromVideoMemory(int2 pixelCoord) |
|||
{ |
|||
float3 irradiance = LOAD_TEXTURE2D(_IrradianceSource, pixelCoord).rgb; |
|||
float depth = LOAD_TEXTURE2D(_DepthTexture, pixelCoord).r; |
|||
|
|||
return float4(irradiance, LinearEyeDepth(depth, _ZBufferParams)); |
|||
} |
|||
|
|||
// Returns {irradiance, linearDepth}. |
|||
float4 LoadSample(int2 pixelCoord, int2 cacheAnchor) |
|||
{ |
|||
int2 cacheCoord = pixelCoord - cacheAnchor; |
|||
bool isInCache = max((uint)cacheCoord.x, (uint)cacheCoord.y) < TEXTURE_CACHE_SIZE_1D; |
|||
|
|||
#if SSS_USE_LDS_CACHE |
|||
[branch] if (isInCache) |
|||
{ |
|||
return LoadSampleFromCacheMemory(cacheCoord); |
|||
} |
|||
else |
|||
#endif |
|||
{ |
|||
float stencilRef = STENCILLIGHTINGUSAGE_SPLIT_LIGHTING; |
|||
|
|||
[branch] if (StencilTest(pixelCoord, stencilRef)) |
|||
{ |
|||
return LoadSampleFromVideoMemory(pixelCoord); |
|||
} |
|||
else |
|||
{ |
|||
return float4(0, 0, 0, 0); |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Computes the value of the integrand over a disk: (2 * PI * r) * KernelVal(). |
|||
// N.b.: the returned value is multiplied by 4. It is irrelevant due to weight renormalization. |
|||
float3 KernelValCircle(float r, float3 S) |
|||
{ |
|||
float3 expOneThird = exp(((-1.0 / 3.0) * r) * S); |
|||
return /* 0.25 * */ S * (expOneThird + expOneThird * expOneThird * expOneThird); |
|||
} |
|||
|
|||
// Computes F(r)/P(r), s.t. r = sqrt(xy^2 + z^2). |
|||
// Rescaling of the PDF is handled by 'totalWeight'. |
|||
float3 ComputeBilateralWeight(float xy2, float z, float mmPerUnit, float3 S, float rcpPdf) |
|||
{ |
|||
#if (SSS_BILATERAL_FILTER == 0) |
|||
z = 0; |
|||
#endif |
|||
|
|||
#if SSS_USE_TANGENT_PLANE |
|||
// Both 'xy2' and 'z' require conversion to millimeters. |
|||
float r = sqrt(xy2 + z * z) * mmPerUnit; |
|||
#else |
|||
// Only 'z' requires conversion to millimeters. |
|||
float r = sqrt(xy2 + (z * mmPerUnit) * (z * mmPerUnit)); |
|||
#endif |
|||
|
|||
#if SSS_CLAMP_ARTIFACT |
|||
return saturate(KernelValCircle(r, S) * rcpPdf); |
|||
#else |
|||
return KernelValCircle(r, S) * rcpPdf; |
|||
#endif |
|||
} |
|||
|
|||
void EvaluateSample(uint i, uint n, uint profileID, uint iR, uint iP, float2 centerCoord, int2 cacheAnchor, |
|||
float3 shapeParam, float3 centerPosVS, float mmPerUnit, float2 pixelsPerMm, |
|||
float3 tangentX, float3 tangentY, float4x4 projMatrix, |
|||
inout float3 totalIrradiance, inout float3 totalWeight) |
|||
{ |
|||
float r = _FilterKernels[profileID][i][iR]; |
|||
// The relative sample position is known at the compile time. |
|||
float phi = SampleDiskFibonacci(i, n).y; |
|||
float2 vec = r * float2(cos(phi), sin(phi)); |
|||
|
|||
// Compute the screen-space position and the squared distance (in mm) in the image plane. |
|||
int2 position; float xy2; |
|||
|
|||
#if SSS_USE_TANGENT_PLANE |
|||
float3 relPosVS = vec.x * tangentX + vec.y * tangentY; |
|||
float3 positionVS = centerPosVS + relPosVS; |
|||
float4 positionCS = mul(projMatrix, float4(positionVS, 1)); |
|||
float2 positionSS = ComputeScreenSpacePosition(positionCS); |
|||
|
|||
position = (int2)(positionSS * _ScreenSize.xy); |
|||
xy2 = dot(relPosVS.xy, relPosVS.xy); |
|||
#else |
|||
position = (int2)(centerCoord + vec * pixelsPerMm); |
|||
xy2 = r * r; |
|||
#endif |
|||
|
|||
float4 textureSample = LoadSample(position, cacheAnchor); |
|||
float3 irradiance = textureSample.rgb; |
|||
float linearDepth = textureSample.a; |
|||
|
|||
// Check the results of the stencil test. |
|||
if (linearDepth > 0) |
|||
{ |
|||
// Apply bilateral weighting. |
|||
float z = linearDepth - centerPosVS.z; |
|||
float p = _FilterKernels[profileID][i][iP]; |
|||
float3 w = ComputeBilateralWeight(xy2, z, mmPerUnit, shapeParam, p); |
|||
|
|||
totalIrradiance += w * irradiance; |
|||
totalWeight += w; |
|||
} |
|||
} |
|||
|
|||
#pragma kernel SubsurfaceScattering |
|||
|
|||
[numthreads(GROUP_SIZE_2D, 1, 1)] |
|||
void SubsurfaceScattering(uint2 groupId : SV_GroupID, |
|||
uint groupThreadId : SV_GroupThreadID) |
|||
{ |
|||
// Note: any factor of 64 is a suitable wave size for our algorithm. |
|||
uint waveIndex = groupThreadId / 64; |
|||
uint laneIndex = groupThreadId % 64; |
|||
uint quadIndex = laneIndex / 4; |
|||
|
|||
// Arrange threads in the Morton order to optimally match the memory layout of GCN tiles. |
|||
uint mortonCode = groupThreadId; |
|||
uint2 localCoord = DecodeMorton2D(mortonCode); |
|||
uint2 tileAnchor = groupId * GROUP_SIZE_1D; |
|||
uint2 pixelCoord = tileAnchor + localCoord; |
|||
int2 cacheAnchor = (int2)tileAnchor - TEXTURE_CACHE_BORDER; |
|||
uint2 cacheCoord = localCoord + TEXTURE_CACHE_BORDER; |
|||
float stencilRef = STENCILLIGHTINGUSAGE_SPLIT_LIGHTING; |
|||
|
|||
[branch] if (groupThreadId == 0) |
|||
{ |
|||
// Check whether the thread group needs to perform any work. |
|||
float s00 = LOAD_TEXTURE2D(_HTile, 2 * groupId + uint2(0, 0)).r; |
|||
float s10 = LOAD_TEXTURE2D(_HTile, 2 * groupId + uint2(1, 0)).r; |
|||
float s01 = LOAD_TEXTURE2D(_HTile, 2 * groupId + uint2(0, 1)).r; |
|||
float s11 = LOAD_TEXTURE2D(_HTile, 2 * groupId + uint2(1, 1)).r; |
|||
|
|||
// Perform the stencil test (reject at the tile rate). |
|||
processGroup = (stencilRef == s00 || stencilRef == s10 || stencilRef == s01 || stencilRef == s11); |
|||
} |
|||
|
|||
// Wait for the LDS. |
|||
GroupMemoryBarrierWithGroupSync(); |
|||
|
|||
[branch] if (!processGroup) { return; } |
|||
|
|||
float3 centerIrradiance = 0; |
|||
float centerDepth = 0; |
|||
float4 cachedValue = float4(0, 0, 0, 0); |
|||
|
|||
bool passedStencilTest = StencilTest((int2)pixelCoord, stencilRef); |
|||
|
|||
[branch] if (passedStencilTest) |
|||
{ |
|||
centerIrradiance = LOAD_TEXTURE2D(_IrradianceSource, pixelCoord).rgb; |
|||
centerDepth = LOAD_TEXTURE2D(_DepthTexture, pixelCoord).r; |
|||
cachedValue = float4(centerIrradiance, LinearEyeDepth(centerDepth, _ZBufferParams)); |
|||
} |
|||
|
|||
#if SSS_USE_LDS_CACHE |
|||
// Populate the central region of the LDS cache. |
|||
textureCache[Mad24(TEXTURE_CACHE_SIZE_1D, cacheCoord.y, cacheCoord.x)] = cachedValue; |
|||
|
|||
uint numBorderQuadsPerWave = TEXTURE_CACHE_SIZE_1D / 2 - 1; |
|||
uint halfCacheWidthInQuads = TEXTURE_CACHE_SIZE_1D / 4; |
|||
|
|||
[branch] if (quadIndex < numBorderQuadsPerWave) |
|||
{ |
|||
// Fetch another texel into the LDS. |
|||
uint2 startQuad = halfCacheWidthInQuads * uint2(waveIndex & 1, waveIndex >> 1); |
|||
|
|||
uint2 quadCoord; |
|||
|
|||
// The traversal order is such that the quad's X coordinate is monotonically increasing. |
|||
// Note: the compiler can heavily optimize the code below, as the switch is scalar, |
|||
// and there are very few unique values due to the symmetry. |
|||
switch (waveIndex) |
|||
{ |
|||
case 0: |
|||
quadCoord.x = max(0, (int)(quadIndex - (halfCacheWidthInQuads - 1))); |
|||
quadCoord.y = max(0, (int)((halfCacheWidthInQuads - 1) - quadIndex)); |
|||
break; |
|||
case 1: |
|||
quadCoord.x = min(quadIndex, halfCacheWidthInQuads - 1); |
|||
quadCoord.y = max(0, (int)(quadIndex - (halfCacheWidthInQuads - 1))); |
|||
break; |
|||
case 2: |
|||
quadCoord.x = max(0, (int)(quadIndex - (halfCacheWidthInQuads - 1))); |
|||
quadCoord.y = min(quadIndex, halfCacheWidthInQuads - 1); |
|||
break; |
|||
default: // 3 |
|||
quadCoord.x = min(quadIndex, halfCacheWidthInQuads - 1); |
|||
quadCoord.y = min(halfCacheWidthInQuads - 1, 2 * (halfCacheWidthInQuads - 1) - quadIndex); |
|||
break; |
|||
} |
|||
|
|||
uint2 cacheCoord2 = 2 * (startQuad + quadCoord) + uint2(laneIndex & 1, (laneIndex >> 1) & 1); |
|||
int2 pixelCoord2 = (int2)(tileAnchor + cacheCoord2) - TEXTURE_CACHE_BORDER; |
|||
float4 cachedValue2 = float4(0, 0, 0, 0); |
|||
|
|||
[branch] if (StencilTest(pixelCoord2, stencilRef)) |
|||
{ |
|||
cachedValue2 = LoadSampleFromVideoMemory(pixelCoord2); |
|||
} |
|||
|
|||
// Populate the border region of the LDS cache. |
|||
textureCache[Mad24(TEXTURE_CACHE_SIZE_1D, cacheCoord2.y, cacheCoord2.x)] = cachedValue2; |
|||
} |
|||
|
|||
// Wait for the LDS. |
|||
GroupMemoryBarrierWithGroupSync(); |
|||
#endif |
|||
|
|||
bool isOffScreen = pixelCoord.x >= (uint)_ScreenSize.x || pixelCoord.y >= (uint)_ScreenSize.y; |
|||
|
|||
[branch] if (!passedStencilTest || isOffScreen) { return; } |
|||
|
|||
PositionInputs posInput = GetPositionInput(pixelCoord, _ScreenSize.zw); |
|||
|
|||
float3 unused; |
|||
|
|||
// The result of the stencil test allows us to statically determine the material type (SSS). |
|||
BSDFData bsdfData; |
|||
FETCH_GBUFFER(gbuffer, _GBufferTexture, pixelCoord); |
|||
DECODE_FROM_GBUFFER(gbuffer, MATERIALFEATUREFLAGS_LIT_SSS, bsdfData, unused); |
|||
|
|||
int profileID = bsdfData.subsurfaceProfile; |
|||
float distScale = bsdfData.subsurfaceRadius; |
|||
float3 shapeParam = _ShapeParams[profileID].rgb; |
|||
float maxDistance = _ShapeParams[profileID].a; |
|||
|
|||
// Reconstruct the view-space position corresponding to the central sample. |
|||
float2 centerPosSS = posInput.positionSS; |
|||
float2 cornerPosSS = centerPosSS + 0.5 * _ScreenSize.zw; |
|||
float3 centerPosVS = ComputeViewSpacePosition(centerPosSS, centerDepth, _InvProjMatrix); |
|||
float3 cornerPosVS = ComputeViewSpacePosition(cornerPosSS, centerDepth, _InvProjMatrix); |
|||
|
|||
// Rescaling the filter is equivalent to inversely scaling the world. |
|||
float mmPerUnit = MILLIMETERS_PER_METER * (_WorldScales[profileID].x / distScale); |
|||
float unitsPerMm = rcp(mmPerUnit); |
|||
|
|||
// Compute the view-space dimensions of the pixel as a quad projected onto geometry. |
|||
float2 unitsPerPixel = 2 * abs(cornerPosVS.xy - centerPosVS.xy); |
|||
float2 pixelsPerMm = rcp(unitsPerPixel) * unitsPerMm; |
|||
|
|||
// We perform point sampling. Therefore, we can avoid the cost |
|||
// of filtering if we stay within the bounds of the current pixel. |
|||
// We use the value of 1 instead of 0.5 as an optimization. |
|||
// N.b.: our LoD selection algorithm is the same regardless of |
|||
// whether we integrate over the tangent plane or not, since we |
|||
// don't want the orientation of the tangent plane to create |
|||
// divergence of execution across the warp. |
|||
float maxDistInPixels = maxDistance * max(pixelsPerMm.x, pixelsPerMm.y); |
|||
|
|||
[branch] if (distScale == 0 || maxDistInPixels < 1) |
|||
{ |
|||
#if SSS_DEBUG_LOD |
|||
_CameraColorTexture[pixelCoord] = float4(0, 0, 1, 1); |
|||
#else |
|||
_CameraColorTexture[pixelCoord] += float4(bsdfData.diffuseColor * centerIrradiance, 1); |
|||
#endif |
|||
return; |
|||
} |
|||
|
|||
float4x4 viewMatrix, projMatrix; |
|||
GetLeftHandedViewSpaceMatrices(viewMatrix, projMatrix); |
|||
|
|||
// Compute the tangent frame in view space. |
|||
float3 normalVS = mul((float3x3)viewMatrix, bsdfData.normalWS); |
|||
float3 tangentX = GetLocalFrame(normalVS)[0] * unitsPerMm; |
|||
float3 tangentY = GetLocalFrame(normalVS)[1] * unitsPerMm; |
|||
|
|||
#if SSS_DEBUG_NORMAL_VS |
|||
// We expect the view-space normal to be front-facing. |
|||
if (normalVS.z >= 0) |
|||
{ |
|||
_CameraColorTexture[pixelCoord] = float4(1, 1, 1, 1); |
|||
return; |
|||
} |
|||
#endif |
|||
|
|||
// Use more samples for SS regions larger than 5x5 pixels (rotated by 45 degrees). |
|||
bool useNearFieldKernel = SSS_ENABLE_NEAR_FIELD && maxDistInPixels > SSS_LOD_THRESHOLD; |
|||
|
|||
#if SSS_DEBUG_LOD |
|||
_CameraColorTexture[pixelCoord] = useNearFieldKernel ? float4(1, 0, 0, 1) : float4(0.5, 0.5, 0, 1); |
|||
return; |
|||
#endif |
|||
|
|||
// Compute the indices used to access the individual components of the float4 of the kernel. |
|||
uint iR = useNearFieldKernel ? 0 : 2; // radius |
|||
uint iP = useNearFieldKernel ? 1 : 3; // rcp(pdf) |
|||
|
|||
float centerRadius = _FilterKernels[profileID][0][iR]; |
|||
float centerRcpPdf = _FilterKernels[profileID][0][iP]; |
|||
float3 centerWeight = KernelValCircle(centerRadius, shapeParam) * centerRcpPdf; |
|||
|
|||
// Accumulate filtered irradiance and bilateral weights (for renormalization). |
|||
float3 totalIrradiance = centerWeight * centerIrradiance; |
|||
float3 totalWeight = centerWeight; |
|||
|
|||
int i, n; // Declare once to avoid the warning from the Unity shader compiler. |
|||
|
|||
[unroll] |
|||
for (i = 1, n = SSS_N_SAMPLES_FAR_FIELD; i < n; i++) |
|||
{ |
|||
// Integrate over the image or tangent plane in the view space. |
|||
EvaluateSample(i, n, profileID, iR, iP, pixelCoord + 0.5, cacheAnchor, |
|||
shapeParam, centerPosVS, mmPerUnit, pixelsPerMm, |
|||
tangentX, tangentY, projMatrix, |
|||
totalIrradiance, totalWeight); |
|||
} |
|||
|
|||
[branch] if (!useNearFieldKernel) |
|||
{ |
|||
_CameraColorTexture[pixelCoord] += float4(bsdfData.diffuseColor * totalIrradiance / totalWeight, 1); |
|||
return; |
|||
} |
|||
|
|||
[unroll] |
|||
for (i = SSS_N_SAMPLES_FAR_FIELD, n = SSS_N_SAMPLES_NEAR_FIELD; i < n; i++) |
|||
{ |
|||
// Integrate over the image or tangent plane in the view space. |
|||
EvaluateSample(i, n, profileID, iR, iP, pixelCoord + 0.5, cacheAnchor, |
|||
shapeParam, centerPosVS, mmPerUnit, pixelsPerMm, |
|||
tangentX, tangentY, projMatrix, |
|||
totalIrradiance, totalWeight); |
|||
} |
|||
|
|||
_CameraColorTexture[pixelCoord] += float4(bsdfData.diffuseColor * totalIrradiance / totalWeight, 1); |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b06a7993621def248addd55d0fe931b1 |
|||
timeCreated: 1500310187 |
|||
licenseType: Pro |
|||
ComputeShaderImporter: |
|||
externalObjects: {} |
|||
currentAPIMask: 4 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_NOISE_INCLUDED |
|||
#define UNITY_NOISE_INCLUDED |
|||
|
|||
// A single iteration of Bob Jenkins' One-At-A-Time hashing algorithm. |
|||
uint JenkinsHash(uint x) |
|||
{ |
|||
x += (x << 10u); |
|||
x ^= (x >> 6u); |
|||
x += (x << 3u); |
|||
x ^= (x >> 11u); |
|||
x += (x << 15u); |
|||
return x; |
|||
} |
|||
|
|||
// Compound versions of the hashing algorithm. |
|||
uint JenkinsHash(uint2 v) |
|||
{ |
|||
return JenkinsHash(v.x ^ JenkinsHash(v.y)); |
|||
} |
|||
|
|||
uint JenkinsHash(uint3 v) |
|||
{ |
|||
return JenkinsHash(v.x ^ JenkinsHash(v.y) ^ JenkinsHash(v.z)); |
|||
} |
|||
|
|||
uint JenkinsHash(uint4 v) |
|||
{ |
|||
return JenkinsHash(v.x ^ JenkinsHash(v.y) ^ JenkinsHash(v.z) ^ JenkinsHash(v.w)); |
|||
} |
|||
|
|||
// Construct a float with half-open range [0:1] using low 23 bits. |
|||
// All zeros yields 0, all ones yields the next smallest representable value below 1. |
|||
float ConstructFloat(uint m) { |
|||
const uint ieeeMantissa = 0x007FFFFFu; // Binary FP32 mantissa bitmask |
|||
const uint ieeeOne = 0x3F800000u; // 1.0 in FP32 IEEE |
|||
|
|||
m &= ieeeMantissa; // Keep only mantissa bits (fractional part) |
|||
m |= ieeeOne; // Add fractional part to 1.0 |
|||
|
|||
float f = asfloat(m); // Range [1:2] |
|||
return f - 1; // Range [0:1] |
|||
} |
|||
|
|||
// Pseudo-random value in half-open range [0:1]. The distribution is reasonably uniform. |
|||
// Ref: https://stackoverflow.com/a/17479300 |
|||
float GenerateHashedRandomFloat(uint x) |
|||
{ |
|||
return ConstructFloat(JenkinsHash(x)); |
|||
} |
|||
|
|||
float GenerateHashedRandomFloat(uint2 v) |
|||
{ |
|||
return ConstructFloat(JenkinsHash(v)); |
|||
} |
|||
|
|||
float GenerateHashedRandomFloat(uint3 v) |
|||
{ |
|||
return ConstructFloat(JenkinsHash(v)); |
|||
} |
|||
|
|||
float GenerateHashedRandomFloat(uint4 v) |
|||
{ |
|||
return ConstructFloat(JenkinsHash(v)); |
|||
} |
|||
|
|||
#endif // UNITY_NOISE_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 5918bc8b07f593546974c1961387db77 |
|||
timeCreated: 1501167559 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_SPACE_FILLING_CURVES_INCLUDED |
|||
#define UNITY_SPACE_FILLING_CURVES_INCLUDED |
|||
|
|||
// "Insert" a 0 bit after each of the 16 low bits of x. |
|||
// Ref: https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/ |
|||
uint Part1By1(uint x) |
|||
{ |
|||
x &= 0x0000ffff; // x = ---- ---- ---- ---- fedc ba98 7654 3210 |
|||
x = (x ^ (x << 8)) & 0x00ff00ff; // x = ---- ---- fedc ba98 ---- ---- 7654 3210 |
|||
x = (x ^ (x << 4)) & 0x0f0f0f0f; // x = ---- fedc ---- ba98 ---- 7654 ---- 3210 |
|||
x = (x ^ (x << 2)) & 0x33333333; // x = --fe --dc --ba --98 --76 --54 --32 --10 |
|||
x = (x ^ (x << 1)) & 0x55555555; // x = -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 |
|||
return x; |
|||
} |
|||
|
|||
// "Insert" two 0 bits after each of the 10 low bits of x/ |
|||
// Ref: https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/ |
|||
uint Part1By2(uint x) |
|||
{ |
|||
x &= 0x000003ff; // x = ---- ---- ---- ---- ---- --98 7654 3210 |
|||
x = (x ^ (x << 16)) & 0xff0000ff; // x = ---- --98 ---- ---- ---- ---- 7654 3210 |
|||
x = (x ^ (x << 8)) & 0x0300f00f; // x = ---- --98 ---- ---- 7654 ---- ---- 3210 |
|||
x = (x ^ (x << 4)) & 0x030c30c3; // x = ---- --98 ---- 76-- --54 ---- 32-- --10 |
|||
x = (x ^ (x << 2)) & 0x09249249; // x = ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0 |
|||
return x; |
|||
} |
|||
|
|||
// Inverse of Part1By1 - "delete" all odd-indexed bits/ |
|||
// Ref: https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/ |
|||
uint Compact1By1(uint x) |
|||
{ |
|||
x &= 0x55555555; // x = -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 |
|||
x = (x ^ (x >> 1)) & 0x33333333; // x = --fe --dc --ba --98 --76 --54 --32 --10 |
|||
x = (x ^ (x >> 2)) & 0x0f0f0f0f; // x = ---- fedc ---- ba98 ---- 7654 ---- 3210 |
|||
x = (x ^ (x >> 4)) & 0x00ff00ff; // x = ---- ---- fedc ba98 ---- ---- 7654 3210 |
|||
x = (x ^ (x >> 8)) & 0x0000ffff; // x = ---- ---- ---- ---- fedc ba98 7654 3210 |
|||
return x; |
|||
} |
|||
|
|||
// Inverse of Part1By2 - "delete" all bits not at positions divisible by 3/ |
|||
// Ref: https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/ |
|||
uint Compact1By2(uint x) |
|||
{ |
|||
x &= 0x09249249; // x = ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0 |
|||
x = (x ^ (x >> 2)) & 0x030c30c3; // x = ---- --98 ---- 76-- --54 ---- 32-- --10 |
|||
x = (x ^ (x >> 4)) & 0x0300f00f; // x = ---- --98 ---- ---- 7654 ---- ---- 3210 |
|||
x = (x ^ (x >> 8)) & 0xff0000ff; // x = ---- --98 ---- ---- ---- ---- 7654 3210 |
|||
x = (x ^ (x >> 16)) & 0x000003ff; // x = ---- ---- ---- ---- ---- --98 7654 3210 |
|||
return x; |
|||
} |
|||
|
|||
uint EncodeMorton2D(uint2 coord) |
|||
{ |
|||
return (Part1By1(coord.y) << 1) + Part1By1(coord.x); |
|||
} |
|||
|
|||
uint EncodeMorton3D(uint3 coord) |
|||
{ |
|||
return (Part1By2(coord.z) << 2) + (Part1By2(coord.y) << 1) + Part1By2(coord.x); |
|||
} |
|||
|
|||
uint2 DecodeMorton2D(uint code) |
|||
{ |
|||
return uint2(Compact1By1(code >> 0), Compact1By1(code >> 1)); |
|||
} |
|||
|
|||
uint3 DecodeMorton3D(uint code) |
|||
{ |
|||
return uint3(Compact1By2(code >> 0), Compact1By2(code >> 1), Compact1By2(code >> 2)); |
|||
} |
|||
|
|||
#endif // UNITY_SPACE_FILLING_CURVES_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 063144fddd2c1be41b9d09dec6314fc7 |
|||
timeCreated: 1500391830 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: a6e7465350bf0d248b4799d98e18cd24, type: 3} |
|||
m_Name: ProfilingSkinSSSProfile |
|||
m_EditorClassIdentifier: |
|||
scatteringDistance: {r: 0.758, g: 0.321, b: 0.201, a: 1} |
|||
transmissionTint: {r: 0.7568628, g: 0.32156864, b: 0.20000002, a: 1} |
|||
texturingMode: 0 |
|||
transmissionMode: 0 |
|||
thicknessRemap: {x: 0, y: 12.031147} |
|||
worldScale: 1 |
|||
settingsIndex: 4 |
|||
m_ShapeParam: {x: 1.3192612, y: 3.1152647, z: 4.9751244} |
|||
m_MaxRadius: 10.03481 |
|||
m_FilterKernelNearField: |
|||
- {x: 0.013865918, y: 1.5345725} |
|||
- {x: 0.04211352, y: 1.5729346} |
|||
- {x: 0.07107388, y: 1.6130018} |
|||
- {x: 0.100779116, y: 1.6548817} |
|||
- {x: 0.13126306, y: 1.6986896} |
|||
- {x: 0.16256203, y: 1.7445502} |
|||
- {x: 0.1947145, y: 1.7925992} |
|||
- {x: 0.22776169, y: 1.8429838} |
|||
- {x: 0.26174724, y: 1.8958628} |
|||
- {x: 0.29671827, y: 1.9514104} |
|||
- {x: 0.33272493, y: 2.0098157} |
|||
- {x: 0.369821, y: 2.0712852} |
|||
- {x: 0.40806437, y: 2.1360447} |
|||
- {x: 0.44751683, y: 2.2043417} |
|||
- {x: 0.48824534, y: 2.276447} |
|||
- {x: 0.5303216, y: 2.3526597} |
|||
- {x: 0.5738235, y: 2.433308} |
|||
- {x: 0.61883456, y: 2.5187542} |
|||
- {x: 0.665446, y: 2.609401} |
|||
- {x: 0.713756, y: 2.7056925} |
|||
- {x: 0.763872, y: 2.808125} |
|||
- {x: 0.8159103, y: 2.91725} |
|||
- {x: 0.8699981, y: 3.0336854} |
|||
- {x: 0.9262747, y: 3.1581244} |
|||
- {x: 0.98489225, y: 3.2913465} |
|||
- {x: 1.0460185, y: 3.434234} |
|||
- {x: 1.1098381, y: 3.5877857} |
|||
- {x: 1.1765549, y: 3.7531407} |
|||
- {x: 1.2463952, y: 3.9316032} |
|||
- {x: 1.319611, y: 4.124672} |
|||
- {x: 1.3964823, y: 4.3340797} |
|||
- {x: 1.4773248, y: 4.561845} |
|||
- {x: 1.5624928, y: 4.810328} |
|||
- {x: 1.6523882, y: 5.082317} |
|||
- {x: 1.747467, y: 5.381122} |
|||
- {x: 1.8482518, y: 5.710715} |
|||
- {x: 1.9553448, y: 6.0759025} |
|||
- {x: 2.069445, y: 6.482568} |
|||
- {x: 2.1913698, y: 6.9379897} |
|||
- {x: 2.3220856, y: 7.4513016} |
|||
- {x: 2.4627466, y: 8.0341215} |
|||
- {x: 2.614747, y: 8.701484} |
|||
- {x: 2.7797952, y: 9.473195} |
|||
- {x: 2.9600194, y: 10.375936} |
|||
- {x: 3.1581159, y: 11.446505} |
|||
- {x: 3.3775842, y: 12.737201} |
|||
- {x: 3.6230793, y: 14.324919} |
|||
- {x: 3.9009922, y: 16.327562} |
|||
- {x: 4.220452, y: 18.935623} |
|||
- {x: 4.5951686, y: 22.478209} |
|||
- {x: 5.047148, y: 27.57712} |
|||
- {x: 5.615129, y: 35.564823} |
|||
- {x: 6.3776174, y: 49.90625} |
|||
- {x: 7.5374603, y: 83.30668} |
|||
- {x: 10.03481, y: 250.11497} |
|||
m_FilterKernelFarField: |
|||
- {x: 0.03667902, y: 1.5654991} |
|||
- {x: 0.11374626, y: 1.6734134} |
|||
- {x: 0.19626758, y: 1.7949444} |
|||
- {x: 0.28494877, y: 1.9325867} |
|||
- {x: 0.38062802, y: 2.0894418} |
|||
- {x: 0.48430943, y: 2.2694077} |
|||
- {x: 0.59720695, y: 2.4774427} |
|||
- {x: 0.72080237, y: 2.7199378} |
|||
- {x: 0.8569269, y: 3.005264} |
|||
- {x: 1.007873, y: 3.3445888} |
|||
- {x: 1.1765549, y: 3.7531407} |
|||
- {x: 1.3667475, y: 4.252257} |
|||
- {x: 1.5834517, y: 4.872841} |
|||
- {x: 1.8334827, y: 5.6615734} |
|||
- {x: 2.126473, y: 6.692844} |
|||
- {x: 2.4767098, y: 8.093767} |
|||
- {x: 2.9068332, y: 10.102725} |
|||
- {x: 3.4562516, y: 13.228675} |
|||
- {x: 4.2041187, y: 18.793621} |
|||
- {x: 5.3538504, y: 31.646347} |
|||
- {x: 7.84603, y: 95.44374} |
|||
scatterDistance1: {r: 0.3, g: 0.2, b: 0.2, a: 0} |
|||
scatterDistance2: {r: 0.6, g: 0.2, b: 0.2, a: 0} |
|||
lerpWeight: 0.5 |
|||
m_HalfRcpWeightedVariances: {x: 2.4691355, y: 12.5, z: 12.5, w: 2.4691355} |
|||
m_FilterKernelBasic: |
|||
- {x: 0.09090909, y: 0.21162307, z: 0.21162307, w: -0.000000048879357} |
|||
- {x: 0.09090909, y: 0.18990478, z: 0.18990478, w: -0.11381993} |
|||
- {x: 0.09090909, y: 0.13233659, z: 0.13233659, w: -0.23580086} |
|||
- {x: 0.09090909, y: 0.061445467, z: 0.061445467, w: -0.37865555} |
|||
- {x: 0.09090909, y: 0.010501689, z: 0.010501689, w: -0.57677805} |
|||
- {x: 0.09090909, y: 2.9458339e-10, z: 2.9458339e-10, w: -1.3907351} |
|||
- {x: 0.09090909, y: 0.18990476, z: 0.18990476, w: 0.11382001} |
|||
- {x: 0.09090909, y: 0.13233659, z: 0.13233659, w: 0.23580086} |
|||
- {x: 0.09090909, y: 0.061445467, z: 0.061445467, w: 0.37865555} |
|||
- {x: 0.09090909, y: 0.010501689, z: 0.010501689, w: 0.57677805} |
|||
- {x: 0.09090909, y: 2.9456845e-10, z: 2.9456845e-10, w: 1.3907368} |
|
|||
fileFormatVersion: 2 |
|||
guid: aa5f2cc1c22cad043a617e9e9548b1b9 |
|||
timeCreated: 1493291209 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Assets/TestScenes/HDTest/GraphicTest/SSS/Test - SSS model .prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: ef1a9eb2ee53a8f44bf5543cfe520dc7 |
|||
timeCreated: 1500646713 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 100100000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Assets/TestScenes/HDTest/SSSProfiling.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 3ae49a004ada4ea4486096f6ed8c5d46 |
|||
timeCreated: 1500647185 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#pragma kernel ShadeOpaque_Direct_Fptl SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Fptl USE_FPTL_LIGHTLIST |
|||
#pragma kernel ShadeOpaque_Direct_Fptl_DebugDisplay SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Fptl_DebugDisplay USE_FPTL_LIGHTLIST DEBUG_DISPLAY |
|||
#pragma kernel ShadeOpaque_Direct_Clustered SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Clustered USE_CLUSTERED_LIGHTLIST |
|||
#pragma kernel ShadeOpaque_Direct_Clustered_DebugDisplay SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Clustered_DebugDisplay USE_CLUSTERED_LIGHTLIST DEBUG_DISPLAY |
|||
|
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant0 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant0 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=0 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant1 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant1 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=1 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant2 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant2 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=2 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant3 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant3 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=3 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant4 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant4 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=4 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant5 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant5 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=5 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant6 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant6 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=6 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant7 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant7 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=7 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant8 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant8 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=8 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant9 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant9 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=9 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant10 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant10 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=10 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant11 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant11 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=11 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant12 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant12 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=12 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant13 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant13 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=13 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant14 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant14 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=14 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant15 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant15 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=15 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant16 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant16 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=16 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant17 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant17 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=17 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant18 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant18 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=18 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant19 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant19 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=19 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant20 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant20 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=20 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant21 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant21 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=21 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant22 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant22 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=22 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant23 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant23 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=23 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant24 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant24 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=24 |
|||
#pragma kernel ShadeOpaque_Indirect_Fptl_Variant25 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Fptl_Variant25 USE_FPTL_LIGHTLIST USE_INDIRECT VARIANT=25 |
|||
|
|||
// TODO: We should remove these variant for cluster opaque and only keep tile opaque. |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant0 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant0 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=0 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant1 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant1 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=1 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant2 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant2 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=2 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant3 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant3 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=3 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant4 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant4 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=4 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant5 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant5 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=5 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant6 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant6 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=6 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant7 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant7 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=7 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant8 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant8 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=8 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant9 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant9 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=9 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant10 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant10 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=10 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant11 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant11 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=11 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant12 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant12 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=12 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant13 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant13 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=13 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant14 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant14 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=14 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant15 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant15 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=15 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant16 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant16 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=16 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant17 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant17 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=17 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant18 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant18 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=18 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant19 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant19 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=19 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant20 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant20 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=20 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant21 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant21 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=21 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant22 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant22 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=22 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant23 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant23 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=23 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant24 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant24 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=24 |
|||
#pragma kernel ShadeOpaque_Indirect_Clustered_Variant25 SHADE_OPAQUE_ENTRY=ShadeOpaque_Indirect_Clustered_Variant25 USE_CLUSTERED_LIGHTLIST USE_INDIRECT VARIANT=25 |
|||
|
|||
|
|||
#define LIGHTLOOP_TILE_PASS 1 |
|||
#define LIGHTLOOP_TILE_DIRECT 1 |
|||
#define LIGHTLOOP_TILE_INDIRECT 1 |
|||
#define LIGHTLOOP_TILE_ALL 1 |
|||
|
|||
//#pragma enable_d3d11_debug_symbols |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// Include |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
#include "../../../ShaderLibrary/Common.hlsl" |
|||
#include "../../Debug/DebugDisplay.hlsl" |
|||
|
|||
// Note: We have fix as guidelines that we have only one deferred material (with control of GBuffer enabled). Mean a users that add a new |
|||
// deferred material must replace the old one here. If in the future we want to support multiple layout (cause a lot of consistency problem), |
|||
// the deferred shader will require to use multicompile. |
|||
#define UNITY_MATERIAL_LIT // Need to be define before including Material.hlsl |
|||
#include "../../ShaderConfig.cs.hlsl" |
|||
#include "../../ShaderVariables.hlsl" |
|||
#include "../../Lighting/Lighting.hlsl" // This include Material.hlsl |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// variable declaration |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); |
|||
|
|||
RWTexture2D<float3> diffuseLightingUAV; |
|||
RWTexture2D<float4> specularLightingUAV; |
|||
|
|||
CBUFFER_START(UnityShadeOpaque) |
|||
uint g_TileListOffset; |
|||
CBUFFER_END |
|||
|
|||
#if USE_INDIRECT |
|||
StructuredBuffer<uint> g_TileList; |
|||
// Indirect |
|||
[numthreads(16, 16, 1)] |
|||
void SHADE_OPAQUE_ENTRY(uint2 groupThreadId : SV_GroupThreadID, uint groupId : SV_GroupID) |
|||
{ |
|||
uint tileIndex = g_TileList[g_TileListOffset + groupId]; |
|||
uint2 tileCoord = uint2(tileIndex & 0xFFFF, tileIndex >> 16); |
|||
uint2 pixelCoord = tileCoord * GetTileSize() + groupThreadId; |
|||
|
|||
PositionInputs posInput = GetPositionInput(pixelCoord.xy, _ScreenSize.zw, tileCoord); |
|||
uint featureFlags = TileVariantToFeatureFlags(VARIANT); |
|||
#else |
|||
// Direct |
|||
[numthreads(16, 16, 1)] |
|||
void SHADE_OPAQUE_ENTRY(uint2 dispatchThreadId : SV_DispatchThreadID, uint2 groupId : SV_GroupID) |
|||
{ |
|||
uint2 pixelCoord = dispatchThreadId; |
|||
PositionInputs posInput = GetPositionInput(pixelCoord.xy, _ScreenSize.zw, groupId); |
|||
uint featureFlags = 0xFFFFFFFF; |
|||
#endif |
|||
|
|||
float depth = LOAD_TEXTURE2D(_MainDepthTexture, posInput.unPositionSS).x; |
|||
|
|||
// For indirect case: we can still overlap inside a tile with the sky/background, reject it |
|||
// Can't rely on stencil as we are in compute shader |
|||
// TODO : if we have depth bounds test we could remove such a test ? |
|||
if (depth == UNITY_RAW_FAR_CLIP_VALUE) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
UpdatePositionInput(depth, _InvViewProjMatrix, _ViewProjMatrix, posInput); |
|||
float3 V = GetWorldSpaceNormalizeViewDir(posInput.positionWS); |
|||
|
|||
FETCH_GBUFFER(gbuffer, _GBufferTexture, posInput.unPositionSS); |
|||
BSDFData bsdfData; |
|||
float3 bakeDiffuseLighting; |
|||
DECODE_FROM_GBUFFER(gbuffer, featureFlags, bsdfData, bakeDiffuseLighting); |
|||
|
|||
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); |
|||
|
|||
float3 diffuseLighting; |
|||
float3 specularLighting; |
|||
LightLoop(V, posInput, preLightData, bsdfData, bakeDiffuseLighting, featureFlags, diffuseLighting, specularLighting); |
|||
|
|||
if (_EnableSSSAndTransmission != 0 && bsdfData.materialId == MATERIALID_LIT_SSS) |
|||
{ |
|||
// We SSSSS is enabled with use split lighting. |
|||
// SSSSS algorithm need to know which pixels contribute to SSS and which doesn't. We could use the stencil for that but it mean that it will increase the cost of SSSSS |
|||
// A simpler solution is to add a slight contribution here that isn't visible (here we chose fp16 min (which is also fp11 and fp10 min). |
|||
// The SSSSS algorithm will check if diffuse lighting is black and discard the pixel if it is the case |
|||
diffuseLighting.r = max(diffuseLighting.r, HFLT_MIN); |
|||
|
|||
specularLightingUAV[pixelCoord] = float4(specularLighting, 1.0); |
|||
diffuseLightingUAV[pixelCoord] = diffuseLighting; |
|||
} |
|||
else |
|||
{ |
|||
specularLightingUAV[pixelCoord] = float4(diffuseLighting + specularLighting, 1.0); |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 59a5ca19094a8c64099eded20685322f |
|||
folderAsset: yes |
|||
timeCreated: 1500627638 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 2b0e7252e10375942943003cdd139be0 |
|||
folderAsset: yes |
|||
timeCreated: 1500627615 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue