大气相关的光照(正确性不能确保)

在大气的渲染中,涉及到类

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);

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章