浏览代码

Merge branch 'master' into metal

/main
Antti Tapaninen 8 年前
当前提交
2df09bda
共有 7 个文件被更改,包括 42 次插入16 次删除
  1. 16
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/scrbound.compute
  2. 4
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/ComputeGgxIblSampleData.compute
  3. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/GGXConvolve.shader
  4. 11
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/RuntimeFilterIBL.cs
  5. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
  6. 7
      Assets/ScriptableRenderPipeline/ShaderLibrary/ImageBasedLighting.hlsl
  7. 16
      Assets/ScriptableRenderPipeline/fptl/scrbound.compute

16
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/scrbound.compute


return mul(plane, InvProjection);
}
float4 EvalPlanePair(float2 posXY_in, float r)
float4 EvalPlanePair(out bool validPlanes, float2 posXY_in, float r)
{
// rotate by 90 degrees to avoid potential division by zero
bool bMustFlip = abs(posXY_in.y)<abs(posXY_in.x);

float D = posXY.y * sqrt(fLenSQ - r*r);
float diffSq = fLenSQ - r*r;
float D = posXY.y * sqrt(max(0.0, diffSq));
float4 res;
res.x = (-r*posXY.x - D) / fLenSQ;

// rotate back by 90 degrees
res = bMustFlip ? float4(res.y, -res.x, res.w, -res.z) : res;
validPlanes = diffSq>0.0;
float4 planeX = EvalPlanePair(float2(pos_view_space.x, pos_view_space.z), r);
float4 planeY = EvalPlanePair(float2(pos_view_space.y, pos_view_space.z), r);
bool validX, validY;
float4 planeX = EvalPlanePair(validX, float2(pos_view_space.x, pos_view_space.z), r);
float4 planeY = EvalPlanePair(validY, float2(pos_view_space.y, pos_view_space.z), r);
#if USE_LEFTHAND_CAMERASPACE

bIsMinValid = bool2(planeX.z<0, planeY.z<0);
bIsMaxValid = bool2((-planeX.x)<0, (-planeY.x)<0);
bIsMinValid = bool2(planeX.z<0, planeY.z<0) && bool2(validX,validY);
bIsMaxValid = bool2((-planeX.x)<0, (-planeY.x)<0) && bool2(validX,validY);
// hopefully the compiler takes zeros into account
// should be the case since the transformation in TransformPlaneToPostSpace()

4
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/ComputeGgxIblSampleData.compute


#include "../../../ShaderLibrary/Common.hlsl"
#include "../../../ShaderLibrary/ImageBasedLighting.hlsl"
#ifdef SHADER_API_MOBILE
#define MAX_IBL_SAMPLE_CNT 34
#else
#endif
RWTexture2D<float4> output; // [MAX_SAMPLE_CNT x UNITY_SPECCUBE_LOD_STEPS]

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/GGXConvolve.shader


TEXTURECUBE(_MainTex);
SAMPLERCUBE(sampler_MainTex);
TEXTURE2D(_GgxIblSamples);
TEXTURE2D_FLOAT(_GgxIblSamples);
#ifdef USE_MIS
TEXTURE2D(_MarginalRowDensities);

11
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/RuntimeFilterIBL.cs


public class IBLFilterGGX
{
RenderTexture m_GgxIblSampleData = null;
const int k_GgxIblMaxSampleCount = 89; // Width
int k_GgxIblMaxSampleCount = TextureCache.isMobileBuildTarget ? 34 : 89; // Width
const int k_GgxIblMipCountMinusOne = 6; // Height (UNITY_SPECCUBE_LOD_STEPS)
ComputeShader m_ComputeGgxIblSampleDataCS = null;

Material m_GgxConvolveMaterial = null; // Convolves a cubemap with GGX
bool m_SupportMIS = !TextureCache.isMobileBuildTarget;
public bool SupportMIS
{
get { return m_SupportMIS; }
}
public void Initialize(ScriptableRenderContext context)
{
if (!m_ComputeGgxIblSampleDataCS)

}
if (!m_BuildProbabilityTablesCS)
if (!m_BuildProbabilityTablesCS && SupportMIS)
{
m_BuildProbabilityTablesCS = Resources.Load<ComputeShader>("BuildProbabilityTables");
m_ConditionalDensitiesKernel = m_BuildProbabilityTablesCS.FindKernel("ComputeConditionalDensities");

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs


renderContext.ExecuteCommandBuffer(cmd);
cmd.Dispose();
if (m_useMIS)
if (m_useMIS && m_iblFilterGgx.SupportMIS)
{
m_iblFilterGgx.FilterCubemapMIS(renderContext, input, target, mipCount, m_SkyboxConditionalCdfRT, m_SkyboxMarginalRowCdfRT, m_CubemapFaceMesh);
}

7
Assets/ScriptableRenderPipeline/ShaderLibrary/ImageBasedLighting.hlsl


{
case 1: sampleCount = 21; break;
case 2: sampleCount = 34; break;
#ifdef SHADER_API_MOBILE
case 3: sampleCount = 34; break;
case 4: sampleCount = 34; break;
case 5: sampleCount = 34; break;
case 6: sampleCount = 34; break; // UNITY_SPECCUBE_LOD_STEPS
#else
#endif
}
return sampleCount;

16
Assets/ScriptableRenderPipeline/fptl/scrbound.compute


return mul(plane, InvProjection);
}
float4 EvalPlanePair(float2 posXY_in, float r)
float4 EvalPlanePair(out bool validPlanes, float2 posXY_in, float r)
{
// rotate by 90 degrees to avoid potential division by zero
bool bMustFlip = abs(posXY_in.y)<abs(posXY_in.x);

float D = posXY.y * sqrt(fLenSQ - r*r);
float diffSq = fLenSQ - r*r;
float D = posXY.y * sqrt(max(0.0, diffSq));
float4 res;
res.x = (-r*posXY.x - D) / fLenSQ;

// rotate back by 90 degrees
res = bMustFlip ? float4(res.y, -res.x, res.w, -res.z) : res;
validPlanes = diffSq>0.0;
float4 planeX = EvalPlanePair(float2(pos_view_space.x, pos_view_space.z), r);
float4 planeY = EvalPlanePair(float2(pos_view_space.y, pos_view_space.z), r);
bool validX, validY;
float4 planeX = EvalPlanePair(validX, float2(pos_view_space.x, pos_view_space.z), r);
float4 planeY = EvalPlanePair(validY, float2(pos_view_space.y, pos_view_space.z), r);
#if USE_LEFTHAND_CAMERASPACE

bIsMinValid = bool2(planeX.z<0, planeY.z<0);
bIsMaxValid = bool2((-planeX.x)<0, (-planeY.x)<0);
bIsMinValid = bool2(planeX.z<0, planeY.z<0) && bool2(validX,validY);
bIsMaxValid = bool2((-planeX.x)<0, (-planeY.x)<0) && bool2(validX,validY);
// hopefully the compiler takes zeros into account
// should be the case since the transformation in TransformPlaneToPostSpace()

正在加载...
取消
保存