DOF autofocus debug

  • Posts: 87
2 years 5 months ago #1 by Niko of Death
I have been working on setting up dof shaders in as many games as I can. Unfortunately, in many cases it is difficult to properly setup the autofocus, as it is unclear precisely where the focus point is. A debug option that shows the area that the shader is focused on would be extremely helpful, if it is possible.
The following user(s) said Thank You: AssassinsDecree

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

  • Posts: 89
2 years 4 months ago #2 by AssassinsDecree
Couldn't agree more. Hope this happens one day.

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

  • Posts: 85
2 years 4 months ago #3 by moriz1
if you have some basic coding knowledge, it's pretty easy to just write a focus point shader yourself.

you can also modify existing DoF shaders to display debug info, using the DrawText.fxh header file.

i made use of this in my KuwaharaDoF shader. here's the code snippet:
#include "DrawText.fxh"
.
.
.
if (ShowDebug) {
        float res = -0.1;

		int line0[13] = { __M, __o, __u, __s, __e, __Space, __C, __o, __o, __r, __d, __Colon, __Space };

		DrawText_String(float2(100.0, 132.0), 32, 1, tex, line0, 13, res);
		DrawText_Digit(DrawText_Shift(float2(200.0, 132.0), int2(13, 0), 32, 1), 32, 1, tex, 0, MouseCoord.x, res);
        DrawText_Digit(DrawText_Shift(float2(400.0, 132.0), int2(13, 0), 32, 1), 32, 1, tex, 0, MouseCoord.y, res);
        DrawText_Digit(DrawText_Shift(float2(500.0, 132.0), int2(13, 0), 32, 1), 32, 1, tex, 3, focusPoint, res);

		if ( res != -0.1)
			return res;
    }

basically, if the debug toggle is pressed, it displays your current mouse coordinates, as well as the depth value that the shader is focusing on.

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

  • Posts: 177
2 years 4 months ago #4 by luluco250
I think OP means something more along the lines of a visual debug, like a depth texture where the areas in focus are colorized.

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

  • Posts: 343
2 years 6 hours ago #5 by OtisInf
My new DOF shader for reshade (Cinematic DOF) implements this: reshade.me/forum/shader-presentation/453...matic-depth-of-field

Hope this helps and you like the shader :)

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