Real Time Ambient Occlusion Shader [Open To All]

Hello forum. I have here a practical method for Real Time Ambient Occlusion. Anyone on the Forum able to convert this code to a Unity Shader for Public use, tell you what if anyone can feel free to post this on the forum or in the Asset Store.

The following link provides the methodology and code necessary to re-create Real Time Ambient Occlusion in games.
I am also sure Optimizations can also be implemented.

Share your thoughts forum.
Unity needs a Visual Upgrade, and after 2 more versions its clear its not getting the edge it deserves just yet. Many of Unities features come at a trade off such as Deferred Rendering Vs Forward Rendering…These two features have not been implemented as well as they should have crippling even the most basic work flow having to choose between basic Shadows and Anti-Aliasing, because neither one works with all the features a standard game would need something else would be needed. This is what This Shader would allow for forgiveness of those flaws as many engines have some.

Here : http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter14.html

I’m having some difficulty reading your post, so I have to make some assumptions.
You’re not pleased with standard the Screen Space Ambient Occlusion image effect, so you want to create a new lighting model, based on that GPU Gems article? I’m very interested in seeing what you end up creating.

The standard Screen Space Ambient Occlusion is not use-able for me in a high end game. It’s just not - especially on Moving Characters.
I personally have very limited skills when that comes to Shaders which Is why I posted this. Perhaps someone on the forum knows. I asked someone on the IRC and they said it is feasible and would definitely give Unity and Egde but he hasn’t been seen on the IRC for a few days now so I assume he wont be the one to get this done. He said was very familiar with the Literature and he said he would charge $125 an hour for a Shader like this which he said could take 8 hours…that’s almost 1000 dollars…I want this Shader to help Unity reach new heights…not actually to make profit off this Shader but since whoever makes the Shader can choose how they distribute the Shader it is up to them.

Having used UDK a little and noticing the “out of the box goodness” that engine has got me thinking too in regards to this. Today I was offered a job regarding a Female for a UDK game. The budget I was told was 30000 polies…that is A LOT compared to the standard Unity characters.

He told me the reason for this was because UDK loaded files differently compared to Unity. So Unity has a lot of basic flaws that apparently aren’t getting much attention. I want to make Unity better - Simply because Unity deserves to be and I know people exist that can help.

Good to hear you want to make Unity better. And don’t worry, you are not alone. Many people are working hard to make Unity better every day. For example, take a look at the recent DirectX11 Competition. There were 86 entries!

I understand that you can’t afford to hire someone to do the work. But if you want to contribute by doing the work yourself instead, I recommend Nvidia’s Cg Tutorial. It was a great help to me, when I was learning about shader programming.

About the Poly limit. UDK’s vertex limit for static meshes is actually pretty similar to Unity’s vertex limit for meshes; the highest possible value for a 16 bit unsigned integer: 65535. Their system for Skeletal Meshes seems to use at least 32 bit integers, and I guess you could make a request for this. But I think it’s worth considering an alternative approach when you need more than 21845 triangles.

Wow thanks a lot for that CG Tutorial!

Regarding the Vertex limit - I didn’t mean that in the way you said it. UDK supposedly uses pre-rendering techniques allowing the models to be much higher polycount’s without using more processing power or something like that.

Either way I have one question for you; Do you know why Unity hasn’t had a proper lighting upgrade and why Unity forces trade-offs - Forward (Anti-Aliasing but Directional Shadow only) and Deferred (HDRI , All Shadows - No Anti-aliasing)?

Does UDK have this problem, from Unities perspective is it a technical problem or what. Because It seems they either unable to find a solution or they are not trying. I don’t see these problems with other game engines much, even Shiva 3d I think didn’t have these problems.

Is it possibly because Unity chose a specific method that in the end screwed them over or …

I don’t know about any Unreal Engine specific tricks, but it is common to create normal maps for models, using high-poly versions. This has little to do with the engine you’re using.

There are always trade offs. By studying how these techniques are implemented, you’ll be able to understand where they come from. For example, here are the slides for a presentation by Valve, about the choices they made when implementing HDR rendering in the Source engine. The system they ended up with has great hardware support, but doesn’t support calculating Bloom based on the HDR image. It works perfect for the kind of games they are making.

Unity has to be very general, because it is meant to be used on a lot of different platforms, with very different hardware, for a great variety of games. This is also why games tend to look a bit dull when they use default settings.

Currently, the biggest difference in image quality (which is obviously subjective), can be made by customizing Unity to your needs, with custom settings, shaders and materials. And let’s please not forget about the importance of ‘good’ art.

In the end, the thing that matters most is the player having an interesting experience.

The techniques used by UDK are similar to the ones used by Unity. Just slightly more specialized.

Before you assume that Unity Technologies is ‘not trying’, I suggest you try it yourself ;). It’s a very interesting field of technology; It’s worth trying.

Hey you guys.

Does anyone know how to implement the NVIDIA shader in the link in cg? i am not very good at porting shaders between languages, so any help would be appreciated!

I gave it a shot some time ago.

That NVIDIA Ambient occlusion has some drawbacks I don’t know how to overcome.
Basically, you will need to calculate all Disks inside a vertex or fragment shader in a for loop. This means it can get slow (unusable slow for mobile, what I was targeting) and the for loop needs a fixed number of iterations (at least as far as I know). It’s quite impossible to know the number of disks be forehead.
Also you need to get the position / data of the disks inside a shader. This can be done with arrays, but is also very inflexible and you need scripts that feed the arrays.

The beauty of screen space ambient occlusion, it’s very predictable and constant how much time it will take… and it’s a one button solution.

I’m currently busy with my graduation and one of the topics is AO. I also encountered this implementation during my research and I might take a look at it to see if I can implement it right, although I have to say I also encountered some nice SSAO samples and I might implement one of those.

Should I get something useful out of it, I will post something here.

Do note that I am on a schedule and I probably won’t be able to do something with AO for the coming 4 weeks. I’m also not that frequent on these forums, so if you’re really interested if I got something, you might wanna PM me or something.

Good luck to those that will try it before me :slight_smile:

@Rld_: Good Luck! I am making an attempt myself, but half the shaders are in HLSL or GLSL! I actually posted some code i wanted help porting, but noone visited my thread yet… :frowning:

FuzzyQuills, got a link? Can’t seem to find it.