Some terminology, I'll refer to a "pass" as a single filter on an image (like blur), and a "technique" as combination of passes (like blur + AO). Every technique has some rendering state like render targets, bound texture samplers, custom uniforms, etc.
The blockers for postprocessing are only these two issues:
- https://gitlab.com/OpenMW/openmw/-/issues/6078 : associated MR !889, needs final review and merge
- https://gitlab.com/OpenMW/openmw/-/issues/6199 : finished, will open MR once 6078 is resolved
- Auto-hotreload and overlay. When writing shaders hotreload is an absolute necessity, so is being able to automatically reload the postprocess chain when a file is changed. There are some lightweight cross-platform file watching libraries out there, but initially I think a polling of last modification time will be more then sufficient. The numbers of shader files to watch is directly proportional to the number of techniques in use, and even a high number for this will likely never exceed 10. Adding such functionality to the VFS should not be too intrusive. The overlay I'd like to implement will include per-technique settings and debug options. In my testing branch I put together a 5-second working POC which looks something like this . Of course the final product will look professional and polished, certainly more flexible, this is just to give everyone a concrete image of what I'm talking about.
- Compute shader path. The traditional method for postprocessing includes binding vertex and fragment shaders and drawing to a fullscreen geometry. On more modern cards, we can actually utilize compute shaders which can be made extremely efficient for image filtering. Compute shaders barely resemble pixel shaders, and creating an abstraction between them would be a silly endeavor. I plan on allowing for both use of traditional pixel shaders and compute shaders, the latter having a much higher bar for entry.
- Technique files. All shaders utilize the VFS, technique files will be suffixed with "*.fx" and must be placed in a directory named "shaders".
Technique files themselves will be slightly modified GLSL to allow multiple passes and definition of metadata. I've not decided on best way to approach this part yet, so I'll leave it for a later post. My initial attempts I've thrown out as they were pretty clunky and utilized the @defines used in the standard forward passes. One thing I know for sure, XML is not going to happen...ever. To define a shader chain it simply will be written in the settings.cfg as a list of technique files. Adding an in-game configuration will come naturally as I'm designing things with this kind of adaptability in mind.Code: Select all
[Postprocessing] enabled = true chain = hdao, dof, godrays
I shared these a while ago on discord, but just to clarify this is a real thing and not a 2090 thing here are some samples of some over-the-top AO using my testing branch.
https://imgsli.com/NTMxNDY
https://imgsli.com/NTMxNDc
https://imgsli.com/NTMxNDg