Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rendering] Lens flare phase1 #66

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
98f0e66
generate repeating blobs mirroring bright spots
fall2019 May 28, 2023
2db950a
use lower resolution for ghost generation
fall2019 Jun 3, 2023
7353185
change default value
fall2019 Jun 3, 2023
5f385b9
adjust halo
fall2019 Jun 3, 2023
e8c96dd
add component
fall2019 Jun 3, 2023
7ee8982
fix compile
fall2019 Jun 3, 2023
994b27a
improve writing
fall2019 Jun 5, 2023
d17ea1d
fix compile
fall2019 Jun 5, 2023
a6b2182
fix wrongly return
fall2019 Jun 5, 2023
c22d8f9
using weighted sum to calc lum
fall2019 Jun 5, 2023
ee9f78b
fix halo visibility
fall2019 Jun 17, 2023
0f8bf0c
using average white texture
fall2019 Jun 18, 2023
49b702e
remove gpu -> cpu sync
fall2019 Jun 19, 2023
8fd56c5
fix halo
fall2019 Jun 22, 2023
fe53b89
update default setting for ghost num
fall2019 Jun 22, 2023
45686b8
change gauss option
fall2019 Jun 22, 2023
9c7d5b5
Merge branch 'master' into lensFlare
MomoDeve Jun 23, 2023
b89bfb4
remove constants
fall2019 Jun 23, 2023
5be53b2
Merge branch 'lensFlare' of https://github.com/asc-community/MxEngine…
fall2019 Jun 23, 2023
b7451ab
update average white no matter tone mapping is enabled.
fall2019 Jun 23, 2023
35ae993
revert swap interval
fall2019 Jun 30, 2023
58facab
move average white
fall2019 Jun 30, 2023
d591b6d
decompose eye adaptation and average white
fall2019 Jun 30, 2023
11a5a32
merge origin/master
MomoDeve Jul 30, 2023
e995adc
pull master
fall2019 Mar 22, 2024
0f4500e
temp
fall2019 Mar 25, 2024
a7d2ef9
wide range of lum
fall2019 Mar 25, 2024
f44e2ed
Merge remote-tracking branch 'origin/master' into lensFlare
MomoDeve Mar 28, 2024
7daf66e
beautify + remove unused
MomoDeve Mar 28, 2024
bcc1013
intensity of flare
MomoDeve Mar 28, 2024
cca33ba
revert uMipLevel deletion
MomoDeve Mar 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/Core/Rendering/RenderController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,16 @@ namespace MxEngine
TextureHandle RenderController::ComputeAverageWhite(CameraUnit& camera)
{
MAKE_SCOPE_PROFILER("RenderController::ComputeAverageWhite()");
MX_ASSERT(camera.ToneMapping != nullptr);
camera.HDRTexture->GenerateMipmaps();

float dt = this->Pipeline.Environment.TimeDelta;
float fadingAdaptationSpeed = 1.0f - std::exp(-camera.ToneMapping->GetEyeAdaptationSpeed() * dt);
float adaptationThreshold = camera.ToneMapping->GetEyeAdaptationThreshold();

float fadingAdaptationSpeed = 0.0f;
float adaptationThreshold = 0.0f;
if (camera.ToneMapping != nullptr)
{
fadingAdaptationSpeed = 1.0f - std::exp(-camera.ToneMapping->GetEyeAdaptationSpeed() * dt);
fall2019 marked this conversation as resolved.
Show resolved Hide resolved
adaptationThreshold = camera.ToneMapping->GetEyeAdaptationThreshold();
}
auto& shader = this->Pipeline.Environment.Shaders["AverageWhite"_id];
auto& output = this->Pipeline.Environment.AverageWhiteTexture;
shader->Bind();
Expand Down Expand Up @@ -763,8 +766,6 @@ namespace MxEngine
{
if (camera.LensFlare == nullptr)
return;
if (camera.ToneMapping == nullptr)//lens flare requires tone mapping
return;

MAKE_SCOPE_PROFILER("RenderController::ApplyLensFlare()");

Expand Down Expand Up @@ -825,11 +826,12 @@ namespace MxEngine

void RenderController::ApplyHDRToLDRConversion(CameraUnit& camera, TextureHandle& input, TextureHandle& output)
{
auto& HDRToLDRShader = this->Pipeline.Environment.Shaders["HDRToLDR"_id];
auto averageWhite = this->ComputeAverageWhite(camera);
fall2019 marked this conversation as resolved.
Show resolved Hide resolved

if (camera.ToneMapping == nullptr) return;
MAKE_SCOPE_PROFILER("RenderController::ApplyHDRToLDRConversion()");

auto& HDRToLDRShader = this->Pipeline.Environment.Shaders["HDRToLDR"_id];
auto averageWhite = this->ComputeAverageWhite(camera);
auto aces = camera.ToneMapping->GetACESCoefficients();

HDRToLDRShader->Bind();
Expand Down