浏览代码

enable gi in fwd shader (already enabled in deferred)

enable gi in fwd shader (already enabled in deferred)
/main
mmikk 8 年前
当前提交
542eb324
共有 1 个文件被更改,包括 13 次插入11 次删除
  1. 24
      Assets/ScriptableRenderLoop/fptl/UnityStandardForwardNew.cginc

24
Assets/ScriptableRenderLoop/fptl/UnityStandardForwardNew.cginc


#include "LightingUtils.hlsl"
static FragmentCommonData gdata;
static float occlusion;
half4 fragNoLight(VertexOutputForwardNew i) : SV_Target
{

float3 EvalIndirectSpecular(UnityLight light, UnityIndirect ind)
{
float occlusion = 1.0; // have none for now
return occlusion * UNITY_BRDF_PBS(gdata.diffColor, gdata.specColor, gdata.oneMinusReflectivity, gdata.smoothness, gdata.normalWorld, -gdata.eyeVec, light, ind);
}

uint2 pixCoord = ((uint2) i.pos.xy);
//float atten = 0.0;
//half occlusion = Occlusion(i.tex.xy);
//UnityGI gi = FragmentGI (gdata, occlusion, i.ambientOrLightmapUV, atten, mainLight);
float atten = 1.0;
occlusion = Occlusion(i.tex.xy);
UnityGI gi = FragmentGI (gdata, occlusion, i.ambientOrLightmapUV, atten, DummyLight(), false);
// direct light contributions
res += ExecuteReflectionList(numReflectionsProcessed, pixCoord, vP, gdata.normalWorld, Vworld, gdata.smoothness);
// don't really have a handle on this yet
//UnityLight mainLight = MainLight ();
//res += UNITY_BRDF_GI (gdata.diffColor, gdata.specColor, gdata.oneMinusReflectivity, gdata.smoothness, gdata.normalWorld, -gdata.eyeVec, occlusion, gi);
res += Emission(i.tex.xy);
// specular GI
res += ExecuteReflectionList(numReflectionsProcessed, pixCoord, vP, gdata.normalWorld, Vworld, gdata.smoothness);
// diffuse GI
res += UNITY_BRDF_PBS (gdata.diffColor, gdata.specColor, gdata.oneMinusReflectivity, gdata.smoothness, gdata.normalWorld, -gdata.eyeVec, gi.light, gi.indirect).xyz;
res += UNITY_BRDF_GI (gdata.diffColor, gdata.specColor, gdata.oneMinusReflectivity, gdata.smoothness, gdata.normalWorld, -gdata.eyeVec, occlusion, gi);
//res = OverlayHeatMap(numLightsProcessed, res);
//UNITY_APPLY_FOG(i.fogCoord, res);

正在加载...
取消
保存