浏览代码
Merge pull request #71 from Unity-Technologies/Renaming-HDRenderLoop
Merge pull request #71 from Unity-Technologies/Renaming-HDRenderLoop
Renaming hdrenderloop to hd renderPipeline/main
GitHub
8 年前
当前提交
23f2ee44
共有 154 个文件被更改,包括 1691 次插入 和 377 次删除
-
8Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
-
2Assets/Editor/Tests/RenderloopTests/CullResultsTest.cs
-
12Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs
-
10Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
-
2Assets/ShaderGenerator/Editor/ShaderGeneratorMenu.cs
-
10ProjectSettings/GraphicsSettings.asset
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderConfig.cs.hlsl
-
4Assets/ScriptableRenderLoop/HDRenderPipeline/PostProcess/Resources/FinalPass.shader
-
8Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/Resources/DebugViewTiles.shader
-
10Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/Resources/DebugViewMaterialGBuffer.shader
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/DebugViewMaterial.cs.hlsl
-
26Assets/ScriptableRenderLoop/HDRenderPipeline/SceneSettings/CommonSettings.cs
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPass.cs.hlsl
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassLightTransport.hlsl
-
10Assets/ScriptableRenderLoop/HDRenderPipeline/Editor/UpgradeStandardShaderMaterials.cs
-
4Assets/ScriptableRenderLoop/HDRenderPipeline/Editor/HDRenderLoopMenuItems.cs
-
46Assets/ScriptableRenderLoop/HDRenderPipeline/Editor/HDRenderLoopInspector.cs
-
220Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderLoop.cs
-
52Assets/ScriptableRenderLoop/HDRenderPipeline/Utilities.cs
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/TilePass/TilePass.cs.hlsl
-
22Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
120Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/TilePass/Resources/shadeopaque.compute
-
8Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/Resources/Deferred.shader
-
12Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/Lighting.hlsl
-
4Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/LightLoop.cs
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/LightDefinition.cs.hlsl
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Attributes.hlsl
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Builtin/BuiltinData.cs.hlsl
-
10Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Unlit/Unlit.shader
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Unlit/Unlit.cs.hlsl
-
10Assets/ScriptableRenderLoop/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.cs.hlsl
-
4Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Resources/PreIntegratedFGD.shader
-
6Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/StandardToHDLitMaterialUpgrader.cs
-
6Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/StandardSpecularToHDLitMaterialUpgrader.cs
-
10Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.shader
-
6Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.cs
-
18Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/SkyParameters.cs
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/SkyManager.cs.hlsl
-
42Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/SkyManager.cs
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/Resources/GGXConvolve.shader
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader
-
4Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkyRenderer.cs
-
2Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader
-
4Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/HDRISky/HDRISkyRenderer.cs
-
9Assets/ScriptableRenderLoop/HDRenderPipeline.meta
-
24Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderPipeline.asset
-
8Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderPipeline.asset.meta
-
110Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Builtin/BuiltinData.hlsl
-
1001Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.hlsl
-
151Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Material.hlsl
-
9Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPass.cs.hlsl.meta
-
9Assets/ScriptableRenderLoop/HDRenderPipeline/Sky/SkyManager.cs.hlsl.meta
-
9Assets/ScriptableRenderLoop/HDRenderLoop.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderLoop.asset
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderLoop.asset.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/HDRenderLoop.cs.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Shadow
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Debug.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Material.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/PostProcess.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderConfig.cs
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderConfig.cs.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderConfig.cs.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderVariables.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Shadow.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderConfig.cs.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/PostProcess
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Debug
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Editor.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Sky.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/Utilities.cs.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/SceneSettings.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/SceneSettings
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassDebugViewMaterial.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassGBuffer.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassForwardUnlit.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPass.cs
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPass.cs.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPass.cs.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassLightTransport.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassLightTransport.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassVelocity.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassVelocity.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassDebugViewMaterial.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassForwardUnlit.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassDistortion.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassDistortion.hlsl.meta
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl
-
0/Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl
|
|||
#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; |
|||
|
|||
[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); |
|||
} |
|||
|
|||
#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/HDRenderPipeline/ShaderConfig.cs.hlsl" |
|||
#include "Assets/ScriptableRenderLoop/HDRenderPipeline/ShaderVariables.hlsl" |
|||
#include "Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/Lighting.hlsl" // This include Material.hlsl |
|||
|
|||
//------------------------------------------------------------------------------------- |
|||
// variable declaration |
|||
//------------------------------------------------------------------------------------- |
|||
|
|||
DECLARE_GBUFFER_TEXTURE(_GBufferTexture); |
|||
|
|||
TEXTURE2D(_CameraDepthTexture); |
|||
SAMPLER2D(sampler_CameraDepthTexture); |
|||
|
|||
RWTexture2D<float4> uavOutput; |
|||
|
|||
[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: 4c38eac64d0e8344d85c9f309419d619 |
|||
folderAsset: yes |
|||
timeCreated: 1483548930 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
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: 0} |
|||
m_Name: HDRenderPipeline |
|||
m_EditorClassIdentifier: Assembly-CSharp:UnityEngine.Experimental.ScriptableRenderLoop:HDRenderPipeline |
|||
m_ShadowSettings: |
|||
enabled: 1 |
|||
shadowAtlasWidth: 4096 |
|||
shadowAtlasHeight: 4096 |
|||
maxShadowDistance: 1000 |
|||
directionalLightCascadeCount: 4 |
|||
directionalLightCascades: {x: 0.05, y: 0.2, z: 0.3} |
|||
m_TextureSettings: |
|||
spotCookieSize: 128 |
|||
pointCookieSize: 512 |
|||
reflectionCubemapSize: 128 |
|
|||
fileFormatVersion: 2 |
|||
guid: e185fecca3c73cd47a09f1092663ef32 |
|||
timeCreated: 1483549297 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_BUILTIN_DATA_INCLUDED |
|||
#define UNITY_BUILTIN_DATA_INCLUDED |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// BuiltinData |
|||
// This structure include common data that should be present in all material |
|||
// and are independent from the BSDF parametrization. |
|||
// Note: These parameters can be store in GBuffer if the writer wants |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
#include "BuiltinData.cs.hlsl" |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// common Encode/Decode functions |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
// Guideline for velocity buffer. |
|||
// We support various architecture for HDRenderPipeline |
|||
// - Forward only rendering |
|||
// - Hybrid forward/deferred opaque |
|||
// - Regular deferred |
|||
// The velocity buffer is potentially fill in several pass. |
|||
// - In gbuffer pass with extra RT |
|||
// - In forward opaque pass (Can happen even when deferred) with MRT |
|||
// - In dedicated velocity pass |
|||
// Also the velocity buffer is only fill in case of dynamic or deformable objects, static case can use camera reprojection to retrieve motion vector (<= TODO: this may be false with TAA due to jitter matrix) |
|||
// or just previous and current transform |
|||
|
|||
// So here we decide the following rules: |
|||
// - A deferred material can't override the velocity buffer format of builtinData, must use appropriate function |
|||
// - If velocity buffer is enable in deferred material it is the last one |
|||
// - Velocity buffer can be optionally enabled (either in forward or deferred) |
|||
// - Velocity data can't be pack with other properties |
|||
// - Same velocity buffer is use for all scenario, so if deferred define a velocity buffer, the same is reuse for forward case. |
|||
// For these reasons we chose to avoid to pack velocity buffer with anything else in case of PackgbufferInFP16 (and also in case the format change) |
|||
|
|||
// Encode/Decode velocity/distortion in a buffer (either forward of deferred) |
|||
// Design note: We assume that velocity/distortion fit into a single buffer (i.e not spread on several buffer) |
|||
void EncodeVelocity(float2 velocity, out float4 outBuffer) |
|||
{ |
|||
// RT - 16:16 float |
|||
outBuffer = float4(velocity.xy, 0.0, 0.0); |
|||
} |
|||
|
|||
void DecodeVelocity(float4 inBuffer, out float2 velocity) |
|||
{ |
|||
velocity = inBuffer.xy; |
|||
} |
|||
|
|||
void EncodeDistortion(float2 distortion, float distortionBlur, out float4 outBuffer) |
|||
{ |
|||
// RT - 16:16:16:16 float |
|||
// distortionBlur in alpha for a different blend mode |
|||
outBuffer = float4(distortion, 0.0, distortionBlur); |
|||
} |
|||
|
|||
void DecodeDistortion(float4 inBuffer, out float2 distortion, out float2 distortionBlur) |
|||
{ |
|||
distortion = inBuffer.xy; |
|||
distortionBlur = inBuffer.a; |
|||
} |
|||
|
|||
void GetBuiltinDataDebug(uint paramId, BuiltinData builtinData, inout float3 result, inout bool needLinearToSRGB) |
|||
{ |
|||
switch (paramId) |
|||
{ |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_OPACITY: |
|||
result = builtinData.opacity.xxx; |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_BAKE_DIFFUSE_LIGHTING: |
|||
// TODO: require a remap |
|||
result = builtinData.bakeDiffuseLighting; |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_EMISSIVE_COLOR: |
|||
// emissiveColor is premultiply by emissive intensity |
|||
result = (builtinData.emissiveColor / builtinData.emissiveIntensity); needLinearToSRGB = true; |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_EMISSIVE_INTENSITY: |
|||
result = builtinData.emissiveIntensity.xxx; |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_VELOCITY: |
|||
result = float3(builtinData.velocity, 0.0); |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_DISTORTION: |
|||
result = float3(builtinData.distortion, 0.0); |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_DISTORTION_BLUR: |
|||
result = builtinData.distortionBlur.xxx; |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_BUILTINDATA_DEPTH_OFFSET: |
|||
result = builtinData.depthOffset.xxx * 10.0; // * 10 assuming 1 unity unity is 1m |
|||
break; |
|||
} |
|||
} |
|||
|
|||
void GetLighTransportDataDebug(uint paramId, LighTransportData lightTransportData, inout float3 result, inout bool needLinearToSRGB) |
|||
{ |
|||
switch (paramId) |
|||
{ |
|||
case DEBUGVIEW_BUILTIN_LIGHTRANSPORTDATA_DIFFUSE_COLOR: |
|||
result = lightTransportData.diffuseColor; needLinearToSRGB = true; |
|||
break; |
|||
case DEBUGVIEW_BUILTIN_LIGHTRANSPORTDATA_EMISSIVE_COLOR: |
|||
// TODO: Need a tonemap ? |
|||
result = lightTransportData.emissiveColor; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
#endif // UNITY_BUILTIN_DATA_INCLUDED |
1001
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.hlsl
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
#ifndef UNITY_MATERIAL_INCLUDED |
|||
#define UNITY_MATERIAL_INCLUDED |
|||
|
|||
#include "Color.hlsl" |
|||
#include "Packing.hlsl" |
|||
#include "BSDF.hlsl" |
|||
#include "Debug.hlsl" |
|||
#include "GeometricTools.hlsl" |
|||
#include "CommonMaterial.hlsl" |
|||
#include "EntityLighting.hlsl" |
|||
#include "ImageBasedLighting.hlsl" |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// BuiltinData |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
#include "Builtin/BuiltinData.hlsl" |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// Material definition |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
// Here we include all the different lighting model supported by the renderloop based on define done in .shader |
|||
// Only one deferred layout is allowed for a HDRenderPipeline, this will be detect by the redefinition of GBUFFERMATERIAL_COUNT |
|||
// If GBUFFERMATERIAL_COUNT is define two time, the shaders will not compile |
|||
#ifdef UNITY_MATERIAL_LIT |
|||
#include "Lit/Lit.hlsl" |
|||
#elif defined(UNITY_MATERIAL_UNLIT) |
|||
#include "Unlit/Unlit.hlsl" |
|||
#endif |
|||
|
|||
//----------------------------------------------------------------------------- |
|||
// Define for GBuffer management |
|||
//----------------------------------------------------------------------------- |
|||
|
|||
#ifdef GBUFFERMATERIAL_COUNT |
|||
|
|||
#if GBUFFERMATERIAL_COUNT == 2 |
|||
|
|||
#define OUTPUT_GBUFFER(NAME) \ |
|||
out GBufferType0 MERGE_NAME(NAME, 0) : SV_Target0, \ |
|||
out GBufferType1 MERGE_NAME(NAME, 1) : SV_Target1 |
|||
|
|||
#define DECLARE_GBUFFER_TEXTURE(NAME) \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 0)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 1)); |
|||
|
|||
#define FETCH_GBUFFER(NAME, TEX, unCoord2) \ |
|||
GBufferType0 MERGE_NAME(NAME, 0) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 0), unCoord2); \ |
|||
GBufferType1 MERGE_NAME(NAME, 1) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 1), unCoord2); |
|||
|
|||
#define ENCODE_INTO_GBUFFER(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, NAME) EncodeIntoGBuffer(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, MERGE_NAME(NAME,0), MERGE_NAME(NAME,1)) |
|||
#define DECODE_FROM_GBUFFER(NAME, BSDF_DATA, BAKE_DIFFUSE_LIGHTING) DecodeFromGBuffer(MERGE_NAME(NAME,0), MERGE_NAME(NAME,1), BSDF_DATA, BAKE_DIFFUSE_LIGHTING) |
|||
|
|||
#if SHADEROPTIONS_VELOCITY_IN_GBUFFER |
|||
#define OUTPUT_GBUFFER_VELOCITY(NAME) ,out float4 NAME : SV_Target2 |
|||
#endif |
|||
|
|||
#elif GBUFFERMATERIAL_COUNT == 3 |
|||
|
|||
#define OUTPUT_GBUFFER(NAME) \ |
|||
out GBufferType0 MERGE_NAME(NAME, 0) : SV_Target0, \ |
|||
out GBufferType1 MERGE_NAME(NAME, 1) : SV_Target1, \ |
|||
out GBufferType2 MERGE_NAME(NAME, 2) : SV_Target2 |
|||
|
|||
#define DECLARE_GBUFFER_TEXTURE(NAME) \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 0)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 1)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 2)); |
|||
|
|||
#define FETCH_GBUFFER(NAME, TEX, unCoord2) \ |
|||
GBufferType0 MERGE_NAME(NAME, 0) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 0), unCoord2); \ |
|||
GBufferType1 MERGE_NAME(NAME, 1) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 1), unCoord2); \ |
|||
GBufferType2 MERGE_NAME(NAME, 2) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 2), unCoord2); |
|||
|
|||
#define ENCODE_INTO_GBUFFER(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, NAME) EncodeIntoGBuffer(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, MERGE_NAME(NAME,0), MERGE_NAME(NAME,1), MERGE_NAME(NAME,2)) |
|||
#define DECODE_FROM_GBUFFER(NAME, BSDF_DATA, BAKE_DIFFUSE_LIGHTING) DecodeFromGBuffer(MERGE_NAME(NAME,0), MERGE_NAME(NAME,1), MERGE_NAME(NAME,2), BSDF_DATA, BAKE_DIFFUSE_LIGHTING) |
|||
|
|||
#if SHADEROPTIONS_VELOCITY_IN_GBUFFER |
|||
#define OUTPUT_GBUFFER_VELOCITY(NAME) ,out float4 NAME : SV_Target3 |
|||
#endif |
|||
|
|||
#elif GBUFFERMATERIAL_COUNT == 4 |
|||
|
|||
#define OUTPUT_GBUFFER(NAME) \ |
|||
out GBufferType0 MERGE_NAME(NAME, 0) : SV_Target0, \ |
|||
out GBufferType1 MERGE_NAME(NAME, 1) : SV_Target1, \ |
|||
out GBufferType2 MERGE_NAME(NAME, 2) : SV_Target2, \ |
|||
out GBufferType3 MERGE_NAME(NAME, 3) : SV_Target3 |
|||
|
|||
#define DECLARE_GBUFFER_TEXTURE(NAME) \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 0)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 1)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 2)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 3)); |
|||
|
|||
#define FETCH_GBUFFER(NAME, TEX, unCoord2) \ |
|||
GBufferType0 MERGE_NAME(NAME, 0) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 0), unCoord2); \ |
|||
GBufferType1 MERGE_NAME(NAME, 1) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 1), unCoord2); \ |
|||
GBufferType2 MERGE_NAME(NAME, 2) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 2), unCoord2); \ |
|||
GBufferType3 MERGE_NAME(NAME, 3) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 3), unCoord2); |
|||
|
|||
#define ENCODE_INTO_GBUFFER(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, NAME) EncodeIntoGBuffer(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3)) |
|||
#define DECODE_FROM_GBUFFER(NAME, BSDF_DATA, BAKE_DIFFUSE_LIGHTING) DecodeFromGBuffer(MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3), BSDF_DATA, BAKE_DIFFUSE_LIGHTING) |
|||
|
|||
#if SHADEROPTIONS_VELOCITY_IN_GBUFFER |
|||
#define OUTPUT_GBUFFER_VELOCITY(NAME) ,out float4 NAME : SV_Target4 |
|||
#endif |
|||
|
|||
#elif GBUFFERMATERIAL_COUNT == 5 |
|||
|
|||
#define OUTPUT_GBUFFER(NAME) \ |
|||
out GBufferType0 MERGE_NAME(NAME, 0) : SV_Target0, \ |
|||
out GBufferType1 MERGE_NAME(NAME, 1) : SV_Target1, \ |
|||
out GBufferType2 MERGE_NAME(NAME, 2) : SV_Target2, \ |
|||
out GBufferType3 MERGE_NAME(NAME, 3) : SV_Target3, \ |
|||
out GBufferType4 MERGE_NAME(NAME, 4) : SV_Target4 |
|||
|
|||
#define DECLARE_GBUFFER_TEXTURE(NAME) \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 0)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 1)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 2)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 3)); \ |
|||
TEXTURE2D(MERGE_NAME(NAME, 4)); |
|||
|
|||
#define FETCH_GBUFFER(NAME, TEX, unCoord2) \ |
|||
GBufferType0 MERGE_NAME(NAME, 0) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 0), unCoord2); \ |
|||
GBufferType1 MERGE_NAME(NAME, 1) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 1), unCoord2); \ |
|||
GBufferType2 MERGE_NAME(NAME, 2) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 2), unCoord2); \ |
|||
GBufferType3 MERGE_NAME(NAME, 3) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 3), unCoord2); \ |
|||
GBufferType4 MERGE_NAME(NAME, 4) = LOAD_TEXTURE2D(MERGE_NAME(TEX, 4), unCoord2); |
|||
|
|||
#define ENCODE_INTO_GBUFFER(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, NAME) EncodeIntoGBuffer(SURFACE_DATA, BAKE_DIFFUSE_LIGHTING, MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3), MERGE_NAME(NAME, 4)) |
|||
#define DECODE_FROM_GBUFFER(NAME, BSDF_DATA, BAKE_DIFFUSE_LIGHTING) DecodeFromGBuffer(MERGE_NAME(NAME, 0), MERGE_NAME(NAME, 1), MERGE_NAME(NAME, 2), MERGE_NAME(NAME, 3), MERGE_NAME(NAME, 4), BSDF_DATA, BAKE_DIFFUSE_LIGHTING) |
|||
|
|||
#if SHADEROPTIONS_VELOCITY_IN_GBUFFER |
|||
#define OUTPUT_GBUFFER_VELOCITY(NAME) ,out float4 NAME : SV_Target5 |
|||
#endif |
|||
|
|||
#endif |
|||
|
|||
#if SHADEROPTIONS_VELOCITY_IN_GBUFFER |
|||
#define ENCODE_VELOCITY_INTO_GBUFFER(VELOCITY, NAME) EncodeVelocity(VELOCITY, NAME) |
|||
#else |
|||
#define OUTPUT_GBUFFER_VELOCITY(NAME) |
|||
#define ENCODE_VELOCITY_INTO_GBUFFER(VELOCITY, NAME) |
|||
#endif |
|||
|
|||
#endif // #ifdef GBUFFERMATERIAL_COUNT |
|||
|
|||
#endif // UNITY_MATERIAL_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 2c2d7b256f4650943b60cc4ef1c7aeaa |
|||
timeCreated: 1483548875 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 839dd86bae5fa4d46bf4facd02608862 |
|||
timeCreated: 1483546512 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: efe43be6d4923e441a2d4b20b3783b7f |
|||
folderAsset: yes |
|||
timeCreated: 1474540060 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue