EffectCompositor

Everything about development and the OpenMW source code.
Post Reply
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

EffectCompositor

Post by scrawl »

This is an idea for a feature that I never got to. Basically, someone made an awesome OSG library called EffectCompositor that allows one to write postprocessing effects in a text file.

The simplest way to use it would be to allow users to activate/deactivate effects that they drop into their OpenMW folder via a settings file. Once that's working, we could think about things like:

- Allow modders to use effects in specific cells, maybe by having an object use an effect file as a model. The effect will (de)activate when the model (un)loads.
- Allow scripts to modify effect parameters.
- Figure out how to share a render target between effects, for things like SSAO and other depth-based effects.
- Add some engine hooks that will allow one to create deferred shading systems as an effect file.

Any other ideas?
Last edited by scrawl on 19 Jul 2017, 23:00, edited 1 time in total.
User avatar
halbe
Posts: 65
Joined: 14 Feb 2017, 03:55

Re: EffectCompositor

Post by halbe »

Could they be built into omwaddons and configurable in the CS? It'd be really nice to preview them there too!
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: EffectCompositor

Post by scrawl »

Ok, I just tried it out. The code seems salvagable, but it needs some more work.

Test branch: https://github.com/scrawl/openmw/tree/effectcompositor

Sample effects can be downloaded from the original repository at osgRecipes. Many of them didn't work for me (either a shader compile error, or just failed silently), but I'm sure they can be fixed (or maybe they'll just work for you). 'nightvision', 'colorgrading' and 'motionblur' were working, at least. Note you have to remove the line

Code: Select all

<clear_color>0 0 0 1</clear_color>
from most effects or else it will mess with the color of OpenMW's skybox.

Currently, the code only supports loading from the filesystem, not our 'virtual filesystem', so the effect files can't be placed in MW data directories or BSA archives. Instead, you have to put them in OpenMW's 'resources' folder. Then, you have to add to your settings.cfg:

Code: Select all

[Effects]
# Comma-separated list of full-screen effect files. Effects are applied in this order.
# Files must be placed in the OpenMW resources folder and are case-sensitive.
effects = motionblur.xml
# Effect to analyze (show debug information on screen). Must be an effect from the above list.
analyze = motionblur.xml
I really like their analysis (or debugging) view that shows you the different render targets and a visualization of the inputs/outputs. That should be really handy when writing new effects.

Image

The main issue I have is that there doesn't seem to be a way to chain different effects together. I tried to place another effect node as a child of the first effect node and then the scene under the second effect, but that didn't work (only the second effect showed).

Also, I'm pretty sure the code that updates uniforms has a threading bug, that could cause the uniforms to run a frame ahead sometimes, but that's not really a pressing issue right now.
User avatar
silentthief
Posts: 456
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: EffectCompositor

Post by silentthief »

This is kinda cool. The screenshot looks like the player has taken too much skooma (in a similar idea to when you play fable, and drink too much, and the environment becomes blurry).

ST
User avatar
lysol
Posts: 1513
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: EffectCompositor

Post by lysol »

silentthief wrote: 25 Jul 2017, 20:28 This is kinda cool. The screenshot looks like the player has taken too much skooma (in a similar idea to when you play fable, and drink too much, and the environment becomes blurry).

ST
Agreed. I can see lots of uses for this. Thanks for trying this out scrawl!
kuyondo
Posts: 243
Joined: 29 Mar 2016, 17:45

Re: EffectCompositor

Post by kuyondo »

up
Post Reply