-
Notifications
You must be signed in to change notification settings - Fork 30
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
RGB histogram widget with texture upload for post shader #155
Comments
just to get familiar I did a little digging and reading... would this be part of the buffershader frag(s)? or an auxbuffershader frag? |
I imagine histogram generation happening between accumulation and buffershader. Buffer shader gets the histogram data as an additional input. Might be tricksy to do histogram of HDR buffer. Not sure what current state of art is for histogramming, probably compute shader on GL4 and scatter on GL3. |
..hmmm FragM wants core 4.5 profile on linux, or rather that is what is requested but different setups may cause Qt to decide on something else :-/ maybe the buffershader just needs a revisit ? |
Let's say the final image is 3840x2160 What would be a good size for a "subsample" histogram? 640x360? At the outset my thoughts are that it might be a good thing to enhance single images but could get very very complicated over many images if dynamic adjustments are required. A purpose built image processing suite might be better suited to the task. Just wrote a little doodle for histogram equalization about 75 lines of code, using a smaller image for the initial histogram might make it fast enough to be tolerable on CPU but could easily (I think) be integrated into bufferShaderProgram or a small shader to execute between shaderProgram and bufferShaderProgram? There's lots of room in bufferShaderProgram for more GLSL. |
the above runs the image through this code (smoother now) before displaying it from HiresRender->Preview Image at around line 1830 in MainWindow.cpp
needs proper weighting, crude, just something to play with, include source...
|
I found this to be a fascinating read on the subject... https://www.graphics.cornell.edu/pubs/2004/Mol04.pdf |
the fastest most efficient? https://www.uni-koblenz.de/~cg/ws0809/Seminar_GPUProgrammierung/Material/09_Algorithms_Histograms/GPUHistogram_Kubias2007.pdf |
Ok, based on GPUHistogram Kubias 2007 the raytracer.frag can be modified to put a lum value in the depth buffer as described in the paper. that's half of it, now just need to render with occlusion query n bin times while increasing z pos from 0 to 1 in 1/n increments... at least that's what I understand from the paper. not an easy task as FragM is already rendering to a quad so the occlusion query plane will have to be moved between Eye pos = 0 and render-plane pos = 1 or the slice-plane will be occluded by the render-plane? not sure how to tackle this... gonna sleep on it ;) |
oh! just like the spline shader! post accumulation, the depth buffer will be full of LUM values, so before buffershader executes run the occlusion queries, then hand the histo data to the buffershader? need to create a vbo for the quad, disable depth buffer write and enable depth buffer test. |
Is your feature request related to a problem? Please describe.
Optimizing exposure etc would be easier with a colour histogram.
Describe the solution you'd like
Dockable widget with image RGB Linear/Log histograms a la GIMP, Darktable, etc. Button to capture histogram from buffer (if OpenGL 4 is supported this could be in a compute shader, otherwise read back to CPU). Mode to automatically update after each subframe.
Further, option to automatically upload the histogram (perhaps also rearranged to be able to look up R,G,B values from percentiles) as a texture1d (or two) for the buffer shader to do algorithmic post colouring with (eg, auto levels, equalize, white balance, etc).
Automatic update to be disabled in tiled rendering, unless 2-pass rendering is possible (accumulate all tiles, then buffer shader all tiles with histogram accumulated from all the tiles) - probably simpler to use histogram snapshot from a smaller preview image?
Describe alternatives you've considered
Export as EXR and do post in other software. Breaks flow, and not all post software supports writing post algorithms as GLSL code.
The text was updated successfully, but these errors were encountered: