Evgenii Golubev
7 年前
当前提交
824c6f37
共有 11 个文件被更改,包括 217 次插入 和 11 次删除
-
46Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
47Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/HomogeneousFog.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/HDRenderPipelineResources.asset
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/RenderPipelineResources.cs
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics.meta
-
38Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/HomogeneousFog.cs.hlsl
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/HomogeneousFog.cs.hlsl.meta
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources.meta
-
53Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute
-
10Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 1fe4fc72895e4bb4f90ff44b47e76051 |
|||
folderAsset: yes |
|||
timeCreated: 1503411233 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// |
|||
// This file was automatically generated from Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/HomogeneousFog.cs. Please don't edit by hand. |
|||
// |
|||
|
|||
#ifndef HOMOGENEOUSFOG_CS_HLSL |
|||
#define HOMOGENEOUSFOG_CS_HLSL |
|||
// Generated from UnityEngine.Experimental.Rendering.HDPipeline.VolumeProperties |
|||
// PackingRules = Exact |
|||
struct VolumeProperties |
|||
{ |
|||
float3 scattering; |
|||
float anisotropy; |
|||
float3 extinction; |
|||
float unused; |
|||
}; |
|||
|
|||
// |
|||
// Accessors for UnityEngine.Experimental.Rendering.HDPipeline.VolumeProperties |
|||
// |
|||
float3 GetScattering(VolumeProperties value) |
|||
{ |
|||
return value.scattering; |
|||
} |
|||
float GetAnisotropy(VolumeProperties value) |
|||
{ |
|||
return value.anisotropy; |
|||
} |
|||
float3 GetExtinction(VolumeProperties value) |
|||
{ |
|||
return value.extinction; |
|||
} |
|||
float GetUnused(VolumeProperties value) |
|||
{ |
|||
return value.unused; |
|||
} |
|||
|
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: af39a96c040c8ec4da47ed13c6455ffe |
|||
timeCreated: 1503567986 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 333b470add5766f44a744f476efc19a8 |
|||
folderAsset: yes |
|||
timeCreated: 1503591964 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Definitions |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
// #pragma enable_d3d11_debug_symbols |
|||
|
|||
#define GROUP_SIZE_1D 16 |
|||
#define GROUP_SIZE_2D (GROUP_SIZE_1D * GROUP_SIZE_1D) |
|||
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Included headers |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
#include "../HomogeneousFog.cs.hlsl" |
|||
#include "../../../../Core/ShaderLibrary/Common.hlsl" |
|||
#include "../../../../Core/ShaderLibrary/SpaceFillingCurves.hlsl" |
|||
#include "../../../ShaderVariables.hlsl" |
|||
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Inputs & outputs |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
TEXTURE2D(_DepthTexture); // Z-buffer |
|||
RW_TEXTURE2D(float4, _LightingTexture); // Updated texture |
|||
|
|||
// Unity does not support structures inside constant buffers, |
|||
// so we are forced to use a structured buffer instead. |
|||
StructuredBuffer<VolumeProperties> _UnboundedVolume; |
|||
|
|||
//-------------------------------------------------------------------------------------------------- |
|||
// Implementation |
|||
//-------------------------------------------------------------------------------------------------- |
|||
|
|||
#pragma kernel VolumetricLighting |
|||
|
|||
[numthreads(GROUP_SIZE_2D, 1, 1)] |
|||
void VolumetricLighting(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; |
|||
|
|||
// In-place UAV updates do not work on Intel GPUs. |
|||
_LightingTexture[pixelCoord] += float4(0.25, 0.25, 0.25, 0); |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 799166e2ee6a4b041bba9e74f6942097 |
|||
timeCreated: 1503570390 |
|||
licenseType: Pro |
|||
ComputeShaderImporter: |
|||
externalObjects: {} |
|||
currentAPIMask: 4 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue