- GBufferへの書き込み
MainPS (PixelShaderOutputCommon.usf)
- Indirect Light、Sky Lightの計算
FPixelShaderInOut_MainPS (BasePassPixelShader.usf)
GetPrecomputedIndirectLightingAndSkyLight (BasePassPixelShader.usf)
→ MRT[0]に書き出される
- Sky Lightの計算
GetSkyLighting (BasePassPixelShader.usf)
- Gバッファからシェーディング
DirectionalPixelMain (DeferredLightPixelShaders.usf)
- 動的ライトの計算
GetDynamicLighting (DeferredLightingCommon.usf)
GetPrecomputedIndirectLightingAndSkyLight †
GetDynamicLighting †
記述が無い場合は下記設定でスクリーンショット
- マテリアル
- BaseColor : 1.0, 1.0, 1.0
- Metalic : 0.0
- Roughtness 1.0
- Specular : 0.5
- ライト
- ディフューズライト1灯のみ
- Intencity : 6.0
- Color : 0.0, 1.0, 0.0
基本パラメーター †
- Default Lit
- GBuffer.DiffuseColor
- GBuffer.SpecularColor
- LightColor
SurfaceShading
↓
LightAccumulator_Add
SurfaceLighting †
| float3 SurfaceLighting = SurfaceShading(GBuffer, LobeRoughness, LobeEnergy, L, V, N, Random);
|
- SurfaceShadingの中身
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
| float3 StandardShading( float3 DiffuseColor, float3 SpecularColor, float3 LobeRoughness, float3 LobeEnergy, float3 L, float3 V, half3 N )
{
float3 H = normalize(V + L);
float NoL = saturate( dot(N, L) );
float NoV = saturate( abs( dot(N, V) ) + 1e-5 );
float NoH = saturate( dot(N, H) );
float VoH = saturate( dot(V, H) );
float D = D_GGX( LobeRoughness[1], NoH ) * LobeEnergy[1];
float Vis = Vis_SmithJointApprox( LobeRoughness[1], NoV, NoL );
float3 F = F_Schlick( SpecularColor, VoH );
float3 Diffuse = Diffuse_Lambert( DiffuseColor );
return Diffuse * LobeEnergy[2] + (D * Vis) * F;
}
|
- Diffuse * LobeEnergy[2] = x
* =
- (D * Vis) * F = y
( * ) * =
- x + y = return
+ =
- Diffuse * LobeEnergy[2] = x
* =
- (D * Vis) * F = y
( * ) * =
- x + y = return
+ =
- 調整してみるとSurface Lightingにスペキュラが入っている
ライトカラーとの合成 †
| LightAccumulator_Add(LightAccumulator, SurfaceLighting, (1.0/PI), LightColor * (NoL * SurfaceAttenuation), bNeedsSeparateSubsurfaceLightAccumulation);
|
- (NoL * SurfaceAttenuation) =
* =
- LightColor * (NoL * SurfaceAttenuation) = x
* =
- SurfaceLighting * x =
* =
- Roughness = 0.0の時
- SurfaceLighting * x =
* =
|