浏览代码

use texLod for texcture lookup

/main
Filip Iliescu 7 年前
当前提交
3b67314b
共有 2 个文件被更改,包括 9 次插入7 次删除
  1. 12
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/ClassicDeferredPipeline.cs
  2. 4
      Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardForwardMobile.cginc

12
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/ClassicDeferredPipeline.cs


//eyePlane.SetNormalAndPosition(viewDirNormalized, camera.transform.position);
int probeCount = cull.visibleReflectionProbes.Length;
int finalProbeCount = probeCount;
int idx = 0;
for (int i = 0; i < probeCount; ++i) {
var rl = cull.visibleReflectionProbes [i];

if (cubemap == null)
if (cubemap == null) {
Debug.Log ("empty cubemap texture");
finalProbeCount--;
}
var lgtData = new SFiniteLightData();
lgtData.flags = 0;

lgtData.lightType = (uint)LightDefinitions.BOX_LIGHT;
lgtData.lightModel = (uint)LightDefinitions.REFLECTION_LIGHT;
lightData [i] = lgtData;
lightData [idx++] = lgtData;
}
s_LightDataBuffer.SetData(lightData);

cmd.SetGlobalVectorArray("gLightPos", m_LightPositions);
cmd.SetGlobalMatrixArray("gLightMatrix", m_LightMatrix);
cmd.SetGlobalMatrixArray("gWorldToLightMatrix", m_WorldToLightMatrix);
cmd.SetGlobalVector("gLightData", new Vector4(totalLightCount, probeCount, 0, 0));
cmd.SetGlobalVector("gLightData", new Vector4(totalLightCount, finalProbeCount, 0, 0));
cmd.SetGlobalTexture("_spotCookieTextures", m_CookieTexArray.GetTexCache());
//cmd.SetGlobalTexture("_pointCookieTextures", m_CubeCookieTexArray.GetTexCache());

4
Assets/ScriptableRenderPipeline/MobileRenderPipeline/ClassicDeferred/UnityStandardForwardMobile.cginc


half3 env0 = Unity_GlossyEnvironment(UNITY_PASS_ABSTRACT_CUBE_ARRAY(_reflCubeTextures), lgtDat.sliceIndex, float4(lgtDat.lightIntensity, lgtDat.decodeExp, 0.0, 0.0), g);
UnityIndirect ind;
ind.diffuse = 0;
ind.specular = env0;// * data.occlusion;

half falloff = saturate(1.0 - length(distance)/blendDistance);
ints = lerp(ints, rgb, falloff);
}
return ints;

// distance atten
float att = dot(toLight, toLight) * gLightPos[lightIndex].w;
float atten = tex2D (_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL;
float atten = tex2Dlod (_LightTextureB0, float4(att.rr, 0.0, 0.0)).UNITY_ATTEN_CHANNEL;
// For debug: spot attenuation -- programatic no cookie
//const float fProjVec = -dot(vL, gLightDirection[lightIndex].xyz); // spotDir = lgtDat.lightAxisZ.xyz

正在加载...
取消
保存