FyroxEngine / Fyrox

3D and 2D game engine written in Rust

Home Page:https://fyrox.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculate frame luminance using histogram for HDR

mrDIMAS opened this issue · comments

Currently, frame luminance is calculated using downsampling with bilinear filtration, that basically calculates average frame luminance. Average luminance works quite bad in HDR, because a single bright pixel could easily ruin the luminance values. It could be done either on CPU or using a compute shader (this must be gated by checking if compute shaders are actually available).

commented

I want to try and take this issue, but I have no idea where frame luminance is calculated in the engine. If you could let me know, I'd be happy to start and try to fix this.

It is in HighDynamicRangeRenderer::calculate_avg_frame_luminance and I already did some basic version of histogram-based luminance calculation, but it requires tweaking and probably contains bugs in its implementation.

commented

I have been unable to figure this one out, which means I've effectively given up on it.