Understanding Ambient Light

  • Posts: 790
4 years 5 months ago - 4 years 5 months ago #21 by Ganossa
Of course ;)
Dependent on what other shader you use, the default settings are usually already tweaked decently. For me personally, there is usually only minor things to change.

If the game has not a lot of UI elements I enable AL_Lens.

Depending on the dominant scene colors, I select the AL_Adaptive setting. Usually for dominant cold scenes I set it to warm and for dominant warm scenes to cold (so always the contrary).

After AL I apply a LUT or simple palette that emphasis darker areas and in some cases also slightly reduces the color range (mainly with the palette).

If you are looking for a gritty, more cinematic look, a combination of CA, Advanced_CRT, slight sharpening and film grain can help on top of AL.
The following user(s) said Thank You: Constantine PC

Please Log in or Create an account to join the conversation.

  • Trolsimandias
  • Trolsimandias's Avatar
4 years 5 months ago #22 by Trolsimandias
i really love ambient light. btw i have a question. Now i trying to use only reshade + master effect (i like more that DoF effect) its possible to add ambient light or only gem?

Please Log in or Create an account to join the conversation.

  • Posts: 790
4 years 5 months ago #23 by Ganossa
[ ReShadeFramework ]
| .................................. |
| [GemFX] ................... |
| [SweetFX] ................ |
| [MasterEffect] ......... |
[ .................................. ]

The latest version of MasterEffect is already included in the Framework. As I remember, the latest (stand-alone) DoF shader update was only included in the Framework, since Marty also wanted to steer towards the Framework support.
Though that update added plenty of new options to the DoF, you should still be able to recreate previous results. :)
@Marty, any other comments on that?

Please Log in or Create an account to join the conversation.

  • Trolsimandias
  • Trolsimandias's Avatar
4 years 5 months ago #24 by Trolsimandias
with framework some games like AC Unity uses correctly the DoF values but others like GTA V takes some blur around the character and camera needs time to adapt. With stand alone Mastereffect i get instant result with no blur over the character on front in frame buffer : ( i dont understand btw. But dont have ambient light is painfully for me

Please Log in or Create an account to join the conversation.

  • Posts: 133
4 years 5 months ago #25 by SpinelessJelly
@Trolsimandias: You may want to take a look at this page reshade.me/forum/shader-discussion/1456-...work-1-1-fixes#10858 , there's a fix for Framework 1.1's DOF near fade code.
The following user(s) said Thank You: Trolsimandias

Please Log in or Create an account to join the conversation.

  • Trolsimandias
  • Trolsimandias's Avatar
4 years 5 months ago - 4 years 5 months ago #26 by Trolsimandias
@SpinelessJelly Works better but for no reason using the same config i dont get the same effect speed : (

Edit: i fixed using framework 1.0 and get all effects but now i cant add mcfly advanced dof : (

Please Log in or Create an account to join the conversation.

  • Trolsimandias
  • Trolsimandias's Avatar
4 years 5 months ago - 4 years 5 months ago #27 by Trolsimandias
Its strange but after some tries i verified about that. For example with 1.1.0 or 1.0 i cant access Depth Buffer on some games like jedi academy. But with reshade + ME alone i can.

i love that buffer possibilities but i dont want to miss Ambient Light, high pass sharpen or clarity : (

Please Log in or Create an account to join the conversation.

  • Posts: 790
4 years 5 months ago #28 by Ganossa
The framework supports logarithmic depthbuffer which wasn't supported in the ME releases. Using the framework, you therefore need to toggle between logarithmic and non logarithmic depth buffer dependent on the game. Newer open world games such as Fallout 4 or GTA V need the logarithmic depth buffer support found in the framework.

Please Log in or Create an account to join the conversation.

  • Posts: 209
4 years 5 months ago #29 by SunBroDave

Ganossa wrote: The framework supports logarithmic depthbuffer which wasn't supported in the ME releases. Using the framework, you therefore need to toggle between logarithmic and non logarithmic depth buffer dependent on the game. Newer open world games such as Fallout 4 or GTA V need the logarithmic depth buffer support found in the framework.

Actually, I believe F4 uses a linear depthbuffer. The Witcher 3 and AC: Unity are recent open world games that use logarithmic depthbuffers though.

Please Log in or Create an account to join the conversation.

  • Posts: 177
4 years 5 months ago #30 by kingeric1992

SunBroDave wrote: Actually, I believe F4 uses a linear depthbuffer. The Witcher 3 and AC: Unity are recent open world games that use logarithmic depthbuffers though.


not linear, F4 follows conventional D3D zbuffer. other game is probably just using reverse mapped zbuffer, at least I can confirm mad max is.
not sure if there is any commercial game uses logarithmic depth while reverse z can handle the precision pretty well.

Please Log in or Create an account to join the conversation.

  • Posts: 790
4 years 5 months ago #31 by Ganossa
Since Fallout 4 is the latest open world title I expected it to use logarithmic depth buffer but I guess with their old engine and not much effort to improve, they just stick to the conventional methods. :P

GTA V and Witcher 3 use the logarithmic depth buffer for their vast distances.

Using the conventional value distribution in a vast open world game would mean that you loose about 70% (or more) of your precision in the not detailed distance of the world. That would leave you only 30% to cover the precision and detail of objects that are as close as in an fps title while those games have the complete 100% precision range to do that. To keep potential for the detailed part of the view, it clearly makes sense to use logarithmic distribution for your values. Lets say that leaves you with 20% of the values for the distance and 80% precision for the close and detailed view, this ratio very lilely represent the distribution of actual detail (LoD) in an open world with a vast view.

Here an example of the logarithmic depth buffer (in Witcher 3) linarized and displayed in the ReShade Framework:

Please Log in or Create an account to join the conversation.

  • Posts: 177
4 years 5 months ago - 4 years 5 months ago #32 by kingeric1992
That is why d3d games use reversed-Z.

here is a comparison around near plane.
www.desmos.com/calculator/xihmetpsdl
(zN = 0.002, zF = doesn't matters on large scale (except for outerra's logarithmic depth))

X axis is z-buffer value
Y is restored value
Purple: forward-z
orange: Logarithmic from outerra blog
Red: Logarithmic here
Green: reversed-z



and if check out outerra's research, he's log depth is designed to have constant error on "planet scale" (like google earth or sort) with 24bit z.

Please Log in or Create an account to join the conversation.

  • Posts: 790
4 years 5 months ago - 4 years 5 months ago #33 by Ganossa
The depth buffer values in GTA V and Witcher 3 have a logarithmic distribution.

This assumption we had is proven correct when applying the linearization function a physicist colleague and I wrote for the assumed logarithmic depth buffer.

depth = (exp (pow (depth, 150 * pow (depth, 55) + 32.75f / pow(depth, 5) - 1850f * (pow ((1 - depth), 2)))) - 1) / (exp (depth) - 1);

We do not know the exact logarithmic function used but the linarization function proves its logarithmic behavior.

Since it seems to be close to the "reversed" function I will eat my hat if thats the quick alternative -_-
Its not a natural reverse function (1/x) by the way, what function did you use, 0.001/x?

Please Log in or Create an account to join the conversation.

  • Posts: 177
4 years 5 months ago - 4 years 5 months ago #34 by kingeric1992
the graph and functions are on the online plotter www.desmos.com/calculator/xihmetpsdl

reversed-z linearize function is driven from d3d projection matrix with flipped zF zN.

Z = F * N / (F + z * (N - F)); //classic
Z = F * N / (N + z * (F - N)); //reversed

or you can just google d3d depth linearize function driven by others and flip zF zN
actually, I think crosire mentioned it once in the forum.

also the technique itself is not something new and have been discussed / on SIGGRAPH talks / papers for years.
but the game companies probably only change to new resolves when the old one isn't enough.

Please Log in or Create an account to join the conversation.

  • Posts: 790
4 years 5 months ago - 4 years 5 months ago #35 by Ganossa
Funny enough that is was yet satisfied by our linearization function, though it still has a clear logarithmic distribution for me.

We went to logarithmic approach right away instead of trying the reverse function here, how would you call such depth buffer then?

Just tested the revers function (and we might have tried that actually in the past cause the result looks familiar).

"Your" Reverse-Z function


The real Reverse function (1/x)


My linearization function


"Your" Reverse-Z function is basically the same as the real reverse function with varying 1/x to ~0/x. The distance it can cover is yet as small as for the conventional depth buffer and therefore wasting its potential (that ~70% I was taking about).
With my linearization function it covers a farther distance, so I guess I will stick to that :)

Please Log in or Create an account to join the conversation.

  • Posts: 177
4 years 5 months ago - 4 years 5 months ago #36 by kingeric1992
ofc.... you still need to set proper zFar zNear, and the output is on actual scale, not map to [0,1].
you will need to normalize the output to display on screen.

I believe ppl referring it as reversed-z or reversed mapped float point z buffer.
and it is not mine, ppl been doing that for years, and even promoted by Nvidia dev and MJP and other ppl.
also the "reversed" comes from mapping zFar to 0, zNear to 1, not reciprocal.

for proper zF zN, If not doing shader hunt, I don't know exactly how. (by guess?)

for say Mad Max use zN = 0.1, zF = 40000 is legibly from cbuffer by shader dump and math.
others like skyrim /fallout has setting ini fNearDistance. zN = 0.15, zF = 3000

I have no wish to change any of the framework standard, just replying about games using logarithmic depthbuffer. (which normally refers to outerra's work, and games that uses logarithmic depth doesn't need to flip the mapping, the algorithm itself is design to spread the precision on forward mapped/ near = 0 buffer.)
The following user(s) said Thank You: Ganossa

Please Log in or Create an account to join the conversation.

  • Posts: 790
4 years 5 months ago - 4 years 5 months ago #37 by Ganossa
Alright, I tried also with various values before which did only change the start of visible depth not the distance it covered ...
it appears that ReShade values are just (really!) far off from the usual. :side:

//Changed our linearization function accordingly, so thanks for the hint! :)

Please Log in or Create an account to join the conversation.