Jump to content


Photo

Screen space ambient occlusion [3D]


  • Please log in to reply
51 replies to this topic

#1 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 14 February 2015 - 08:08 PM

SSAOBanner.png

 

What is screen space ambient occlusion?

 

Screen space ambient occlusion is a post-process effect which attempts to approximate shadows produced by nearby objects in a scene. A simple example of this would be darkening of crevasses in objects, as well as the illusion of absence of light found between two objects near each other.

In games, this effect aims to improve the visual realism of scenes by increasing visual depth of objects. The shader works in screen-space meaning it is a post process effect which makes use of (hopefully) already existing per-fragment depth and normal data.

 

Get Screen space ambient occlusion shader

 

SSAO shader features:

 

Screen space ambient occlusion is a post-process effect which attempts to approximate shadows produced by nearby objects in a scene. A simple example of this would be darkening of crevasses in objects, as well as the illusion of absence of light found between two objects near each other.

  • Significant improvement to visual quality of 3D scenes
  • Fully customisable with multiple settings that can be adjusted to get exactly the look and feel you want:
       -   Radius
       -   Strength / Power
       -   Samples / Resolution
       -   Range tolerance (Can be used to create a haloing effect for a more cartoon-feel )
  • Uses a HLSL GBuffer to reduce draw calls
  • Post-process effect, so it can be combined with previously used shaders after all rendering has been performed
  • AAA-quality!

SSAO shader trailer

 

This trailer demonstrates the effect with a number of different settings. We recommend watching the trailer at 720p60fps to be able to see the full effect in action!

 

Marketplace and DEMO

You can now purchase the shader on the GM marketplace: Get Screen space ambient occlusion shader

We also have a demo you can try before you buy: Try the SSAO Demo (note the demo uses the texture filtering extension which is not included in the marketplace asset.)

 

Screen shots:

We have provided both the SSAO enabled and SSAO disabled variation of each screenshot so you can see the different the effect makes for each scene:
 
4136_original.jpg?1423903472
4138_original.png?1423903483
4140_original.png?1423903499
 
Disabled:
Spoiler
 

Development and credits

 

The SSAO shader has been in development for a months, in a joint effort between Andrew Hamilton ( Orange451 ) and Michael Parkin-White ( MishMash ). Multiple papers and other online resources have been used in the process, however this implementation is solely our own work.

The level scene was created using our own 3D level editor (Sharp Edge). Assets used include the D3D Teapot, Stanford dragon and Hebe statue. Other assets are from free 3D sources or were licensed assets.
 
 

Troubleshooting

 

If you have any problems with the shader, please feel free to send either of us a message, or leave a response below. We will also be posting common problems (should they exist) in this main topic. The shader also comes with an extensive help file which explains how to implement the shader into your own projects, as well as explanations for the settings you can modify.


Edited by MishMash, 14 February 2015 - 08:27 PM.

  • 13

VitalitySig18thMar.png


#2 slayer 64

slayer 64

    Slayer of gingers

  • GMC Member
  • 4301 posts
  • Version:GM:Studio

Posted 14 February 2015 - 08:25 PM

it's a bit laggy for me. i wonder if your texture filtering dll would help. my guess is that the level geometry is too high. sometimes it runs at 60, but if i get near that dragon or rock wall, it's like 20. you could turn culling on too.
  • 0

5y5rs3d.pngfg0UQNL.png


#3 Venomous

Venomous

    GMC Member

  • GMC Member
  • 1626 posts
  • Version:GM:Studio

Posted 14 February 2015 - 08:34 PM

This looks wonderful. My fps_real was over 1200 the entire time, but I have a decent graphics card.(GTX 780)

It's amazing how much depth some ambient occlusion adds to a scene. Nice work.


  • 1

#4 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 14 February 2015 - 08:45 PM

it's a bit laggy for me. i wonder if your texture filtering dll would help. my guess is that the level geometry is too high. sometimes it runs at 60, but if i get near that dragon or rock wall, it's like 20. you could turn culling on too.

 

Ah, we haven't been able to test on a large range of machines, just wanted to ask though, what are your pc specs, and whether you can run SSAO in other games (Just so we know where we stand)? The default settings we have enabled are quite high in the demo, however lower settings exist which can still look good and can increase the performance by quite a bit.

 

This demo also uses the TF extension already (Updated OP), though other draw optimisations could be made. Just as a note, does turning blur off affect the situation? Trying to work out if it is actually the SSAO that is slowing you down, or just the plain ol' rendering, as the dragon and rock wall have quite densely packed polygons. Blur is sometimes more intense than the actual ssao effect itself, so that can be a good way to gauge performance.

 

I'm sure culling would also help!

 

@Venemous Thank you!


Edited by MishMash, 14 February 2015 - 08:45 PM.

  • 0

VitalitySig18thMar.png


#5 slayer 64

slayer 64

    Slayer of gingers

  • GMC Member
  • 4301 posts
  • Version:GM:Studio

Posted 14 February 2015 - 08:58 PM

when i turn all the bars down, it does get faster. but if i fly in and look at something up close it runs at 25.
  • AMD quad-core 4 GHz
  • RAM 8 GB
  • 64-bit operating system
  • 5.7 windows experience
  • GeForce GT 630

  • 0

5y5rs3d.pngfg0UQNL.png


#6 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 14 February 2015 - 09:04 PM

GeForce GT 630

There's the problem right there.

SSAO is an intensive effect, you need a powerful GPU to run it unfortunately. However, the scene contains quite a bit of geometry which could equally hinder performance.

 

My laptop, which has a GeForce GT 750, can't run the main demo at full speed as well; But that's to be expected from a lower-end unit. We'll release an additional demo with a lower sample-count and lower resolution.


Edited by orange451, 15 February 2015 - 02:10 PM.

  • 0

bC14QqN.pngNrTFeil.png


#7 ThePC007

ThePC007

    Chickenator

  • GMC Member
  • 1062 posts
  • Version:GM:Studio

Posted 14 February 2015 - 09:35 PM

This looks amazing! Unfortunately it doesn't run very well on my HD 3000, but that's to expected on on-board GPUs. Nice work, though.


  • 2

#8 Alvare

Alvare

    Not an administrator

  • GMC Member
  • 1812 posts
  • Version:None

Posted 15 February 2015 - 12:15 AM

Man me too.. but that's because it somehow chooses the laggy onboard. Thanks to Optimus.

Though, my gt 555m graphics card wasn't that great either and things are going so fast with GmStudio these days. I need to get a better pc soon.


  • 0

#9 cookieboy

cookieboy

    Seabass (The Human)

  • GMC Member
  • 747 posts
  • Version:GM:Studio

Posted 15 February 2015 - 03:37 AM

GREAT WORK. Finally quality SSAO. Props to you sir.


  • 0

Vnc5NxB.jpg

Support a fellow GMC member? <3

http://store.steampo...com//app/357650


#10 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 15 February 2015 - 03:53 AM

GREAT WORK. Finally quality SSAO. Props to you sir.

 

Thanks! :)

It's taken us quite awhile to develop this too... We started by attempting hemispherical TBN-based SSAO back in November, but couldn't get it working properly. This one uses a slightly easier technique using just a 2d poisson disk.


  • 1

bC14QqN.pngNrTFeil.png


#11 cookieboy

cookieboy

    Seabass (The Human)

  • GMC Member
  • 747 posts
  • Version:GM:Studio

Posted 15 February 2015 - 06:30 AM

Excellent work indeed. Keep it up. I can say I need this at the moment, but I'll purchase it soon enough. :) Thanks for the contribution fellows!

 

*EDIT*

In response to everyone saying this lagged for them because they have some low end card...

We're game developers people! Upgrade to something decent. You are the leaders of gaming! I'm poor and I made sure to prioritize!

My Build:

AMD FX 8 Core 3.5GHZ

4x2GB DDR3 2133MHZ

EVGA GTX 970 ACX 2.0

1TB HDD, 128GB SSD, 64GB SSD

3x AOC 1920x1080 28" Monitors

2 Keyboards

Internet 100 Down And 5 Up

 

I'm an enthusiast obviously HOWEVER, a GTX 750? The GTX 760 runs 20% better and has much better value for the price. Let's be good examples for the future game developers.


Edited by cookieboy, 15 February 2015 - 06:36 AM.

  • 1

Vnc5NxB.jpg

Support a fellow GMC member? <3

http://store.steampo...com//app/357650


#12 fel666

fel666

    GMC Member

  • GMC Member
  • 1883 posts
  • Version:GM:Studio

Posted 15 February 2015 - 07:36 AM

I wouldn't upgrade to an NVidia card if your tight on money though; the demo ran extremely well on my HD 7850 with max smoothing :)

Really nice shader and demo too! Not working on 3D ATM, but when i do..., felling like GM 3D is not out of reach no more.

Also, i did find another ssao shader by Xygthpo3 on the GMC. Is there a difference?
  • 1

This forum is old and archived, Whatever it is i said up above may no longer reflect my opinion.

GMWolf
GMIterator
RefactorTool
OptimizedDecals

#13 xygthop3

xygthop3

    You may know me from such forums as "Shaders"

  • GMC Member
  • 3367 posts
  • Version:GM:Studio

Posted 15 February 2015 - 07:48 AM

Also, i did find another ssao shader by Xygthpo3 on the GMC. Is there a difference?

 

Yes, a massive difference.

My old shader was an hack attempt of a somewhat SSAO effect. This shader is a much truer representation of what SSAO is meant to look like.

 

Don't waste your time with my old one, you should buy this one instead.


  • 1

#14 fel666

fel666

    GMC Member

  • GMC Member
  • 1883 posts
  • Version:GM:Studio

Posted 15 February 2015 - 08:06 AM

 

Also, i did find another ssao shader by Xygthpo3 on the GMC. Is there a difference?

 

Yes, a massive difference.

My old shader was an hack attempt of a somewhat SSAO effect. This shader is a much truer representation of what SSAO is meant to look like.

 

Don't waste your time with my old one, you should buy this one instead.

 

Yeah, i figured something was weird with your shader: you got shadows around objects that weren't close to other objects.

 

if i even need SSAO, ill get it from here :) (unless i can figure it out without too much trouble, which i doubt i will; i'm terrible with shaders)


  • 0

This forum is old and archived, Whatever it is i said up above may no longer reflect my opinion.

GMWolf
GMIterator
RefactorTool
OptimizedDecals

#15 repesorsa

repesorsa

    GMC Member

  • GMC Member
  • 3097 posts
  • Version:GM:Studio

Posted 15 February 2015 - 08:24 AM

Good work! Too bad I don't need it for anything, but looks awesome :)

Runs great on my GTX 560 Ti

600-1000 fps


  • 0

iy6s.png


#16 djk164

djk164

    GMC Member

  • GMC Member
  • 301 posts
  • Version:GM:Studio

Posted 15 February 2015 - 06:46 PM

how is this any different from: http://gmc.yoyogames...howtopic=595367  ?

(besides the fact that this costs $10, and the other one is free)


Edited by djk164, 15 February 2015 - 06:46 PM.

  • 0

Bye old GMC!


#17 repesorsa

repesorsa

    GMC Member

  • GMC Member
  • 3097 posts
  • Version:GM:Studio

Posted 15 February 2015 - 06:53 PM

how is this any different from: http://gmc.yoyogames...howtopic=595367  ?

(besides the fact that this costs $10, and the other one is free)

 

 

Also, i did find another ssao shader by Xygthpo3 on the GMC. Is there a difference?

 

Yes, a massive difference.

My old shader was an hack attempt of a somewhat SSAO effect. This shader is a much truer representation of what SSAO is meant to look like.

 

Don't waste your time with my old one, you should buy this one instead.

 


  • 1

iy6s.png


#18 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 15 February 2015 - 06:58 PM

Performance Optimisation testing

 

So, a quick little update! Since release we have been looking into ways we can optimise the shader to just run better. One of the biggest causes of performance drop if to do with the way graphics cards cache textures.

When you have a larger radius, or at least you are sampling texture calls which are far away from each other, the performance of the shader drops drastically, weaker cards will hit this threshold much earlier. So, we are going to be introducing a few features to help combat this:

 

- Min-max proportional radius clamping (Radius is dynamically adapted based on depth such that it scales correctly, however upper bound clamping can cause the speed to remain consistent when getting close to objects on weaker machines. (This can also help reduce screen edge bleeding artefacts. This can also help improve overall performance at higher resolutions)

- Blur sample threshold. At the moment, the blur shader performs 4 iterations, each of which requires 3 texture accesses. We are going to be providing a low-blur setting which only requires half the samples, doesn't quite look as good, but it is definitely faster.

 

As a reference, at 1080p resolution, I get the following performance improvements:

at demo settings (NVidia GTx580):

    - 16 SSAO samples

    -  1.0x resolution
    -  4 blur samples (12 texture accesses)

    -  No radius clamping

    = 20.2ms to calculate SSAO effect (Pretty drastic) (i.e 40~ fps )
 

at demo settings (NVidia GTx970):

    - 16 SSAO samples

    -  1.0x resolution
    -  4 blur samples (12 texture accesses)

    -  No radius clamping

    = 2.1 ms to calculate SSAO effect (Pretty drastic) (i.e 475~ real_fps )

 

at optimised profile #1 (Only tested on 580):

     -  8 SSAO samples

     -  1.0x resolution

     -  2 blur samples (6 texture accesses)

     -  No radius clamping

     = 1.8 ms to calculate SSAO effect

 

at optimised profile #2 (Only tested on 580):

     -  8 SSAO samples

     -  0.75x resolution

     -  2 blur samples (6 texture accesses)

     -  No radius clamping

     =  1.6ms

 

at optimised profile #3 (Only tested on 580):

     -  16 SSAO samples

     -  1.0x resolution

     -  4 blur samples (6 texture accesses)

     -  Radius clamping ( 0.01, 0.025 ) - clamps to a relatively small radius, however the quality loss can almost be worth it for the performance gain.

     = 2.6 ms to calculate SSAO effect

 

at optimised profile #4 (Only tested on 580):

     -  8 SSAO samples

     -  1.0x resolution

     -  2 blur samples (6 texture accesses)

     -  Radius clamping ( 0.01, 0.025 ) - clamps to a relatively small radius, however the quality loss can almost be worth it for the performance gain.

     = 1.6 ms to calculate SSAO effect

 

What tends to happen is that cards will reach a point where the whole thing gets too intensive and results in a massive increase in calculation time. I've tested on both a GTx580 and a GTx970. The 970 is much more resilient to high-intensity settings, however it did start to lag when getting close without the range clamp.

 

Now for some comparison pics:

Original (1080p): http://i.imgur.com/DpIuohy.jpg
Optimal profile #1 (1080p): http://i.imgur.com/xEqAmoK.jpg

Optimal profile #2 (1080p): http://i.imgur.com/Dh3rgH6.jpg

Optimal profile #3 (1080p): http://i.imgur.com/CtVitwq.jpg

Optimal profile #4 (1080p): http://i.imgur.com/y8ekeVL.jpg

 

So what I am essentially trying to demonstrate is how performance gains can be made without sacrificing too much quality by just modifying a few settings. Reducing certain settings and imposing limitations in areas can lead to quite a significant increase in performance. The extreme example is profile #3 where only a radius clamp is introduced, and this lead to a performance increase of over 7x due to texture caching optimisations.

 

As Orange said, we will post demo's containing these optimised settings as well :)!


Edited by MishMash, 15 February 2015 - 07:48 PM.

  • 1

VitalitySig18thMar.png


#19 djk164

djk164

    GMC Member

  • GMC Member
  • 301 posts
  • Version:GM:Studio

Posted 15 February 2015 - 07:15 PM

Performance Optimisation testing

Why do you not give AMD some love too?

I get around 2500 FPS on a 7970 Ghz on the demo

 

 

how is this any different from: http://gmc.yoyogames...howtopic=595367  ?

(besides the fact that this costs $10, and the other one is free)

 

 

Also, i did find another ssao shader by Xygthpo3 on the GMC. Is there a difference?

 

Yes, a massive difference.

My old shader was an hack attempt of a somewhat SSAO effect. This shader is a much truer representation of what SSAO is meant to look like.

 

Don't waste your time with my old one, you should buy this one instead.

 

 

Thanks for that. I suppose I should have read the whole thread


  • 0

Bye old GMC!


#20 slayer 64

slayer 64

    Slayer of gingers

  • GMC Member
  • 4301 posts
  • Version:GM:Studio

Posted 15 February 2015 - 07:32 PM

can the demo also adjust settings for the texture filtering? i'd like to play around with that, maybe it would help. i think BILINEAR looks good enough, just to remove aliasing.

what's the resolution for some of the textures?

is the whole level one vertex buffer?
  • 0

5y5rs3d.pngfg0UQNL.png


#21 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 15 February 2015 - 07:44 PM

can the demo also adjust settings for the texture filtering? i'd like to play around with that, maybe it would help. i think BILINEAR looks good enough, just to remove aliasing.

what's the resolution for some of the textures?

is the whole level one vertex buffer?

 

Sure, I can put that option in, and for those questions:

1) The texture resolutions range from 512 to 1024

2) The level is split up into 15 different models, for each of the 15 different textures. Currently they are d3d models, not raw vertex buffers, though we can try converting the models to VBs to see if it makes a difference.

 

The new demo should be up a bit later.

 

 

Why do you not give AMD some love too?

I get around 2500 FPS on a 7970 Ghz on the demo

Nice! ( I would test on AMD, but I don't have any other GPUs lying around :P )


  • 1

VitalitySig18thMar.png


#22 djk164

djk164

    GMC Member

  • GMC Member
  • 301 posts
  • Version:GM:Studio

Posted 15 February 2015 - 07:54 PM

 

 

 

Why do you not give AMD some love too?

I get around 2500 FPS on a 7970 Ghz on the demo

Nice! ( I would test on AMD, but I don't have any other GPUs lying around :P )

 

 

Okay. I could test on a variety of machines. (8120@3.9 with 7770 Ghz,  AlthonX2@2.7Ghz with 550ti, AMD A8 4000 series, and a bunch of laptops with Intel Pentiums)

 

I think when I upgraded my cpu, from a 8120 to a 4690k(4.4Ghz), game maker went a whole lot faster with 3D. 

I do not think game maker favors AMD or Nvidia too much, but it definitely loves a CPU with really good single threaded performance


Edited by djk164, 15 February 2015 - 07:56 PM.

  • 2

Bye old GMC!


#23 Alvare

Alvare

    Not an administrator

  • GMC Member
  • 1812 posts
  • Version:None

Posted 16 February 2015 - 06:53 AM

But aren't all the new "next-gen" cpu's multi-threaded?  :o

I'd like a up to date single threaded cpu too for a change. And I'm definitely done with Nvidia now.


  • 0

#24 fel666

fel666

    GMC Member

  • GMC Member
  • 1883 posts
  • Version:GM:Studio

Posted 16 February 2015 - 07:06 AM

Cpu's are multi threaded, and the s a good thing; you get far better performance that way.

GM runs on a single thread, and that's a bad thing; it is way behind modern tech.m.

Sure, a duo core 4ghz will run GM better than a quad 2ghz, but most newer applications will not work as well (as they are designed to run in more than 1 thread, since CPUs can do that now)

Anyhow, not to change the subject: the demo works great, but to boost performance, do use vertexbuffers and make sure you models are backface culled; this will save a lot of CPU time, and a bit of GPU time.
  • 1

This forum is old and archived, Whatever it is i said up above may no longer reflect my opinion.

GMWolf
GMIterator
RefactorTool
OptimizedDecals

#25 Alvare

Alvare

    Not an administrator

  • GMC Member
  • 1812 posts
  • Version:None

Posted 16 February 2015 - 07:56 AM

Cpu's are multi threaded, and the s a good thing; you get far better performance that way.
GM runs on a single thread, and that's a bad thing; it is way behind modern tech.m.
Sure, a duo core 4ghz will run GM better than a quad 2ghz, but most newer applications will not work as well (as they are designed to run in more than 1 thread, since CPUs can do that now)
Anyhow, not to change the subject: the demo works great, but to boost performance, do use vertexbuffers and make sure you models are backface culled; this will save a lot of CPU time, and a bit of GPU time.

Phew. The answer I was hoping for.  ^_^


  • 0

#26 ThePC007

ThePC007

    Chickenator

  • GMC Member
  • 1062 posts
  • Version:GM:Studio

Posted 17 February 2015 - 02:55 PM

So are there any plans on enabling culling? 


  • 0

#27 fel666

fel666

    GMC Member

  • GMC Member
  • 1883 posts
  • Version:GM:Studio

Posted 17 February 2015 - 03:46 PM

So are there any plans on enabling culling? 

just build them into your models.

i havent actually bought this, but i understand it is a post-effect, so you have to do face culling yourself.

if you're using blender, i think exported models are culled by default (or at least, there is an option to do so)


  • 0

This forum is old and archived, Whatever it is i said up above may no longer reflect my opinion.

GMWolf
GMIterator
RefactorTool
OptimizedDecals

#28 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 17 February 2015 - 05:40 PM

We've made a few different demos for you guys to try.

 

High Quality: Link

Samples: 16

Blur Weights: 4

Resolution: 1

 

Medium Quality: Link

Samples: 8

Blur Weights: 2

Resolution: 1

 

Low QualityLink

Samples: 8

Blur Weights: 2

Resolution: 0.5

 

All have culling enabled.

We also made an optimization for the SSAO. There is a relative min/max size that is clamped in the shader. This prevents the SSAO from becoming too large as the camera gets close to geometry.

 

[EDIT]

On MishMash's Intel HD 3000, he is getting 50 fps on the low settings.


Edited by orange451, 19 February 2015 - 11:45 PM.

  • 4

bC14QqN.pngNrTFeil.png


#29 ThePC007

ThePC007

    Chickenator

  • GMC Member
  • 1062 posts
  • Version:GM:Studio

Posted 19 February 2015 - 11:40 PM

We've made a few different demos for you guys to try.

 

High Quality: Link

Samples: 16

Blur Weights: 4

Resolution: 1

 

Medium Quality: Link

Samples: 8

Blur Weights: 2

Resolution: 1

 

Low Quality: Link

Samples: 8

Blur Weights: 2

Resolution: 0.5

 

All have culling enabled.

We also made an optimization for the SSAO. There is a relative min/max size that is clamped in the shader. This prevents the SSAO from becoming too large as the camera gets close to geometry.

 

Low Quality runs with 24 fps on default settings and 17 when all sliders (except for strength) are maxed out (On my Intel HD 3000).


Edited by ThePC007, 19 February 2015 - 11:41 PM.

  • 0

#30 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 19 February 2015 - 11:43 PM

Low Quality runs with 24 fps on default settings and 17 when all sliders (except for strength) are maxed out (On my Intel HD 3000).

 

I just realized that I had the "Medium" and "Low" links switched. So perhaps you were running Medium, in which case you may get more performance :)


  • 0

bC14QqN.pngNrTFeil.png


#31 ThePC007

ThePC007

    Chickenator

  • GMC Member
  • 1062 posts
  • Version:GM:Studio

Posted 20 February 2015 - 12:00 AM

 

Low Quality runs with 24 fps on default settings and 17 when all sliders (except for strength) are maxed out (On my Intel HD 3000).

 

I just realized that I had the "Medium" and "Low" links switched. So perhaps you were running Medium, in which case you may get more performance :)

 

 

Yeah, didn't pay attention to the file name. I get about 53-55 now.


  • 1

#32 slayer 64

slayer 64

    Slayer of gingers

  • GMC Member
  • 4301 posts
  • Version:GM:Studio

Posted 20 February 2015 - 01:15 AM

for me, the lower resolution made the most difference. the range slider didn't do anything. the radius and blur sliders lag the most. the lowest quality demo always ran full speed. the medium lagged some.

i think you should have sliders for the samples and blur weights, and maybe show an actual number for the sliders so we can tell you what values we use.
  • 0

5y5rs3d.pngfg0UQNL.png


#33 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 20 February 2015 - 01:20 AM

for me, the lower resolution made the most difference. the range slider didn't do anything. the radius and blur sliders lag the most. the lowest quality demo always ran full speed. the medium lagged some.

i think you should have sliders for the samples and blur weights, and maybe show an actual number for the sliders so we can tell you what values we use.

 

The range check doesn't actually affect performance, it just allows you to control the maximum distance that can exist between objects for SSAO to occur.

The actual min-max was hard coded however it is a uniform so we can potentially make a slider for that. (This can help performance quite a bit, but with smaller values, it does reduce the effect (as the maximum radius essentially gets clamped.)

Blur weights and samples are hard-coded into the shader (i.e the number cannot be dynamically changed at runtime, so we would have to provide multiple shaders which would bloat the demo up a little too much.)

 

Thanks for trying out the demo's though! I too find resolution to be the most performance impacting thing, though naturally, it does cause the biggest drop in quality.


  • 0

VitalitySig18thMar.png


#34 Dragon47

Dragon47

    Mytino

  • GMC Member
  • 687 posts
  • Version:GM:Studio

Posted 20 February 2015 - 01:32 AM

Comparing the "low settings" exe to the exe about a week ago, I'm getting about 25x better "frame ms" (laptop intel hd family 4000). Not sure about the fps, but it's at least not below 60 :)


  • 0

wfoEubT.png       BNY6m3V.png       cfwjSDg.png       jermsLg.png       WqPXsGB.png

 

Games:   Blue Void (3D horror)   Icebound (2D puzzle platformer)


#35 raisins

raisins

    GMC Member

  • GMC Member
  • 349 posts
  • Version:GM:Studio

Posted 20 February 2015 - 10:22 AM

Hey dude, I get this problem when compiling the game: 

Error compiling vertex shader:In Shader sh_gbuffer_ddn at line 2 : '' : syntax error
Error compiling vertex shader:
In Shader sh_gbuffer_dn at line 2 : '' : syntax error
Compile Failed - Please check the Compile window for any additional information

I didn't make any changes. I just added your GMEZ to my project.

 

Thanks!


  • 0

fxYmZ6o.png

 

Visit my blog for GM tutorials and more! Ask.fm me a question! :D

 

kWb6ZYf.png  Vd9fN4l.png


#36 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 20 February 2015 - 04:08 PM

Hey dude, I get this problem when compiling the game: 

Error compiling vertex shader:In Shader sh_gbuffer_ddn at line 2 : '' : syntax error
Error compiling vertex shader:
In Shader sh_gbuffer_dn at line 2 : '' : syntax error
Compile Failed - Please check the Compile window for any additional information

I didn't make any changes. I just added your GMEZ to my project.

 

Thanks!

 

Hi, you need to change the sh_gbuffer_dn and sh_gbuffer_ddn to HLSL 9 (There is a drop-down in the top right corner of the shader editor, by default its GLSL ES). Not sure why GM doesn't track which shader type it is. (Will add this to first post troubleshooting.)


  • 2

VitalitySig18thMar.png


#37 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 20 February 2015 - 04:36 PM

i think you should have sliders for the samples and blur weights, and maybe show an actual number for the sliders so we can tell you what values we use.

 

I would like this as well. Unfortunately Shaders need to unroll for optimization. If Samples were a uniform, then the shader wouldn't know how many times to loop through each pixel beforehand.


  • 0

bC14QqN.pngNrTFeil.png


#38 TheStolenBattenberg

TheStolenBattenberg

    GMC Member

  • GMC Member
  • 198 posts
  • Version:GM:Studio

Posted 20 February 2015 - 05:12 PM

Wow.

Got a very decent FPS and render time running the High Quality demo, here's a screenshot for settings/FPS.

Spoiler


My Computer Specs:
- AMD FX-8350, 8 Cores @ 4.0GHz.
- XFX Radeon R9 270
- 8GB Patriot RAM @ 1600MHz
- 60GB Windows SSD, 2x 2TB HDDs for files/programs.


  • 1

Mentis Animae
~ game development across the world ~


#39 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 350 posts
  • Version:GM:Studio

Posted 20 February 2015 - 05:39 PM

Nicely done!

Getting 60 FPS in the new low-setting demo.

It starts to lag a bit (around 55 FPS) in the medium-settings demo.

(Tested both demos on a Geforce 9600 GT. Yeah, i know... it's a fairly old GPU. :) )

 

Just out of curiosity: Is the SSAO algorithm using screen-space normals as an additional source of information or is it purely depth-based?


Edited by -LEWA-, 20 February 2015 - 05:40 PM.

  • 0

signature.png


#40 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 20 February 2015 - 06:04 PM

Nicely done!

Getting 60 FPS in the new low-setting demo.

It starts to lag a bit (around 55 FPS) in the medium-settings demo.

(Tested both demos on a Geforce 9600 GT. Yeah, i know... it's a fairly old GPU. :) )

 

Just out of curiosity: Is the SSAO algorithm using screen-space normals as an additional source of information or is it purely depth-based?

 

It uses both depth and view-space normals. Ideally we wanted to use a Change of basis matrix to rotate the sampling kernel in an effort to avoid samples being cast back inside geometry (this is standard practise), however we went with a normal filtering check in the end as we had more success with it. Therefore it is actually quite important that the scene's normals are correct, otherwise the effect won't work properly.

 

The normals are also used in the blur method. Regarding performance however, on windows, as we use a gbuffer setup, there seems to be a very minimal impact between having normals and not having normals (as the depth gets rendered anyway in the same pass).

One issue however, is that the normalMatrix is still being calculated in the shader, we tried porting the code exactly as it was to GM, however for whatever reason, it didn't work properly. This is an optimisation that can be made down the line though!


  • 0

VitalitySig18thMar.png


#41 slayer 64

slayer 64

    Slayer of gingers

  • GMC Member
  • 4301 posts
  • Version:GM:Studio

Posted 21 February 2015 - 02:06 AM

i think you should have sliders for the samples and blur weights, and maybe show an actual number for the sliders so we can tell you what values we use.

I would like this as well. Unfortunately Shaders need to unroll for optimization. If Samples were a uniform, then the shader wouldn't know how many times to loop through each pixel beforehand.

maybe put a bunch of different shaders that can be chosen from in one example.
  • 0

5y5rs3d.pngfg0UQNL.png


#42 raisins

raisins

    GMC Member

  • GMC Member
  • 349 posts
  • Version:GM:Studio

Posted 21 February 2015 - 11:14 AM

Hey dude, I get this error:

___________________________________________
############################################################################################
FATAL ERROR in Vertex Shader compilation
ShaderName: sh_post_ssao

C:\Users\serfsef\AppData\Local\Temp\gm_ttt_80079\gm_ttt_18923\memory(24,1): error X3000: unrecognized identifier 'attribute'

 at gml_Script_render_ssao_buffer (line 23) - shader_set( sh_post_ssao );
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_render_ssao_buffer (line 23)
called from - gml_Script_SSAO_RENDER (line 33) - render_ssao_buffer();
called from - gml_Object_obj_ssao_DrawEvent_1 (line 2) - SSAO_RENDER();

How do I fix this? I've stripped the library down to the bare essentials leaving the obj_ssao on itself. I've deleted the other objects including obj_camera, and I've edited the scripts render_... and added my own variables to make sure it worked without using the variables previously stored in the objects like obj_camera and obj_debug.

 

Thanks.


  • 0

fxYmZ6o.png

 

Visit my blog for GM tutorials and more! Ask.fm me a question! :D

 

kWb6ZYf.png  Vd9fN4l.png


#43 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 21 February 2015 - 02:12 PM

Hey dude, I get this error:

___________________________________________
############################################################################################
FATAL ERROR in Vertex Shader compilation
ShaderName: sh_post_ssao

C:\Users\serfsef\AppData\Local\Temp\gm_ttt_80079\gm_ttt_18923\memory(24,1): error X3000: unrecognized identifier 'attribute'

 at gml_Script_render_ssao_buffer (line 23) - shader_set( sh_post_ssao );
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_render_ssao_buffer (line 23)
called from - gml_Script_SSAO_RENDER (line 33) - render_ssao_buffer();
called from - gml_Object_obj_ssao_DrawEvent_1 (line 2) - SSAO_RENDER();

How do I fix this? I've stripped the library down to the bare essentials leaving the obj_ssao on itself. I've deleted the other objects including obj_camera, and I've edited the scripts render_... and added my own variables to make sure it worked without using the variables previously stored in the objects like obj_camera and obj_debug.

 

Thanks.

 

As I said before, the gbuffer shaders are HLSL9, however I should have mentioned that all the others are GLSL ES. I'm guessing you have them set to something different, if you are getting an error with attributes. Hope this helps!


  • 1

VitalitySig18thMar.png


#44 raisins

raisins

    GMC Member

  • GMC Member
  • 349 posts
  • Version:GM:Studio

Posted 21 February 2015 - 02:21 PM

 

Hey dude, I get this error:

___________________________________________
############################################################################################
FATAL ERROR in Vertex Shader compilation
ShaderName: sh_post_ssao

C:\Users\serfsef\AppData\Local\Temp\gm_ttt_80079\gm_ttt_18923\memory(24,1): error X3000: unrecognized identifier 'attribute'

 at gml_Script_render_ssao_buffer (line 23) - shader_set( sh_post_ssao );
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_render_ssao_buffer (line 23)
called from - gml_Script_SSAO_RENDER (line 33) - render_ssao_buffer();
called from - gml_Object_obj_ssao_DrawEvent_1 (line 2) - SSAO_RENDER();

How do I fix this? I've stripped the library down to the bare essentials leaving the obj_ssao on itself. I've deleted the other objects including obj_camera, and I've edited the scripts render_... and added my own variables to make sure it worked without using the variables previously stored in the objects like obj_camera and obj_debug.

 

Thanks.

 

As I said before, the gbuffer shaders are HLSL9, however I should have mentioned that all the others are GLSL ES. I'm guessing you have them set to something different, if you are getting an error with attributes. Hope this helps!

 

 

I see! Yeah, I've set all of them to HLSL9. >.< 

 

Thanks!


  • 0

fxYmZ6o.png

 

Visit my blog for GM tutorials and more! Ask.fm me a question! :D

 

kWb6ZYf.png  Vd9fN4l.png


#45 ClassyGoat

ClassyGoat

    Goatee Connoisseur

  • GMC Member
  • 498 posts
  • Version:GM:Studio

Posted 17 October 2015 - 04:00 PM

Hello! I've been using this shader and it's working great for me! Perfect for a game I'm making.

One question I have though: I'd like to use a fog effect with this shader, but Game Maker's built in fog using d3d_set_fog does not work with this shader. Is there some way to make this work? Or perhaps I need to use a separate fog shader with it?


  • 0
7757C.png sharkhugs_banner.png

#46 dkcas11

dkcas11

    GMC Member

  • GMC Member
  • 310 posts
  • Version:GM:Studio

Posted 17 October 2015 - 04:27 PM

Looks really cool! Just downloaded the demo to try it out. Steady 60fps with 800+ real fps. I got an i7-2600k and a GTX 960 :)


  • 1

icon114_ios-1.png    icon114_ios-2.png    icon114_ios.png

    Fly Little Plane!                Swing Kites              Escaping Blocks


#47 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 17 October 2015 - 04:36 PM

Hello! I've been using this shader and it's working great for me! Perfect for a game I'm making.

One question I have though: I'd like to use a fog effect with this shader, but Game Maker's built in fog using d3d_set_fog does not work with this shader. Is there some way to make this work? Or perhaps I need to use a separate fog shader with it?

 

You would need to find a shader that does fog, and you'd need to apply it to the diffuseBuffer before the SSAO calls the merge shader.


Edited by orange451, 17 October 2015 - 04:37 PM.

  • 0

bC14QqN.pngNrTFeil.png


#48 ClassyGoat

ClassyGoat

    Goatee Connoisseur

  • GMC Member
  • 498 posts
  • Version:GM:Studio

Posted 17 October 2015 - 04:46 PM

Sounds easy enough, thanks orange451!


  • 0
7757C.png sharkhugs_banner.png

#49 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 17 October 2015 - 04:52 PM

Sounds easy enough, thanks orange451!

 

Though it also depends on the type of fog shader. If IT is a post-process effect, then what I said would work fine.

 

If it's not a post-process effect, you'll have to go into where the diffuseBuffer actually gets rendered, and apply your fog shader when it draws all of the scene's geometry.


  • 0

bC14QqN.pngNrTFeil.png


#50 Phantom107

Phantom107

    Graphics Enthusiast

  • GMC Member
  • 2774 posts
  • Version:GM:Studio

Posted 17 October 2015 - 06:13 PM

Great work MishMash and orange451!!

Edited by Phantom107, 17 October 2015 - 11:04 PM.

  • 1

GMCSignature.png

 

The most advanced GM game yet. Check out the Titan Rush GMC topic here! Developed by Phantom Technology

Talented spriting artist, looking for work? PM me. I'm working on a small project and need assistance. :)