Page 1 of 1

post processing

Posted: 18 Jul 2018, 02:44
by nicoo
Hi,
after this discussion: viewtopic.php?f=2&t=5260

I'm trying to add some post processing effect. For now I try to fill the window with a white shader. you can take a look to my work: https://gitlab.com/njager/openmw/commit ... 122672ac9d

it's not working, I don't know why. If someone who knows OSG could give me a kick, I would appreciate that!

Re: post processing

Posted: 18 Jul 2018, 11:46
by AnyOldName3
There's no geometry being drawn with that shader. Usually, post-processing is done by drawing a screen-sized square with the post-processing shader with the previous render target available as a texture.

Re: post processing

Posted: 19 Jul 2018, 03:30
by nicoo
thx,
I did some modification to apply the shader on some `rootNode` (Define at line 21 of postprocessing.hpp)

https://gitlab.com/njager/openmw/commit ... 0ac2a94e06

I used this website, http://shdr.bkcore.com/, to check my white shader but I'm not able to make it work in openmw. I don't understand why...
so, as quick test, I applied the water shader on `rootNode`. The effect is dirty but at least something happen. If you want to test it, start the game, then pause it. For now I'm using the pause to turn on the effect (no way to turn it off though).

my white shader is still in the code but commented.

I don't know what kind of root node I should pass to my function, it seems I can pass node, geometry, light... A post process effect should affect everything rendered, so what root node should I target ?

Re: post processing

Posted: 19 Jul 2018, 08:45
by raven
I am not an OSG user, so take this with a grain of salt.

As mentioned you need to create a quad. Attach it to your post processing camera. Then attach the camera to omw root node.

You will also need main camera render outputs as inputs for you post processing pass.

Have a look here (Rendering a scene to texture):
https://merlin.fit.vutbr.cz/wiki/index. ... ledge_base

A quick web search also produced this OpenSceneGraph NodeKit. It looks somewhat over engineered, but might get the job done:
https://github.com/cgart/osgPPU

Re: post processing

Posted: 20 Jul 2018, 03:11
by drummyfish
I'm in a hurry, can't read this carefully, but here's how I draw a textured fullscreen quad in OpenMW (to a screenshot):

https://gitlab.com/OpenMW/openmw/blob/m ... r.cpp#L813
A post process effect should affect everything rendered, so what root node should I target ?
It shouldn't affect GUI. If I remember correctly, RootNode is the root of everything, SceneRoot is the root of the rendered scene, so maybe that one. Here I have a little debugging helper which you can use to print the scene graph to get oriented in the nodes:

https://gitlab.com/drummyfish/osgdebug

There's also some console command you can use directly in OpenMW to do something similar.

When I have more time I'll get back to this thread :)

Re: post processing

Posted: 20 Jul 2018, 12:33
by AnyOldName3
The console command is showscenegraph