Created
December 17, 2020 09:35
-
-
Save 2youyou2/d2244f33c28e1eb20cff2e302b50c796 to your computer and use it in GitHub Desktop.
unreal 4.25 subsurface shader 流程
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- ShadowProjectionPixelShader.usf/Main (画阴影到 Common.ush/LightAttenuationTexture 中) | |
- SSSTransmission = ManualPCF(ShadowPosition.xy, Settings); (输出到 FadedSSSShadow) | |
- OutColor = EncodeLightAttenuation(half4(FadedShadow, FadedSSSShadow, FadedShadow, FadedSSSShadow)) (最终输出) | |
- BasePassPixelShader.usf/FPixelShaderInOut_MainPS (画基本物体的 pass) | |
- 调用 MaterialTemplate.ush 提供的方法(材质蓝图会根据 MaterialTemplate.ush 填充对应的方法) | |
GetMaterialBaseColor | |
GetMaterialMetallic | |
GetMaterialSpecular | |
GetXXX... | |
- ShadingModelsMaterial.ush/SetGBufferForShadingModel 输出到 DeferredShadingCommon.ush/FGBufferData 结构体中 | |
- DeferredLightPixelShaders.usf/DeferredLightPixelMain | |
- DeferredShadingCommon.ush/GetScreenSpaceData (获取 GBuffer) | |
- GetGBufferData { | |
float4 GBufferA = FramebufferFetchMRT(1); | |
float4 GBufferB = FramebufferFetchMRT(2); | |
float4 GBufferC = FramebufferFetchMRT(3); | |
float4 GBufferD = FramebufferFetchMRT(4); | |
return DecodeGBufferData(GBufferA, GBufferB, GBufferC, GBufferD, GBufferE, GBufferF, GBufferVelocity, CustomNativeDepth, CustomStencil, SceneDepth, bGetNormalizedNormal, CheckerFromSceneColorUV(UV)); | |
} | |
- GetPerPixelLightAttenuation (获取阴影贴图) | |
- GetDynamicLighting | |
- GetShadowTerms (用阴影贴图获取的数据计算阴影) | |
- ShadingModels.ush/IntegrateBxDF(根据 shading model 调用对应的 BXDF) | |
- SubsurfaceBxDF | |
- OutColor += (Radiance * Attenuation) * OpaqueVisibility; |
r.CompileShadersForDevelopment=0;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
查找最近反射球
FScene::FindClosestReflectionCaptures(FVector Position, const FReflectionCaptureProxy* (&SortedByDistanceOUT)[FPrimitiveSceneInfo::MaxCachedReflectionCaptureProxies])
更新最近反射球
FPrimitiveSceneInfo::CacheReflectionCaptures