浏览代码

add support for lighting tab ibl

add support for lighting tab ibl
/main
mmikk 8 年前
当前提交
0266cd69
共有 2 个文件被更改,包括 27 次插入0 次删除
  1. 6
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
  2. 21
      Assets/ScriptableRenderLoop/fptl/ReflectionTemplate.hlsl

6
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


cmd.SetGlobalTexture("_pointCookieTextures", m_CubeCookieTexArray.GetTexCache());
cmd.SetGlobalTexture("_reflCubeTextures", m_CubeReflTexArray.GetTexCache());
var topCube = ReflectionProbe.GetDefaultCubemapIbl();
var defdecode = ReflectionProbe.CalculateHDRDecodeValuesForDefaultTexture();
cmd.SetGlobalTexture("_reflRootCubeTexture", topCube);
cmd.SetGlobalFloat("_reflRootHdrDecodeMult", defdecode.x);
cmd.SetGlobalFloat("_reflRootHdrDecodeExp", defdecode.y);
if (enableClustered)
{
cmd.SetGlobalFloat("g_fClustScale", m_ClustScale);

21
Assets/ScriptableRenderLoop/fptl/ReflectionTemplate.hlsl


UNITY_DECLARE_TEXCUBEARRAY(_reflCubeTextures);
UNITY_DECLARE_TEXCUBE(_reflRootCubeTexture);
//uniform int _reflRootSliceIndex;
uniform float _reflRootHdrDecodeMult;
uniform float _reflRootHdrDecodeExp;
half3 Unity_GlossyEnvironment (UNITY_ARGS_TEXCUBEARRAY(tex), int sliceIndex, half4 hdr, Unity_GlossyEnvironmentData glossIn);

light.dir = 0;
float3 ints = 0;
// root ibl begin
{
Unity_GlossyEnvironmentData g;
g.roughness = percRoughness;
g.reflUVW = worldNormalRefl;
half3 env0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE(_reflRootCubeTexture), float4(_reflRootHdrDecodeMult, _reflRootHdrDecodeExp, 0.0, 0.0), g);
//half3 env0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBEARRAY(_reflCubeTextures), _reflRootSliceIndex, float4(_reflRootHdrDecodeMult, _reflRootHdrDecodeExp, 0.0, 0.0), g);
UnityIndirect ind;
ind.diffuse = 0;
ind.specular = env0;// * data.occlusion;
ints = EvalIndirectSpecular(light, ind);
}
// root ibl end
uint l=0;
// don't need the outer loop since the probes are sorted by volume type (currently one type in fact)

正在加载...
取消
保存