浏览代码

Add InitSkyEnvLightData() function

/main
Evgenii Golubev 8 年前
当前提交
1d409736
共有 2 个文件被更改,包括 15 次插入13 次删除
  1. 14
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePass.hlsl
  2. 14
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePassLoop.hlsl

14
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePass.hlsl


int sampleReflection;
};
// The EnvLightData of the sky light contains a bunch of compile-time constants.
// This function sets them directly to allow the compiler to propagate them and optimize the code.
void InitSkyEnvLightData(int index) {
_EnvLightSky.envShapeType = ENVSHAPETYPE_SKY;
_EnvLightSky.envIndex = index;
_EnvLightSky.forward = float3(0.0, 0.0, 1.0);
_EnvLightSky.up = float3(0.0, 1.0, 0.0);
_EnvLightSky.right = float3(1.0, 0.0, 0.0);
_EnvLightSky.positionWS = float3(0.0, 0.0, 0.0);
_EnvLightSky.offsetLS = float3(0.0, 0.0, 0.0);
_EnvLightSky.innerDistance = float3(0.0, 0.0, 0.0);
_EnvLightSky.blendDistance = 1.0;
}
//-----------------------------------------------------------------------------
// Shadow sampling function
// ----------------------------------------------------------------------------

14
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePassLoop.hlsl


float3 localDiffuseLighting, localSpecularLighting;
float2 weight;
context.sampleReflection = SINGLE_PASS_CONTEXT_SAMPLE_SKY;
// The EnvLightData of the sky light contains a bunch of compile-time constants.
// We set them here directly to allow the compiler to propagate them and optimize the code.
_EnvLightSky.envShapeType = ENVSHAPETYPE_SKY;
_EnvLightSky.envIndex = 0;
_EnvLightSky.forward = float3(0.0, 0.0, 1.0);
_EnvLightSky.up = float3(0.0, 1.0, 0.0);
_EnvLightSky.right = float3(1.0, 0.0, 0.0);
_EnvLightSky.positionWS = float3(0.0, 0.0, 0.0);
_EnvLightSky.offsetLS = float3(0.0, 0.0, 0.0);
_EnvLightSky.innerDistance = float3(0.0, 0.0, 0.0);
_EnvLightSky.blendDistance = 1.0;
InitSkyEnvLightData(0);
EvaluateBSDF_Env(context, V, positionWS, prelightData, _EnvLightSky, bsdfData, localDiffuseLighting, localSpecularLighting, weight);
iblDiffuseLighting = lerp(iblDiffuseLighting, localDiffuseLighting, weight.x); // Should be remove by the compiler if it is smart as all is constant 0
iblSpecularLighting = lerp(iblSpecularLighting, localSpecularLighting, weight.y);

正在加载...
取消
保存