浏览代码

Improve MIS texture parameter naming

/main
Evgenii Golubev 8 年前
当前提交
26726ebe
共有 2 个文件被更改,包括 9 次插入9 次删除
  1. 8
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/GGXConvolve.shader
  2. 10
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs

8
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/GGXConvolve.shader


SAMPLERCUBE(sampler_MainTex);
#ifdef USE_MIS
#define MIS_TEXTURE_HEIGHT 256
#define MIS_TEXTURE_WIDTH 2 * MIS_TEXTURE_HEIGHT
#define TEXTURE_HEIGHT_MIS 256
#define TEXTURE_WIDTH_MIS 2 * TEXTURE_HEIGHT_MIS
TEXTURE2D(_MarginalRowDensities);
TEXTURE2D(_ConditionalDensities);
#endif

V, N,
roughness,
_InvOmegaP,
MIS_TEXTURE_WIDTH,
MIS_TEXTURE_HEIGHT,
TEXTURE_WIDTH_MIS,
TEXTURE_HEIGHT_MIS,
1024,
false);
#else

10
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs


// Configuration parameters for Multiple Importance Sampling.
const bool m_useMIS = false;
const int MIS_TEXTURE_HEIGHT = 256;
const int MIS_TEXTURE_WIDTH = MIS_TEXTURE_HEIGHT * 2;
const int m_TextureHeightMIS = 256;
const int m_TextureWidthMIS = m_TextureHeightMIS * 2;
SkyParameters m_SkyParameters = null;

if (m_useMIS)
{
// + 1 because we store the value of the integral of the cubemap at the end of the texture.
m_SkyboxMarginalRowCdfRT = new RenderTexture(MIS_TEXTURE_HEIGHT + 1, 1, 1, RenderTextureFormat.RFloat);
m_SkyboxMarginalRowCdfRT = new RenderTexture(m_TextureHeightMIS + 1, 1, 1, RenderTextureFormat.RFloat);
m_SkyboxMarginalRowCdfRT.dimension = TextureDimension.Tex2D;
m_SkyboxMarginalRowCdfRT.useMipMap = false;
m_SkyboxMarginalRowCdfRT.autoGenerateMips = false;

// TODO: switch the format to R16 (once it's available) to save some bandwidth.
m_SkyboxConditionalCdfRT = new RenderTexture(MIS_TEXTURE_WIDTH, MIS_TEXTURE_HEIGHT, 1, RenderTextureFormat.RFloat);
m_SkyboxConditionalCdfRT = new RenderTexture(m_TextureWidthMIS, m_TextureHeightMIS, 1, RenderTextureFormat.RFloat);
m_SkyboxConditionalCdfRT.dimension = TextureDimension.Tex2D;
m_SkyboxConditionalCdfRT.useMipMap = false;
m_SkyboxConditionalCdfRT.autoGenerateMips = false;

m_BuildProbabilityTablesCS.SetTexture(m_MarginalRowDensitiesKernel, "marginalRowDensities", m_SkyboxMarginalRowCdfRT);
var cmd = new CommandBuffer() { name = "" };
cmd.DispatchCompute(m_BuildProbabilityTablesCS, m_ConditionalDensitiesKernel, MIS_TEXTURE_HEIGHT, 1, 1);
cmd.DispatchCompute(m_BuildProbabilityTablesCS, m_ConditionalDensitiesKernel, m_TextureHeightMIS, 1, 1);
cmd.DispatchCompute(m_BuildProbabilityTablesCS, m_MarginalRowDensitiesKernel, 1, 1, 1);
renderLoop.ExecuteCommandBuffer(cmd);
cmd.Dispose();

正在加载...
取消
保存