Page 2 of 2

Re: Fog shader?

Posted: 15 Mar 2019, 09:40
by darkbasic
visvaldas wrote:
14 Mar 2019, 23:05
In fact - yes ;)
You just made my day :)

Re: Fog shader?

Posted: 15 Mar 2019, 14:22
by 1Mac
Huh, how about that! That’s great news.

Re: Fog shader?

Posted: 15 Mar 2019, 15:53
by visvaldas
OK, I'm running into problems.
For testing purposes I've set

Code: Select all

gl_FragData[0].xyz = vec3(0.5);
in terrain_fragment.glsl.
screenshot000.png
screenshot000.png (581.56 KiB) Viewed 1910 times
The far terrain looks as expected, but the near terrain is off.
It appears as if for the near terrain, the output of the fragment shader gets added to the framebuffer.

Does anybody know what's going on here?

Re: Fog shader?

Posted: 15 Mar 2019, 16:05
by wareya
Terrain texture blending adds terrain textures (multiplied by their blend alpha) onto a pitch black base layer now, instead of alpha blending them over a base dirt texture. Aside from that, I have no idea. The black layer may be rendering through the terrain fragment shader.

Re: Fog shader?

Posted: 15 Mar 2019, 16:22
by visvaldas
Hmm, I guess that means I need to multiply the fog color by the blend alpha.
I will try that.

Re: Fog shader?

Posted: 15 Mar 2019, 16:23
by wareya
I think that happens automatically, since you only set x y and z. The issue is probably the underlying black layer.

Re: Fog shader?

Posted: 15 Mar 2019, 17:23
by visvaldas
Alright - problem solved!
If I multiply the fog amount with 1-gl_Fog.scale everything looks as intended.

Edit: I'm not sure though if that's the proper way to do it.
It would be best if some precprocessor define was set to indicate that no fog should be added, as in the case of the black base layer.

Re: Fog shader?

Posted: 18 Mar 2019, 20:34
by visvaldas
Newest version: https://gitlab.com/vrresto/openmw/tree/my-fog-shader
Note: shadows don't work yet.

Re: Fog shader?

Posted: 23 May 2019, 13:29
by Esqu1sito
Hi, could someone direct me to how to use shaders like this?

Re: Fog shader?

Posted: 23 May 2019, 17:14
by AnyOldName3
Basically, you'll need to build OpenMW yourself (by following this guide http://wiki.openmw.org/index.php?title= ... ment_Setup) having checked out the branch linked above. The guide should be more-or-less idiot-proof, but it's still potentially too daunting for most people to bother with.