login about faq
2
1

I see lots of numbers in Ambient Occlusion definitions file (AO.xml) for several games, but most of them use different and clueless combinations. How do I create Ambient Occlusion profiles for games not yet supported by RadeonPro? Is it possible?

This question is marked "community wiki".

asked Jan 08 '13 at 20:00

askbot's gravatar image

askbot ♦
08812


UNDER CONSTRUCTION

Yes, it is possible (with a few exceptions)

Quoting myself from What is Ambient Occlusion?

RadeonPro uses data from depth buffer (also known as Z-buffer) generated by the game engine during 3D drawing operations to calculate ambient occlusion in real time and for every frame. The way the depth buffer is captured by RadeonPro is determined by some special bit flags defined in an XML file.

In some cases is very difficult to grab the z-buffer data whilst it is holding valid data (i.e. before it's cleared by the game engine or overridden with other information not related to the current image), making impossible to use Ambient Occlusion as a generic post process effect like FXAA or SMAA.

RadeonPro uses some flags to capture the Z-buffer while dealing with the graphics pipeline. A typical Ambient Occlusion profile looks like this:

<File name="Fifa 2013" exe="fifa13.exe" flags="d3d9:1:0x00000000" params="" />

Breaking it down in pieces, we have:

name="Fifa 2013" ==> the human readable game title

exe="fifa13.exe" ==> the target executable for this AO profile

flags="d3d9:1:0x00000000" ==> the API, the Z-buffer index to be used and the bit flags, separated by ":". In this example, the API is D3D9, the Z-buffer index is 0 and bit flags are 0x00000000

params="" ==> optional parameters (not used in FIFA13 profile)

The name and exe parameters are self-explanatory. As you may already guessed, the flags parameters are the heart of Ambient Occlusion detection. The API can be D3D9, D3D10 or D3D11 (D3D8 and previous DX versions and OpenGL are not currently supported). A game engine can hold multiple Z-buffers for several tasks, first of all we need to find the correct index. Currently it's a trial and error task, but luckily most games use the first (index=0) Z-buffer (a simple debug tool is being developed to list Z-buffers created by the game engine so you'll be able to know how many indices are available to test). The FIFA 13 profile uses default bit flags (0x00000000)

If you open the Ambient Occlusion definitions file (AO.xml) you'll notice that several profiles use the same bit flags as FIFA 13 profile, meaning you can add a new profile using the same flags and just be lucky :) Unfortunately, some games need more hard work to get the Z-buffer detected, as Left 4 Dead 2 listed below:

<File name="Left 4 Dead 2" exe="left4dead2.exe" flags="d3d9:0:0xA0138041" params="nearZ=1,farZ=3000,firstI=1,lastI=2" />

The flags for L4D2 profile are much more complex and it includes some extra parameters as well, they are all needed to make Ambient Occlusion work on that game. Let's begin with the optional parameters: params="nearZ=1,farZ=3000,firstI=1,lastI=2"

nearZ=1 and farZ=3000 ==> these variable help during depth buffer sampling, nearZ is usually 1, farZ value vary depending on engine.

nearZ indicates how far from the view camera the Z-buffer will start to be sampled. A value of 1 means the Z-buffer is sampled right from the start of view camera. A higher value may help on games with lots of smoke/fog (like Alan Wake) so the ambient occlusion shadows don't appear in front of them.

farZ is set at 1000 if omitted, its value must be increased when the ambient occlusion shadows are too strong, creating an un-natural look. Recommended value for farZ starts at 1000 and can be set up to 10000. Greater values make AO shadows look more "soft".

firstI indicates at which step the Z-buffer will be captured, its value starts at 0. A Z-buffer can be cleared multiple times by the game engine, in case of L4D2 profile the firstI=1 indicates that Z-buffer must be captured at second clear step (firstI=0 would mean first step)

The bit flags, 0xA0138041, are a combination of values from 0 up to (2^32)-1 (0xFFFFFFFF) described on table below:

Obs: values with (*) will be documented soon.

Value Meaning
0x00000000Use default procedures
0x00000001Clear our temporary render target after the backbuffer rendering
0x00000002CLEARSKIP(*)
0x00000004NOVIEWPORTCHECK(*)
0x00000008Not used (reserved)
0x00000010NOZTEST(*)
0x00000020NOSTENCILTEST(*)
0x00000040EARLYRESOLVE(*)
0x00000080FORCEFX3(*)
0x00000100FORCEAUTODEPTH(*)
0x00000200RESAMPLE(*)
0x00000400NOBLUR(*)
0x00000800FORCEALPHA(*)
0x00001000DEPTHUPSAMPLE(*)
0x00002000RESOLVEALWAYS(*)
0x00004000ACCUMULATE(*)
0x00008000NODEPTHSTENCILSET(*)
0x00010000NORECTCOUNTCHECK(*)
0x00020000NOSKIPDIMCHECK(*)
0x00040000NOTEXTURECHECK(*)
0x00080000ZCLEARONLY(*)
0x00100000SKIPTARGETCLEARCHECK(*)
0x00200000FORCETARGETZBUFFERRESOLVE(*)
0x00400000RESOLVEAT1STCLEAR(*)
0x00800000NONULLDEPTHCHECK(*)
0x01000000SKIP1STONCE(*)
0x02000000SKIP1STALWAYS(*)
0x04000000SKIPRELEASE(*)
0x08000000SKIPNONCE(*)
0x10000000AUTODETECT(*)
0x20000000CHECKDEPTH(*)
0x40000000SKIPRESOLVECHECK(*)
0x80000000IGNOREZCLEARONLY(*)
link

answered Jan 09 '13 at 22:12

John's gravatar image

John ♦♦
834211

edited Jan 09 '13 at 22:27

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×8
×7
×1

Asked: Jan 08 '13 at 20:00

Seen: 3,217 times

Last updated: Jan 09 '13 at 22:28

powered by OSQA