浏览代码
HDRenderPipeline: Clean debgu settings
HDRenderPipeline: Clean debgu settings
- Merge debugViewMaterial with Lightingdebug mode into a DisplayDebug (less pass) - Clean debug code, remove useless file/Branch_batcher
sebastienlagarde
8 年前
当前提交
ed55ce8f
共有 41 个文件被更改,包括 624 次插入 和 839 次删除
-
82Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
-
114Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop.cs
-
61Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Resources/Deferred.shader
-
249Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/shadeopaque.compute
-
66Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
14Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl
-
3Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassResources.cs
-
37Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
38Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs
-
24Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
35Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
38Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/ShaderPass/LitSharePass.hlsl
-
59Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Unlit.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettings.cs
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/FragInputs.hlsl
-
3Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPass.cs
-
1Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPass.cs.hlsl
-
20Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl
-
113Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
-
36Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs.hlsl
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs.hlsl.meta
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs.meta
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.hlsl
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.hlsl.meta
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewMaterialGBuffer.shader.meta
-
105Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewMaterialGBuffer.shader
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewMaterial.cs.hlsl.meta
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewMaterial.cs.meta
-
30Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewMaterial.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs.meta
-
7Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugLighting.hlsl
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugLighting.hlsl.meta
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs.hlsl.meta
-
27Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewMaterial.cs.hlsl
-
79Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs.hlsl
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassDebugViewMaterial.hlsl.meta
-
69Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassDebugViewMaterial.hlsl
|
|||
#pragma kernel ShadeOpaque_Direct_Fptl SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Fptl USE_FPTL_LIGHTLIST |
|||
#pragma kernel ShadeOpaque_Direct_Fptl_DebugLighting SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Fptl_DebugLighting USE_FPTL_LIGHTLIST LIGHTING_DEBUG |
|||
#pragma kernel ShadeOpaque_Direct_Clustered SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Clustered USE_CLUSTERED_LIGHTLIST |
|||
#pragma kernel ShadeOpaque_Direct_Clustered_DebugLighting SHADE_OPAQUE_ENTRY=ShadeOpaque_Direct_Clustered_DebugLighting USE_CLUSTERED_LIGHTLIST LIGHTING_DEBUG |
|||
|
|||
#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_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 #pragma enable_d3d11_debug_symbols |
|||
|
|||
// Split lighting is required for the SSS pass. |
|||
// Not currently possible since we need to access the stencil buffer from the compute shader. |
|||
// #pragma multi_compile _ OUTPUT_SPLIT_LIGHTING |
|||
|
|||
#define LIGHTLOOP_TILE_PASS 1 |
|||
#define LIGHTLOOP_TILE_DIRECT 1 |
|||
#define LIGHTLOOP_TILE_INDIRECT 1 |
|||
#define LIGHTLOOP_TILE_ALL 1 |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// Include |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
#include "../../../../ShaderLibrary/Common.hlsl" |
|||
#include "../../../Debug/HDRenderPipelineDebug.cs.hlsl" |
|||
#include "../../../Debug/DebugLighting.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 |
|||
#include "../../../Lighting/TilePass/FeatureFlags.hlsl" |
|||
//------------------------------------------------------------------------------------- |
|||
// variable declaration |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); |
|||
|
|||
#ifdef OUTPUT_SPLIT_LIGHTING |
|||
RWTexture2D<float4> specularLightingUAV; |
|||
RWTexture2D<float3> diffuseLightingUAV; |
|||
#else |
|||
RWTexture2D<float4> combinedLightingUAV; |
|||
#endif |
|||
|
|||
#if USE_INDIRECT |
|||
uint g_TileListOffset; |
|||
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; |
|||
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); |
|||
|
|||
#ifdef OUTPUT_SPLIT_LIGHTING |
|||
specularLightingUAV[pixelCoord] = float4(specularLighting, 1.0); |
|||
diffuseLightingUAV[pixelCoord] = diffuseLighting; |
|||
#else |
|||
combinedLightingUAV[pixelCoord] = float4(diffuseLighting + specularLighting, 1.0); |
|||
#endif |
|||
} |
|||
|
|||
#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_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 #pragma enable_d3d11_debug_symbols |
|||
|
|||
// Split lighting is required for the SSS pass. |
|||
// Not currently possible since we need to access the stencil buffer from the compute shader. |
|||
// #pragma multi_compile _ OUTPUT_SPLIT_LIGHTING |
|||
|
|||
#define LIGHTLOOP_TILE_PASS 1 |
|||
#define LIGHTLOOP_TILE_DIRECT 1 |
|||
#define LIGHTLOOP_TILE_INDIRECT 1 |
|||
#define LIGHTLOOP_TILE_ALL 1 |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// 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 |
|||
#include "../../../Lighting/TilePass/FeatureFlags.hlsl" |
|||
//------------------------------------------------------------------------------------- |
|||
// variable declaration |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); |
|||
|
|||
#ifdef OUTPUT_SPLIT_LIGHTING |
|||
RWTexture2D<float4> specularLightingUAV; |
|||
RWTexture2D<float3> diffuseLightingUAV; |
|||
#else |
|||
RWTexture2D<float4> combinedLightingUAV; |
|||
#endif |
|||
|
|||
#if USE_INDIRECT |
|||
uint g_TileListOffset; |
|||
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; |
|||
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); |
|||
|
|||
#ifdef OUTPUT_SPLIT_LIGHTING |
|||
specularLightingUAV[pixelCoord] = float4(specularLighting, 1.0); |
|||
diffuseLightingUAV[pixelCoord] = diffuseLighting; |
|||
#else |
|||
combinedLightingUAV[pixelCoord] = float4(diffuseLighting + specularLighting, 1.0); |
|||
#endif |
|||
} |
|||
|
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[GenerateHLSL] |
|||
public enum DebugDisplayMode |
|||
{ |
|||
None, |
|||
ViewMaterial, |
|||
DiffuseLighting, |
|||
SpecularLighting, |
|||
VisualizeCascade |
|||
} |
|||
|
|||
[Serializable] |
|||
public class DebugDisplaySettings |
|||
{ |
|||
public float debugOverlayRatio = 0.33f; |
|||
public bool displayMaterialDebug = false; |
|||
public bool displayRenderingDebug = false; |
|||
public bool displayLightingDebug = false; |
|||
|
|||
public DebugDisplayMode debugDisplayMode = DebugDisplayMode.None; |
|||
|
|||
public MaterialDebugSettings materialDebugSettings = new MaterialDebugSettings(); |
|||
public LightingDebugSettings lightingDebugSettings = new LightingDebugSettings(); |
|||
public RenderingDebugSettings renderingDebugSettings = new RenderingDebugSettings(); |
|||
|
|||
public bool IsDebugDisplayEnable() |
|||
{ |
|||
return debugDisplayMode != DebugDisplayMode.None; |
|||
} |
|||
|
|||
|
|||
public void OnValidate() |
|||
{ |
|||
lightingDebugSettings.OnValidate(); |
|||
} |
|||
} |
|||
|
|||
namespace Attributes |
|||
{ |
|||
// 0 is reserved!
|
|||
[GenerateHLSL] |
|||
public enum DebugViewVarying |
|||
{ |
|||
Texcoord0 = 1, |
|||
Texcoord1, |
|||
Texcoord2, |
|||
Texcoord3, |
|||
VertexTangentWS, |
|||
VertexBitangentWS, |
|||
VertexNormalWS, |
|||
VertexColor, |
|||
VertexColorAlpha, |
|||
// caution if you add something here, it must start below
|
|||
}; |
|||
|
|||
// Number must be contiguous
|
|||
[GenerateHLSL] |
|||
public enum DebugViewGbuffer |
|||
{ |
|||
Depth = DebugViewVarying.VertexColorAlpha + 1, |
|||
BakeDiffuseLightingWithAlbedoPlusEmissive, |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class MaterialDebugSettings |
|||
{ |
|||
public int debugViewMaterial = 0; |
|||
} |
|||
|
|||
[Serializable] |
|||
public class RenderingDebugSettings |
|||
{ |
|||
public bool displayOpaqueObjects = true; |
|||
public bool displayTransparentObjects = true; |
|||
public bool enableDistortion = true; |
|||
public bool enableSSS = true; |
|||
} |
|||
|
|||
public enum ShadowMapDebugMode |
|||
{ |
|||
None, |
|||
VisualizeAtlas, |
|||
VisualizeShadowMap |
|||
} |
|||
|
|||
[Serializable] |
|||
public class LightingDebugSettings |
|||
{ |
|||
public bool enableShadows = true; |
|||
public ShadowMapDebugMode shadowDebugMode = ShadowMapDebugMode.None; |
|||
public uint shadowMapIndex = 0; |
|||
|
|||
public bool overrideSmoothness = false; |
|||
public float overrideSmoothnessValue = 0.5f; |
|||
public Color debugLightingAlbedo = new Color(0.5f, 0.5f, 0.5f); |
|||
|
|||
public bool displaySkyReflection = false; |
|||
public float skyReflectionMipmap = 0.0f; |
|||
|
|||
public void OnValidate() |
|||
{ |
|||
overrideSmoothnessValue = Mathf.Clamp(overrideSmoothnessValue, 0.0f, 1.0f); |
|||
skyReflectionMipmap = Mathf.Clamp(skyReflectionMipmap, 0.0f, 1.0f); |
|||
} |
|||
} |
|||
} |
|
|||
// |
|||
// This file was automatically generated from Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs. Please don't edit by hand. |
|||
// |
|||
|
|||
#ifndef DEBUGDISPLAY_CS_HLSL |
|||
#define DEBUGDISPLAY_CS_HLSL |
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.DebugDisplayMode: static fields |
|||
// |
|||
#define DEBUGDISPLAYMODE_NONE (0) |
|||
#define DEBUGDISPLAYMODE_VIEW_MATERIAL (1) |
|||
#define DEBUGDISPLAYMODE_DIFFUSE_LIGHTING (2) |
|||
#define DEBUGDISPLAYMODE_SPECULAR_LIGHTING (3) |
|||
#define DEBUGDISPLAYMODE_VISUALIZE_CASCADE (4) |
|||
|
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.Attributes.DebugViewVarying: static fields |
|||
// |
|||
#define DEBUGVIEWVARYING_TEXCOORD0 (1) |
|||
#define DEBUGVIEWVARYING_TEXCOORD1 (2) |
|||
#define DEBUGVIEWVARYING_TEXCOORD2 (3) |
|||
#define DEBUGVIEWVARYING_TEXCOORD3 (4) |
|||
#define DEBUGVIEWVARYING_VERTEX_TANGENT_WS (5) |
|||
#define DEBUGVIEWVARYING_VERTEX_BITANGENT_WS (6) |
|||
#define DEBUGVIEWVARYING_VERTEX_NORMAL_WS (7) |
|||
#define DEBUGVIEWVARYING_VERTEX_COLOR (8) |
|||
#define DEBUGVIEWVARYING_VERTEX_COLOR_ALPHA (9) |
|||
|
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.Attributes.DebugViewGbuffer: static fields |
|||
// |
|||
#define DEBUGVIEWGBUFFER_DEPTH (10) |
|||
#define DEBUGVIEWGBUFFER_BAKE_DIFFUSE_LIGHTING_WITH_ALBEDO_PLUS_EMISSIVE (11) |
|||
|
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 8f206be5d6c03164da4ba185ebead15a |
|||
timeCreated: 1492764489 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: af3e841f9b2f10049b025e31928eef49 |
|||
timeCreated: 1492764488 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_DEBUG_DISPLAY_INCLUDED |
|||
#define UNITY_DEBUG_DISPLAY_INCLUDED |
|||
|
|||
#include "DebugDisplay.cs.hlsl" |
|||
|
|||
// Set of parameters available when switching to debug shader mode |
|||
int _DebugDisplayMode; // Match enum DebugDisplayMode |
|||
int _DebugViewMaterial; // Contain the id (define in various materialXXX.cs.hlsl) of the property to display |
|||
float4 _DebugLightingAlbedo; // xyz = albedo for diffuse, w unused |
|||
float4 _DebugLightingSmoothness; // x == bool override, y == override value |
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: d6dd73727229cdd41ab7f4b61be39b73 |
|||
timeCreated: 1492764490 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 439949ea1bfa91b4ba0d04269fcde33d |
|||
timeCreated: 1476053153 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Shader "Hidden/HDRenderPipeline/DebugViewMaterialGBuffer" |
|||
{ |
|||
SubShader |
|||
{ |
|||
Pass |
|||
{ |
|||
ZWrite Off |
|||
Blend SrcAlpha OneMinusSrcAlpha // We will lerp only the values that are valid |
|||
|
|||
HLSLPROGRAM |
|||
#pragma target 4.5 |
|||
#pragma only_renderers d3d11 ps4 metal // TEMP: until we go further in dev |
|||
|
|||
#pragma vertex Vert |
|||
#pragma fragment Frag |
|||
|
|||
#include "../../../ShaderLibrary/Common.hlsl" |
|||
#include "../../../ShaderLibrary/Color.hlsl" |
|||
|
|||
// CAUTION: In case deferred lighting need to support various lighting model statically, we will require to do multicompile with different define like UNITY_MATERIAL_LIT |
|||
#define UNITY_MATERIAL_LIT // Need to be define before including Material.hlsl |
|||
#include "../../ShaderConfig.cs.hlsl" |
|||
#include "../../ShaderVariables.hlsl" |
|||
#include "../../Debug/DebugViewMaterial.cs.hlsl" |
|||
#include "../../Material/Material.hlsl" |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); |
|||
|
|||
int _DebugViewMaterial; |
|||
|
|||
struct Attributes |
|||
{ |
|||
float3 positionOS : POSITION; |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 positionCS : SV_POSITION; |
|||
}; |
|||
|
|||
Varyings Vert(Attributes input) |
|||
{ |
|||
// TODO: implement SV_vertexID full screen quad |
|||
Varyings output; |
|||
float3 positionWS = TransformObjectToWorld(input.positionOS); |
|||
output.positionCS = TransformWorldToHClip(positionWS); |
|||
|
|||
return output; |
|||
} |
|||
|
|||
float4 Frag(Varyings input) : SV_Target |
|||
{ |
|||
// input.positionCS is SV_Position |
|||
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw); |
|||
float depth = LOAD_TEXTURE2D(_MainDepthTexture, posInput.unPositionSS).x; |
|||
UpdatePositionInput(depth, _InvViewProjMatrix, _ViewProjMatrix, posInput); |
|||
|
|||
FETCH_GBUFFER(gbuffer, _GBufferTexture, posInput.unPositionSS); |
|||
BSDFData bsdfData; |
|||
float3 bakeDiffuseLighting; |
|||
DECODE_FROM_GBUFFER(gbuffer, 0xFFFFFFFF, bsdfData, bakeDiffuseLighting); |
|||
|
|||
// Init to not expected value |
|||
float3 result = float3(-666.0, 0.0, 0.0); |
|||
bool needLinearToSRGB = false; |
|||
|
|||
if (_DebugViewMaterial == DEBUGVIEWGBUFFER_DEPTH) |
|||
{ |
|||
float linearDepth = frac(posInput.depthVS * 0.1); |
|||
result = linearDepth.xxx; |
|||
} |
|||
// Caution: This value is not the same than the builtin data bakeDiffuseLighting. It also include emissive and multiply by the albedo |
|||
else if (_DebugViewMaterial == DEBUGVIEWGBUFFER_BAKE_DIFFUSE_LIGHTING_WITH_ALBEDO_PLUS_EMISSIVE) |
|||
{ |
|||
// TODO: require a remap |
|||
// TODO: we should not gamma correct, but easier to debug for now without correct high range value |
|||
result = bakeDiffuseLighting; needLinearToSRGB = true; |
|||
} |
|||
|
|||
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB); |
|||
|
|||
// f we haven't touch result, we don't blend it. This allow to have the GBuffer debug pass working with the regular forward debug pass. |
|||
// The forward debug pass will write its value and then the deferred will overwrite only touched texels. |
|||
if (result.x == -666.0) |
|||
{ |
|||
return float4(0.0, 0.0, 0.0, 0.0); |
|||
} |
|||
else |
|||
{ |
|||
// TEMP! |
|||
// For now, the final blit in the backbuffer performs an sRGB write |
|||
// So in the meantime we apply the inverse transform to linear data to compensate. |
|||
if (!needLinearToSRGB) |
|||
result = SRGBToLinear(max(0, result)); |
|||
|
|||
return float4(result, 1.0); |
|||
} |
|||
} |
|||
|
|||
ENDHLSL |
|||
} |
|||
|
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 972a0c56f0332c84f95914786d1f2f4b |
|||
timeCreated: 1479292942 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 4a6949840f48a7948a9610d89e539bf9 |
|||
timeCreated: 1479292895 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
namespace Attributes |
|||
{ |
|||
// 0 is reserved!
|
|||
|
|||
[GenerateHLSL] |
|||
public enum DebugViewVarying |
|||
{ |
|||
Texcoord0 = 1, |
|||
Texcoord1, |
|||
Texcoord2, |
|||
Texcoord3, |
|||
VertexTangentWS, |
|||
VertexBitangentWS, |
|||
VertexNormalWS, |
|||
VertexColor, |
|||
VertexColorAlpha, |
|||
// caution if you add something here, it must start below
|
|||
}; |
|||
|
|||
// Number must be contiguous
|
|||
[GenerateHLSL] |
|||
public enum DebugViewGbuffer |
|||
{ |
|||
Depth = DebugViewVarying.VertexColorAlpha + 1, |
|||
BakeDiffuseLightingWithAlbedoPlusEmissive, |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ae82efafe32ed1042a9360276bee62e6 |
|||
timeCreated: 1485277036 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_DEBUG_LIGHTING_INCLUDED |
|||
#define UNITY_DEBUG_LIGHTING_INCLUDED |
|||
|
|||
float4 _DebugLightModeAndAlbedo; // x == debug mode, yzw = albedo for diffuse. |
|||
float4 _DebugLightingSmoothness; // x == bool override, y == override value |
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 1af9f7b2ee767504fb89dc98550d62f6 |
|||
timeCreated: 1486032323 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 04e346a720261d94b85f6d20b0cd8064 |
|||
timeCreated: 1486041561 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// |
|||
// This file was automatically generated from Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugViewMaterial.cs. Please don't edit by hand. |
|||
// |
|||
|
|||
#ifndef DEBUGVIEWMATERIAL_CS_HLSL |
|||
#define DEBUGVIEWMATERIAL_CS_HLSL |
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.Attributes.DebugViewVarying: static fields |
|||
// |
|||
#define DEBUGVIEWVARYING_TEXCOORD0 (1) |
|||
#define DEBUGVIEWVARYING_TEXCOORD1 (2) |
|||
#define DEBUGVIEWVARYING_TEXCOORD2 (3) |
|||
#define DEBUGVIEWVARYING_TEXCOORD3 (4) |
|||
#define DEBUGVIEWVARYING_VERTEX_TANGENT_WS (5) |
|||
#define DEBUGVIEWVARYING_VERTEX_BITANGENT_WS (6) |
|||
#define DEBUGVIEWVARYING_VERTEX_NORMAL_WS (7) |
|||
#define DEBUGVIEWVARYING_VERTEX_COLOR (8) |
|||
#define DEBUGVIEWVARYING_VERTEX_COLOR_ALPHA (9) |
|||
|
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.Attributes.DebugViewGbuffer: static fields |
|||
// |
|||
#define DEBUGVIEWGBUFFER_DEPTH (10) |
|||
#define DEBUGVIEWGBUFFER_BAKE_DIFFUSE_LIGHTING_WITH_ALBEDO_PLUS_EMISSIVE (11) |
|||
|
|||
|
|||
#endif |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[Serializable] |
|||
public class GlobalDebugSettings |
|||
{ |
|||
public float debugOverlayRatio = 0.33f; |
|||
public bool displayMaterialDebug = false; |
|||
public bool displayRenderingDebug = false; |
|||
public bool displayLightingDebug = false; |
|||
|
|||
public MaterialDebugSettings materialDebugSettings = new MaterialDebugSettings(); |
|||
public LightingDebugSettings lightingDebugSettings = new LightingDebugSettings(); |
|||
public RenderingDebugSettings renderingDebugSettings = new RenderingDebugSettings(); |
|||
|
|||
public void OnValidate() |
|||
{ |
|||
lightingDebugSettings.OnValidate(); |
|||
} |
|||
} |
|||
|
|||
|
|||
[Serializable] |
|||
public class MaterialDebugSettings |
|||
{ |
|||
public int debugViewMaterial = 0; |
|||
} |
|||
|
|||
[Serializable] |
|||
public class RenderingDebugSettings |
|||
{ |
|||
public bool displayOpaqueObjects = true; |
|||
public bool displayTransparentObjects = true; |
|||
public bool enableDistortion = true; |
|||
public bool enableSSS = true; |
|||
} |
|||
|
|||
public enum ShadowMapDebugMode |
|||
{ |
|||
None, |
|||
VisualizeAtlas, |
|||
VisualizeShadowMap |
|||
} |
|||
|
|||
[GenerateHLSL] |
|||
public enum LightingDebugMode |
|||
{ |
|||
None, |
|||
DiffuseLighting, |
|||
SpecularLighting, |
|||
VisualizeCascade |
|||
} |
|||
|
|||
[Serializable] |
|||
public class LightingDebugSettings |
|||
{ |
|||
public bool enableShadows = true; |
|||
public ShadowMapDebugMode shadowDebugMode = ShadowMapDebugMode.None; |
|||
public uint shadowMapIndex = 0; |
|||
|
|||
public LightingDebugMode lightingDebugMode = LightingDebugMode.None; |
|||
public bool overrideSmoothness = false; |
|||
public float overrideSmoothnessValue = 0.5f; |
|||
public Color debugLightingAlbedo = new Color(0.5f, 0.5f, 0.5f); |
|||
|
|||
public bool displaySkyReflection = false; |
|||
public float skyReflectionMipmap = 0.0f; |
|||
|
|||
public void OnValidate() |
|||
{ |
|||
overrideSmoothnessValue = Mathf.Clamp(overrideSmoothnessValue, 0.0f, 1.0f); |
|||
skyReflectionMipmap = Mathf.Clamp(skyReflectionMipmap, 0.0f, 1.0f); |
|||
} |
|||
} |
|||
} |
|
|||
// |
|||
// This file was automatically generated from Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs. Please don't edit by hand. |
|||
// |
|||
|
|||
#ifndef HDRENDERPIPELINEDEBUG_CS_HLSL |
|||
#define HDRENDERPIPELINEDEBUG_CS_HLSL |
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.LightingDebugMode: static fields |
|||
// |
|||
#define LIGHTINGDEBUGMODE_NONE (0) |
|||
#define LIGHTINGDEBUGMODE_DIFFUSE_LIGHTING (1) |
|||
#define LIGHTINGDEBUGMODE_SPECULAR_LIGHTING (2) |
|||
#define LIGHTINGDEBUGMODE_VISUALIZE_CASCADE (3) |
|||
|
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: e786716259fc05e4299d8dd2350471ef |
|||
timeCreated: 1476885564 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#if SHADERPASS != SHADERPASS_DEBUG_VIEW_MATERIAL |
|||
#error SHADERPASS_is_not_correctly_define |
|||
#endif |
|||
|
|||
#include "ShaderLibrary/Color.hlsl" |
|||
int _DebugViewMaterial; |
|||
|
|||
#include "VertMesh.hlsl" |
|||
|
|||
PackedVaryingsType Vert(AttributesMesh inputMesh) |
|||
{ |
|||
VaryingsType varyingsType; |
|||
varyingsType.vmesh = VertMesh(inputMesh); |
|||
return PackVaryingsType(varyingsType); |
|||
} |
|||
|
|||
#ifdef TESSELLATION_ON |
|||
|
|||
PackedVaryingsToPS VertTesselation(VaryingsToDS input) |
|||
{ |
|||
VaryingsToPS output; |
|||
output.vmesh = VertMeshTesselation(input.vmesh); |
|||
return PackVaryingsToPS(output); |
|||
} |
|||
|
|||
#include "TessellationShare.hlsl" |
|||
|
|||
#endif // TESSELLATION_ON |
|||
|
|||
void Frag( PackedVaryingsToPS packedInput |
|||
, out float4 outColor : SV_Target |
|||
#ifdef _DEPTHOFFSET_ON |
|||
, out float outputDepth : SV_Depth |
|||
#endif |
|||
) |
|||
{ |
|||
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh); |
|||
|
|||
// input.unPositionSS is SV_Position |
|||
PositionInputs posInput = GetPositionInput(input.unPositionSS.xy, _ScreenSize.zw, uint2(0, 0)); |
|||
UpdatePositionInput(input.unPositionSS.z, input.unPositionSS.w, input.positionWS, posInput); |
|||
float3 V = GetWorldSpaceNormalizeViewDir(input.positionWS); |
|||
|
|||
SurfaceData surfaceData; |
|||
BuiltinData builtinData; |
|||
GetSurfaceAndBuiltinData(input, V, posInput, surfaceData, builtinData); |
|||
|
|||
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData); |
|||
|
|||
float3 result = float3(1.0, 0.0, 1.0); |
|||
bool needLinearToSRGB = false; |
|||
|
|||
GetVaryingsDataDebug(_DebugViewMaterial, input, result, needLinearToSRGB); |
|||
GetBuiltinDataDebug(_DebugViewMaterial, builtinData, result, needLinearToSRGB); |
|||
GetSurfaceDataDebug(_DebugViewMaterial, surfaceData, result, needLinearToSRGB); |
|||
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB); // TODO: This required to initialize all field from BSDFData... |
|||
|
|||
// TEMP! |
|||
// For now, the final blit in the backbuffer performs an sRGB write |
|||
// So in the meantime we apply the inverse transform to linear data to compensate. |
|||
if (!needLinearToSRGB) |
|||
result = SRGBToLinear(max(0, result)); |
|||
|
|||
#ifdef _DEPTHOFFSET_ON |
|||
outputDepth = posInput.depthRaw; |
|||
#endif |
|||
|
|||
outColor = float4(result, 1.0); |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue