nicer and faster SSAO

Thanks Martinsh its sweet! But I have another problem which isn’t that big but if you want to hear it: When I go far away I see stripes on objects if I move the stripes are changing. It’s not so important to fix it…

yup, be careful though, this eye candy comes with a price - 65ms for Rasterizer is quite alot :slight_smile:

Yeah I am aware of that, though I have no clue what is really causing it… and it appears only on ATI hardware.

Cool! it works great on my desktop GeForce 9800 GT.

But this is what I get on my laptop GeForce go 7400 » (8400M)
It looks okay close, but when I zoom back it gets ugly, and I have no errors.

This is still really awesome! Thanks Martinsh.

Attachments




The sceenshots look excellent, however I am unable to get the filters working on my iMac with an ATI X1600. I get two errors:
ERROR: 0:64: ‘’ : wrong operand types no operation '’ exists that takes a left-hand operand of type ‘int’ and a right operand of type ‘float’ (or there is no acceptable conversion)
ERROR: 0:64: ‘/’ : wrong operand types no operation ‘/’ exists that takes a left-hand operand of type ‘const float’ and a right operand of type ‘int’ (or there is no acceptable conversion)

This is awesome! I used it on a scene i created some time ago and i think the result is pretty stunning. Had no problems at all with a GTX 275. No noticeable performancedrop.

Without AO:
http://j.imagehost.org/t/0618/noao.jpg

With AO:
http://j.imagehost.org/t/0985/withao.jpg

Martins, really nice job. I loved the result.

I was trying to get a better shadow improving the depth of the spot lamp (increasing the clip start and decreasing the clip end and distance). It however produces weird artifacts in the shadow (not the SSAO one). Any clues on that?

Dalai, it is the shadow map sampling bias. Increase it slightly to reduce those stripes.

Sachiel, that looks awesome, ao really stands out in places with foliage, trees and leaves.

Freethinker, which blend is it?

Awesome work Martinsh :cool:

I THINK I FOUND WORKAROUND FOR THOSE WHO GET SSAO STRIPES
PLEASE TEST
It worked for me so it might not work you.
If it works then it comes at a cost, you have to make the camera clip more in front itself.

change the Camera Clip Start
(Camera selected > Buttons window > Editing > Camera panel > Clipping start/end: > Start)
to a higher value, then the depth buffer will be more accurate for those with stripes like me, I don´t know why really, a bug perhaps?

And please do tell if it works or not.

The first attached images I put with stripes is the SSAO pass with 0.10 on Clip Start
and the second one with a white picture is the Depth pass with 0.10 on Clip Start
and the third one is the SSAO pass with 3.14 on Clip Start
and the fourth one is the Depth pass with 3.14 on Clip Start

I modified and added a Depth pass to Martinsh blend in the blend link below
http://www.pasteall.org/blend/2446

Press 5 to activate the Depth pass

Could someone with a computer who it already works on post a picture with the Depth pass enabled with the blend file I provided.

Jorge

Attachments





I quick updated Cthames’ mouselook script for 2.5 (alpha2 and later, this will actually work in 2.5 if you truncate and zoom the 3D view to make sure there’s no room outside the camera sight edges (this takes into account the changes in the API and python methods itself (I also divided the speed of the Drot movement so the mouse is easier to control)



######################################################
#
#    MouseLook.py        Blender 2.46
#
#    Tutorial for using MouseLook.py can be found at
#
#    www.tutorialsforblender3D.com
#                                                                                                         
######################################################

# import Rasterizer
import Rasterizer

# get controller
controller = GameLogic.getCurrentController()

# get the object this script is attached to
player = controller.owner

# Get sensor named Mouse
mouse = controller.sensors["Mouse"]
   
# Get the actuators
lookLeftRight = controller.actuators["LookLeftRight"]
lookUpDown = controller.actuators["LookUpDown"]

# get width and height of game window
width = Rasterizer.getWindowWidth()
height = Rasterizer.getWindowHeight()

# define mouse movement function
def mouseMove():
    
    # distance moved from screen center       
    x = width/2 - mouse.position[0]
    y = height/2 - mouse.position[1]       
    # intialize mouse so it doesn't jerk first time
    if not 'mouseInit' in player:
        x = 0
        y = 0
        # bug in Add Property
        # can't use True.  Have to use 1
        player['mouseInit'] = 1
       
    # return mouse movement
    return (x, y)

# get mouse movement from function
move = mouseMove()

# set mouse sensitivity
sensitivity = 0.0005


# Amount, direction and sensitivity
leftRight = move[0] * sensitivity
upDown = move[1] * sensitivity

# Smooth movement
player['oldLeftRight'] = (player['oldLeftRight']*0.5 + leftRight*0.5)
player['oldUpDown'] = (player['oldUpDown']*0.5 + upDown*0.5)

upDown = player['oldUpDown']
leftRight = player['oldLeftRight']

# set the values
lookLeftRight.dRot = (0.0,0.0,leftRight/3)
lookLeftRight.useLocalDRot = False   
lookUpDown.dRot = (upDown/3,0.0,0.0)
lookUpDown.useLocalDRot = False
    

# Use them
controller.activate(lookLeftRight)
controller.activate(lookUpDown)

# Center mouse in game window
Rasterizer.mousePosition=(width/2, height/2) 



This is for people who are trying to get the demo’s mouselook working in 2.5.

I got the errors in the revised ATI version you posted (http://www.pasteall.org/blend/2444) in both Blender 2.49 and Blender 2.5 [28103].

Works Jorgie thanks, I just needed to change the clip

wow, best script EVER!!!

That card must love this shader, the rasterizer time barely increased at all. Add 20ms onto my rasterizer time.

I think i fixed most of the issues on ATI GPU`s.
i also synched camera clip distance to the near/far distance in the shader. See if that makes any difference.

download:
ssao_ati.blend (351 KB)
or
http://www.pasteall.org/blend/2457

i will retry last file but previous file reduced my game’s framerate to 40 fps from 60 (im using ati radeon hd 4670)

It looks good, but now the framerate dropped drastically, it’s even slower than the ssgi demo you showed sometime ago 0_o

Thanks,
I fixed the speed problem!

http://www.pasteall.org/blend/2460
or
ssao_ati.blend (351 KB)

Just remember, not only martinsh, but me and arkano22 should all be credited for this work.

It is still very slow Martinsh, but I managed to isolate the source of the lag, it seems it’s the luminance:
vec3 luminance = texture2D(bgl_LuminanceTexture,texCoord).rgb;
For some reason it makes everything veeeery slow.
Taking it out made everything go as fast as the first demo you showed, but sadly it doesn’t lighten the light areas on the AO anymore, oh well, at least I got a better looking realtime AO =D

Hey martinsh, today you saved me, i had to finish a work for a client and he want the job done before 17 PM, And i got no time to make the ao maps, i had 10 to bake each one take for me about 45 minutes to render.
Then The ssao filter that you gently share with us made the job!
Thanks man!