post processing

Everything about development and the OpenMW source code.
Post Reply
nicoo
Posts: 6
Joined: 30 Jun 2018, 20:00

post processing

Post by nicoo » 18 Jul 2018, 02:44

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!

User avatar
AnyOldName3
Posts: 1140
Joined: 26 Nov 2015, 03:25

Re: post processing

Post by AnyOldName3 » 18 Jul 2018, 11:46

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.
AnyOldName3, Master of Shadows

nicoo
Posts: 6
Joined: 30 Jun 2018, 20:00

Re: post processing

Post by nicoo » 19 Jul 2018, 03:30

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 ?

raven
Posts: 65
Joined: 26 May 2016, 09:54

Re: post processing

Post by raven » 19 Jul 2018, 08:45

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

User avatar
drummyfish
Posts: 154
Joined: 22 Oct 2017, 10:13
Github profile: https://gitlab.com/drummyfish
Contact:

Re: post processing

Post by drummyfish » 20 Jul 2018, 03:11

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 :)

User avatar
AnyOldName3
Posts: 1140
Joined: 26 Nov 2015, 03:25

Re: post processing

Post by AnyOldName3 » 20 Jul 2018, 12:33

The console command is showscenegraph
AnyOldName3, Master of Shadows

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests