runes
8 年前
当前提交
9d2ab9fb
共有 5 个文件被更改,包括 96 次插入 和 1005 次删除
-
8Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs
-
2Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
1001Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
-
81Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/Resources/shadeopaque.compute
-
9Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/Resources/shadeopaque.compute.meta
1001
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
#pragma kernel ShadeOpaque_Fptl SHADE_OPAQUE_ENTRY=ShadeOpaque_Fptl USE_FPTL_LIGHTLIST=1 |
|||
#pragma kernel ShadeOpaque_Clustered SHADE_OPAQUE_ENTRY=ShadeOpaque_Clustered USE_CLUSTERED_LIGHTLIST=1 |
|||
|
|||
|
|||
#define LIGHTLOOP_TILE_PASS 1 |
|||
#define LIGHTLOOP_TILE_DIRECT 1 |
|||
#define LIGHTLOOP_TILE_INDIRECT 1 |
|||
#define LIGHTLOOP_TILE_ALL 1 |
|||
#define USE_FPTL_LIGHTLIST 1 |
|||
|
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// Include |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
#include "Common.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 "Assets/ScriptableRenderLoop/HDRenderLoop/ShaderConfig.cs.hlsl" |
|||
#include "Assets/ScriptableRenderLoop/HDRenderLoop/ShaderVariables.hlsl" |
|||
#include "Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/Lighting.hlsl" // This include Material.hlsl |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// variable declaration |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); |
|||
|
|||
TEXTURE2D(_CameraDepthTexture); |
|||
SAMPLER2D(sampler_CameraDepthTexture); |
|||
|
|||
RWTexture2D<float4> uavOutput; |
|||
|
|||
// Calculate the offset in global light index light for current light category |
|||
int GetTileOffset2(PositionInputs posInput, uint lightCategory) |
|||
{ |
|||
uint2 tileIndex = posInput.unPositionSS / TILE_SIZE; |
|||
return (tileIndex.y + lightCategory * _NumTileY) * _NumTileX + tileIndex.x; |
|||
} |
|||
|
|||
void GetCountAndStartTile2(PositionInputs posInput, uint lightCategory, out uint start, out uint lightCount) |
|||
{ |
|||
const int tileOffset = GetTileOffset(posInput, lightCategory); |
|||
|
|||
// The first entry inside a tile is the number of light for lightCategory (thus the +0) |
|||
lightCount = g_vLightListGlobal[DWORD_PER_TILE * tileOffset + 0] & 0xffff; |
|||
start = tileOffset; |
|||
} |
|||
|
|||
void GetCountAndStart2(PositionInputs posInput, uint lightCategory, out uint start, out uint lightCount) |
|||
{ |
|||
GetCountAndStartTile2(posInput, lightCategory, start, lightCount); |
|||
} |
|||
|
|||
[numthreads(TILE_SIZE, TILE_SIZE, 1)] |
|||
void SHADE_OPAQUE_ENTRY(uint2 dispatchThreadId : SV_DispatchThreadID, uint2 groupId : SV_GroupID) |
|||
{ |
|||
// input.positionCS is SV_Position |
|||
uint2 pixelCoord = dispatchThreadId; |
|||
PositionInputs posInput = GetPositionInput(pixelCoord.xy, _ScreenSize.zw); |
|||
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, 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, bsdfData, bakeDiffuseLighting); |
|||
|
|||
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData); |
|||
|
|||
float3 diffuseLighting; |
|||
float3 specularLighting; |
|||
LightLoop(V, posInput, preLightData, bsdfData, bakeDiffuseLighting, diffuseLighting, specularLighting); |
|||
|
|||
uavOutput[pixelCoord] = float4(diffuseLighting + specularLighting, 1.0); |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 0b64f79746d2daf4198eaf6eab9af259 |
|||
timeCreated: 1481798903 |
|||
licenseType: Pro |
|||
ComputeShaderImporter: |
|||
currentAPIMask: 4 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue