浏览代码
Merge pull request #1220 from Unity-Technologies/Factor-PreIntegratedFGD
Merge pull request #1220 from Unity-Technologies/Factor-PreIntegratedFGD
Factor PreIntegratedFGD/main
GitHub
7 年前
当前提交
517c5afd
共有 12 个文件被更改,包括 150 次插入 和 50 次删除
-
35ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LTCAreaLight/LTCAreaLight.cs
-
26ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.cs
-
3ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
-
8ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD.meta
-
90ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.cs.meta
-
1ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.hlsl
-
9ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.hlsl.meta
-
8ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/Resources.meta
-
9ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Resources.meta
-
0/ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/Resources
|
|||
fileFormatVersion: 2 |
|||
guid: d67850515da2e0844bf387a58fa11fac |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
// Currently PreIntegratedFGD only have GGX, if we add another case convert it to a textureArray (like LTCArea)
|
|||
public partial class PreIntegratedFGD |
|||
{ |
|||
static PreIntegratedFGD s_Instance; |
|||
|
|||
public static PreIntegratedFGD instance |
|||
{ |
|||
get |
|||
{ |
|||
if (s_Instance == null) |
|||
s_Instance = new PreIntegratedFGD(); |
|||
|
|||
return s_Instance; |
|||
} |
|||
} |
|||
|
|||
bool m_isInit; |
|||
int m_refCounting; |
|||
|
|||
// For image based lighting
|
|||
Material m_InitPreFGD; |
|||
RenderTexture m_PreIntegratedFGD; |
|||
|
|||
PreIntegratedFGD() |
|||
{ |
|||
m_isInit = false; |
|||
m_refCounting = 0; |
|||
} |
|||
|
|||
public void Build() |
|||
{ |
|||
Debug.Assert(m_refCounting >= 0); |
|||
|
|||
if (m_refCounting == 0) |
|||
{ |
|||
m_InitPreFGD = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/PreIntegratedFGD"); |
|||
|
|||
m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGB2101010, RenderTextureReadWrite.Linear); |
|||
m_PreIntegratedFGD.hideFlags = HideFlags.HideAndDontSave; |
|||
m_PreIntegratedFGD.filterMode = FilterMode.Bilinear; |
|||
m_PreIntegratedFGD.wrapMode = TextureWrapMode.Clamp; |
|||
m_PreIntegratedFGD.hideFlags = HideFlags.DontSave; |
|||
m_PreIntegratedFGD.name = CoreUtils.GetRenderTargetAutoName(128, 128, RenderTextureFormat.ARGB2101010, "PreIntegratedFGD"); |
|||
m_PreIntegratedFGD.Create(); |
|||
|
|||
m_isInit = false; |
|||
} |
|||
|
|||
m_refCounting++; |
|||
} |
|||
|
|||
public void RenderInit(CommandBuffer cmd) |
|||
{ |
|||
if (m_isInit) |
|||
return; |
|||
|
|||
using (new ProfilingSample(cmd, "Init PreFGD")) |
|||
{ |
|||
CoreUtils.DrawFullScreen(cmd, m_InitPreFGD, new RenderTargetIdentifier(m_PreIntegratedFGD)); |
|||
} |
|||
|
|||
m_isInit = true; |
|||
} |
|||
|
|||
public void Cleanup() |
|||
{ |
|||
m_refCounting--; |
|||
|
|||
if (m_refCounting == 0) |
|||
{ |
|||
CoreUtils.Destroy(m_InitPreFGD); |
|||
CoreUtils.Destroy(m_PreIntegratedFGD); |
|||
|
|||
m_isInit = false; |
|||
} |
|||
|
|||
Debug.Assert(m_refCounting >= 0); |
|||
} |
|||
|
|||
public void Bind() |
|||
{ |
|||
Shader.SetGlobalTexture("_PreIntegratedFGD", m_PreIntegratedFGD); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: bde7a84037546c741864e766e9a7f8d7 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
TEXTURE2D(_PreIntegratedFGD); |
|
|||
fileFormatVersion: 2 |
|||
guid: 4ca702b62d480a040a08b750920b6b55 |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ce581725fe970e14abbd599942a16779 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0c490c1afeb26224c910524c2a5f08c6 |
|||
folderAsset: yes |
|||
timeCreated: 1479130495 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue