浏览代码

HDRenderLoop: use a envLightSky structure to feed sky information

/main
sebastienlagarde 8 年前
当前提交
1bf1067a
共有 4 个文件被更改,包括 19 次插入15 次删除
  1. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset.meta
  2. 27
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightUtilities.hlsl
  3. 1
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePass.hlsl
  4. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePassLoop.hlsl

2
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset.meta


fileFormatVersion: 2
guid: 2400b74f5ce370c4481e5dc417d03703
timeCreated: 1480265826
timeCreated: 1480436907
licenseType: Pro
NativeFormatImporter:
userData:

27
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightUtilities.hlsl


#ifndef UNITY_LIGHT_UTILITIES_INCLUDED
#define UNITY_LIGHT_UTILITIES_INCLUDED
#include "LightDefinition.cs.hlsl"
void InitSkyEnvLightData(int index)
EnvLightData InitSkyEnvLightData(int envIndex)
_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;
EnvLightData output;
output.envShapeType = ENVSHAPETYPE_SKY;
output.envIndex = envIndex;
output.forward = float3(0.0, 0.0, 1.0);
output.up = float3(0.0, 1.0, 0.0);
output.right = float3(1.0, 0.0, 0.0);
output.positionWS = float3(0.0, 0.0, 0.0);
output.offsetLS = float3(0.0, 0.0, 0.0);
output.innerDistance = float3(0.0, 0.0, 0.0);
output.blendDistance = 1.0;
return output;
#endif // UNITY_LIGHT_UTILITIES_INCLUDED
#endif // UNITY_LIGHT_UTILITIES_INCLUDED

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


uint _PunctualLightCount;
uint _AreaLightCount;
uint _EnvLightCount;
EnvLightData _EnvLightSky;
float4 _ShadowMapSize;
float4 _DirShadowSplitSpheres[4]; // TODO share this max between C# and hlsl
CBUFFER_END

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


float3 localDiffuseLighting, localSpecularLighting;
float2 weight;
context.sampleReflection = SINGLE_PASS_CONTEXT_SAMPLE_SKY;
InitSkyEnvLightData(0);
EvaluateBSDF_Env(context, V, positionWS, prelightData, _EnvLightSky, bsdfData, localDiffuseLighting, localSpecularLighting, weight);
EnvLightData envLightSky = 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);
}

正在加载...
取消
保存