浏览代码

Correct and rename UNITY_SPECCUBE_LOD_STEPS

/main
Evgenii Golubev 8 年前
当前提交
6fed15cc
共有 3 个文件被更改,包括 6 次插入11 次删除
  1. 6
      Assets/ScriptableRenderLoop/ShaderLibrary/API/D3D11.hlsl
  2. 9
      Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl
  3. 2
      Assets/ScriptableRenderLoop/fptl/ReflectionTemplate.hlsl

6
Assets/ScriptableRenderLoop/ShaderLibrary/API/D3D11.hlsl


#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))
// TODO: We need to change this hard limit!
#ifndef UNITY_SPECCUBE_LOD_STEPS
#define UNITY_SPECCUBE_LOD_STEPS 6
#ifndef UNITY_SPECCUBE_MAX_LOD
#define UNITY_SPECCUBE_MAX_LOD 5
#endif
#define CBUFFER_START(name) cbuffer name {

#define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index))
#define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod)
#define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3)
#define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, min(lod, UNITY_SPECCUBE_LOD_STEPS))
#define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, min(lod, UNITY_SPECCUBE_MAX_LOD))
#define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index))
#define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod)
#define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3)

9
Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl


// Util image based lighting
//-----------------------------------------------------------------------------
// TODO: We need to change this hard limit!
#ifndef UNITY_SPECCUBE_LOD_STEPS
#define UNITY_SPECCUBE_LOD_STEPS 6
#endif
float perceptualRoughnessToMipmapLevel(float perceptualRoughness)
{
// TODO: Clean a bit this code

perceptualRoughness = perceptualRoughness * (1.7 - 0.7 * perceptualRoughness);
#endif
return perceptualRoughness * UNITY_SPECCUBE_LOD_STEPS;
return perceptualRoughness * UNITY_SPECCUBE_MAX_LOD;
return mipmapLevel / UNITY_SPECCUBE_LOD_STEPS;
return saturate(mipmapLevel / UNITY_SPECCUBE_MAX_LOD);
}
//-----------------------------------------------------------------------------

2
Assets/ScriptableRenderLoop/fptl/ReflectionTemplate.hlsl


half mip = perceptualRoughness * UNITY_SPECCUBE_LOD_STEPS;
half mip = perceptualRoughness * UNITY_SPECCUBE_MAX_LOD;
half4 rgbm = UNITY_SAMPLE_ABSTRACT_CUBE_ARRAY_LOD(tex, float4(glossIn.reflUVW.xyz, sliceIndex), mip);
return DecodeHDR(rgbm, hdr);

正在加载...
取消
保存