- GBufferへの書き込み
MainPS (PixelShaderOutputCommon.usf)
FPixelShaderInOut_MainPS (BasePassPixelShader.usf)
- Indirect Light、Sky Lightの計算
GetPrecomputedIndirectLightingAndSkyLight (BasePassPixelShader.usf)
- Sky Lightの計算
GetSkyLighting (BasePassPixelShader.usf)
- Gバッファからシェーディング
DirectionalPixelMain (DeferredLightPixelShaders.usf)
- 動的ライトの計算
GetDynamicLighting (DeferredLightingCommon.usf)
- 動的影付け
Main (ShadowProjectionPixelShader.usf)
Shadow変数が影の強さ。0.0 - 影
→FadedShadow変数フェード付き
→OutColor変数に最終出力。
OutColor.r値のみ参照されているっぽい。
MODULATED_SHADOWSがForward(mobile)時のみ使える?
Engine\Source\Runtime\Renderer\Private\ShadowRendering.cpp
GetPrecomputedIndirectLightingAndSkyLight †
GBufferのMRT[0]に書き出される
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
* = ![Rendering-SurfaceLighting-Diffuse-x-LobeEnegy[2].png Rendering-SurfaceLighting-Diffuse-x-LobeEnegy[2].png](https://com04.sakura.ne.jp:443/unreal/wiki/index.php?plugin=ref&page=%A5%A8%A5%F3%A5%B8%A5%F3%B2%FE%C2%A4-%A5%E9%A5%A4%A5%C6%A5%A3%A5%F3%A5%B0%B2%F2%C0%CF&src=Rendering-SurfaceLighting-Diffuse-x-LobeEnegy%5B2%5D.png)
- (D * Vis) * F = y
( * ) * = 
- x + y = return
+ = 
- Diffuse * LobeEnergy[2] = x
* = .png Rendering-SurfaceLighting-Diffuse-x-LobeEnegy[2](Roughness_0.0).png](https://com04.sakura.ne.jp:443/unreal/wiki/index.php?plugin=ref&page=%A5%A8%A5%F3%A5%B8%A5%F3%B2%FE%C2%A4-%A5%E9%A5%A4%A5%C6%A5%A3%A5%F3%A5%B0%B2%F2%C0%CF&src=Rendering-SurfaceLighting-Diffuse-x-LobeEnegy%5B2%5D%28Roughness_0.0%29.png)
- (D * Vis) * F = y
( * ) * = 
- x + y = return
+ = 
- マテリアルのBaseColorを調整してみるとSurface Lightingにスペキュラが入っているのが確認できる

ライトカラーとの合成 †
| LightAccumulator_Add(LightAccumulator, SurfaceLighting, (1.0/PI), LightColor * (NoL * SurfaceAttenuation), bNeedsSeparateSubsurfaceLightAccumulation);
|
- (NoL * SurfaceAttenuation) =
* = 
- LightColor * (NoL * SurfaceAttenuation) = x
* = 
- SurfaceLighting * x =
* = 
- SurfaceLighting * x =
* = 
|