Bake probes on the GPU without downloading them to system memory
Only apply probes after a full pass has completed Stop baking after 5 iterations
This commit is contained in:
parent
50183606d2
commit
7f77dc3d70
10 changed files with 393 additions and 164 deletions
|
|
@ -336,7 +336,7 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
state.firstFrame = screen->FrameTime - 1;
|
||||
}
|
||||
|
||||
LightProbeIncrementalBuilder lightProbeBuilder(DFrameBuffer::irrandiaceMapTexelCount, DFrameBuffer::prefilterMapTexelCount, DFrameBuffer::irradianceMapChannelCount, DFrameBuffer::prefilterMapChannelCount);
|
||||
LightProbeIncrementalBuilder lightProbeBuilder;
|
||||
|
||||
sector_t* RenderView(player_t* player)
|
||||
{
|
||||
|
|
@ -413,30 +413,22 @@ sector_t* RenderView(player_t* player)
|
|||
AActor* lightprobe = level.GetThinkerIterator<AActor>(NAME_LightProbe, STAT_INFO).Next();
|
||||
if (lightprobe)
|
||||
{
|
||||
auto renderEnvMap = [&](const LightProbe& probe, TArrayView<uint16_t>& irradianceMap, TArrayView<uint16_t>& prefilteredMap) {
|
||||
auto renderEnvMap = [&](int probeIndex, const LightProbe& probe) {
|
||||
lightprobe->SetOrigin(DVector3(probe.position), false); // crime against nature
|
||||
|
||||
// The renderer interpolates camera in its own mechanism that has to be disabled when moving around the single probe
|
||||
bool noInterpolate = r_NoInterpolate;
|
||||
r_NoInterpolate = true;
|
||||
|
||||
screen->RenderEnvironmentMap([&](IntRect& bounds, int side) {
|
||||
screen->RenderLightProbe(probeIndex, [&](IntRect& bounds, int side) {
|
||||
FRenderViewpoint probevp;
|
||||
RenderViewpoint(probevp, lightprobe, &bounds, 90.0, 1.0f, 1.0f, false, false, side);
|
||||
}, irradianceMap, prefilteredMap);
|
||||
});
|
||||
|
||||
r_NoInterpolate = noInterpolate;
|
||||
};
|
||||
|
||||
auto renderEnvScreen = [&](const TArray<uint16_t>& irradianceMaps, const TArray<uint16_t>& prefilteredMaps) {
|
||||
screen->UploadEnvironmentMaps(level.lightProbes.size(), irradianceMaps, prefilteredMaps);
|
||||
};
|
||||
|
||||
lightProbeBuilder.Step(
|
||||
level.lightProbes,
|
||||
renderEnvMap,
|
||||
renderEnvScreen
|
||||
);
|
||||
lightProbeBuilder.Step(level.lightProbes, renderEnvMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue