Legacy Viewport Ambient Occlusion as Filter2D in game

Hello all, i managed to port the 3d viewport Ambient Occlusion fx from Blender 2.79 to work on the game engine.

It is single pass as the original and does not require python setup nor attachments as i moved all the setup C code to glsl. It should look identical when we press P but i still notice some difference, If you know how to improve it let me know.

Though it should, it doesn’t work on blender 2.79, only in Range and Upbge 2.x. If you find out why also let me know.

BF_AmbientOcclusion.blend (716.7 KB)
BF_AmbientOcclusion.range (720.5 KB)

2 Likes

Hi I have tested but isn’t working in Linux I have distro Ubuntu 23.04 in Windows version Range Engine is working.


Different video card vendor? Any message in the console? Thank you for your feedback.

Test Windows 10.

Intel(R) Core™ i5-10310U CPU @ 1.70GHz 2.21 GHz
Intel(R) UHD Graphics

GPUShader: compile error:
ERROR: 4:43: ‘(’ : syntax error syntax error

Test Ubuntu 23.04

Intel® Core™ i5-7360U × 4
Intel® Iris® Plus Graphics 640 (Kaby Lake GT3e) (KBL GT3)

GPUShader: compile error:
0:42(20): error: syntax error, unexpected ‘(’, expecting ‘,’ or ‘;’

Test Ubuntu 23.04

AMD Ryzen™ 5 5600G with Radeon™ Graphics × 12
AMD Radeon™ RX 6600

GPUShader: compile error:
0:42(20): error: syntax error, unexpected ‘(’, expecting ‘,’ or ‘;’

1 Like

It doesn’t work on BGE because gl_ProjectionMatrix is set to the identity matrix when the filters are applied.
I see the difference you mention, it’s like some self occlusion, but the same code doesn’t produce that in BGE. A while back I also ported this ambient occlusion as a filter, never shared it though.
It works for me on Range in Linux Mint.

2 Likes

Thank you sir, i would take a while to figure it out. The extra occlusion is still bothering me, maybe some difference in the view vectors. I will try to fix this week. This is a long wanted thing here.

1 Like