在大气的渲染中,涉及到类
class FAtmosphericFogSceneInfo : public FRenderResource
{
};
它的光照相关成员函数是
/** Prepare the sun light data as a function of current atmospheric fog state. */
void PrepareSunLightProxy(FLightSceneInfo& SunLight) const;
调用该函数的是延迟渲染类
void FDeferredShadingSceneRenderer::Render(FRHICommandListImmediate& RHICmdList)
{
。。。。。。
if (ShouldRenderSkyAtmosphere(Scene, ViewFamily.EngineShowFlags))
{
for (int32 LightIndex = 0; LightIndex < NUM_ATMOSPHERE_LIGHTS; ++LightIndex)
{
if (Scene->AtmosphereLights[LightIndex])
{
PrepareSunLightProxy(*Scene->GetSkyAtmosphereSceneInfo(),LightIndex, *Scene->AtmosphereLights[LightIndex]);
}
}
}
else if (Scene->AtmosphereLights[0] && Scene->HasAtmosphericFog())
{
// Only one atmospheric light at one time.
Scene->GetAtmosphericFogSceneInfo()->PrepareSunLightProxy(*Scene->AtmosphereLights[0]);
}
.......
}
PrepareSunLightProxy()这块相对比较复杂, 借鉴了寒霜引擎的物理渲染,大概意思是大气系统的几个因素,太阳位置影响了实时光照,天气状况影响到云的变化。并涉及到了大气散射,时间的变化也影响到了实时天空。
看看什么时候用到这个延迟渲染,在FSceneRenderer::CreateSceneRenderer()中,
在往上走依次是FRendererModule::BeginRenderingViewFamily(FCanvas* Canvas, FSceneViewFamily* ViewFamily);
FEditorViewportClient::Draw(FViewport* InViewport, FCanvas* Canvas);
本文深入探讨了在游戏引擎中实现大气渲染的技术细节,重点介绍了类classFAtmosphericFogSceneInfo的作用及其光照相关成员函数PrepareSunLightProxy()的使用场景。该函数通过模拟太阳位置、天气变化和大气散射效果,实现真实感光照和天空效果。
9084

被折叠的 条评论
为什么被折叠?



