[SLE / SSE / FO4] Depth of Field

share shaders here
Post Reply
  • Author
  • Message
Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

[SLE / SSE / FO4] Depth of Field

Advanced Depth of Field for TES Skyrim, TES Skyrim Special Edition and Fallout 4

Hey there!
Need some slight Depth of Field for gameplay, or are you the screenarcher who tortures the videocard with 4K,5K resolutions and need some nifty bokeh shapes to emphasise your perfect shot you've been setting up for half an hour? Say no more! This Depth of Field shader can do all that. Even though the size and feature set might be a tiny bit intimidating at first, you'll see that it's actually easy to get used to and even if you just want a bit blur in your scene, you can use conservative settings and get what you want without sacrificing a lot of FPS.


Highly recommended video to get started with this shader plugin, thanks to tapioks:



FEATURES
  • Autofocus for gameplay
  • Manual focus for perfect shots when automated focus detection doesn't really cut it
  • Tilt Shift for some cool and alternative scenes
  • Chromatic aberration, also featuring a new innovative algorithm for no performance cost
  • Numerous shape controls for easy recreation of any bokeh shape seen in movies of photographs
  • Bokeh shape preview overlay so you can directly see how one arbitrary control affects your bokeh
  • Smoothing of bokeh shape, improved over regular gaussian blur
  • On-the-fly option to render in a lower resolution, making even wide and high quality blur easy on hardware and framerate
  • Optional switch to make perceived blur width coherent on different resolutions, so users of your ENB have the same experience as you do
  • Screen-Space Ambient Obscurance as a placeholder for the ENBSeries SSAO that may or may not be implemented into SSE ENB in the future.

DOWNLOAD

3.0 - 1.11.17 - sse/f4________________ 3.0DX9 - 16.02.18 - oldrim
2.1f - 19.03.17 - sse/f4
1.51- 22.12.16 - sse/f4
1.5- 22.12.16 - sse/f4
1.41- 17.12.16 - sse/f4
1.4 - 17.12.16 - sse/f4
1.3b - 3.12.16 - sse/f4
1.2 - 13.11.16 - sse/f4
1.1 - 4.11.16 - sse/f4
1.0 - 3.11.16 - sse/f4


CHANGELOG

2.1f: add SSAO, add second post blur variant (bokeh blur second instance instead of gaussian), add sharpening (matso code), various code improvements (read: I don't remember what I did but it surely had its purpose), improve inline documentation
1.51: fix bug with chroma order 1, 5 and 6 using derivative chromatic aberration
1.5: add new chromatic aberration mode that should perform almost as well as old one at no fps cost (shape chroma mode now switches between the 2 modes, the color shifts are now controlled by shape chroma order), fix bug with Tilt Shift, added bokeh flicker reducer (timothy lottes, crytek mixed), modify shape preview for higher performance and better compatibility with future updates, code cleanups
1.41: fixed bug with preview window, modified functionality to enable it with GUI.
1.4: fix bug with tilt shift + postblur, add preview window for bokeh shape, add second mask mode, add option to make blur width independt from screen size (FHD -> DSR no longer changes perceived blur width), add autofocus smoothing (correct-ish, recursive function can never be fixed fully), changed functionality of fADOF_InfiniteFocus, various code restructures and improvements to improve performance, modify default file for plug&play gameplay config instead of crazy test values
1.3: add tilt shift
1.2: readd shape weight, add shape chroma with a different algorithm, modify bokeh blur algorithm for higher performance
1.1: readd various features of ReShade equivalent, add UI vars
1.0: initial release

UI VARS DOCUMENTATION
  • FocusMode 0 (gp65cj042/McFly modified) Parameters (hidden for FocusMode 1)
    • Autofocus (Enable Autofocus == 1)
      • Enable Autofocus: Enables automated focus detection by taking the depth of Autofocus sample center into consideration.
      • Autofocus sample center: The Autofocus checks the depth at this point to determine what you're looking at to blur everything what you're not looking at.
      • Autofocus sample count: Amount of additional points around the sample center for a more coherent focus depth detection. Just like 1 pixel is not very meaningful for the average color onscreen, autofocus needs to take more samples than 1.
      • Autofocus sample radius: The distance of the additional samples around the sample center.
      Example:
      Image
    • Manual focus (Enable Autofocus == 0)
      • Manual focus depth: the distance of the focus plane. 0.0 equals camera, 1.0 equals sky. Lower values move focused area closer to player.
    • (both manual & auto)
      • Near blur curve: curve of blur of near blur area (area closer to camera than focus).
      • Far blur curve: curve of blur of far blur area (area behind focus plane).
      • Near blur mult: multiplier of blur of near blur area (area closer to camera than focus).
      • Far blur mult: multiplier of blur of far blur area (area behind focus plane).
      • Infinite depth distance: Parameter to make DoF effects cut off early. Everything larger than that is considered as "infinitely far away", hence not triggering any autofocus or anything. If set to 1.0 (no effect), DoF will react to focus changes from a mountain to the sky (which in real life have no effect on your eye). Setting it to 0.1 or lower and using autofocus, your image will be not blurred except you're very close to an object. Good for gameplay.
  • FocusMode 1 (Tilt Shift) Parameters (hidden for FocusMode 0)
    • Tilt Shift Axis Position: Position of TS axis (blur increases perpendiculary to axis).
    • Tilt Shift Focus Width: Size of the area around the axis with no blur.
    • Tilt Shift Axis Rotation: Rotation of TS axis. 0 deg means horizontal axis, 90 deg means vertical (axis pos will move axis left/right then).
    • Tilt Shift Blur Curve: Curve of TS blur.
  • Bokeh Blur & Shape Parameters
    • Bokeh Intensity: The intensity of the bokeh effect. with 1.0, the DoF looks like gaussian. Note that higher values make DoF more temporally unstable (flickering for low AA-ed areas)
    • Enable Bokeh shape preview window: This shows a small window on the bottom right corner of your screen that directly shows how your bokeh shape looks like.
    • Bokeh shape max size: The overall blur intensity control of the DoF. If bADOF_BlurDependingOnPixelSize == 1 in fx file, this parameter directly maps to the maximum blur radius in pixels the DoF will produce for areas completely out of focus.
    • Bokeh shape vertices: Amount of vertices of the DoF shape (5 => Pentagon, 6 => Hexagon and so on).
    • Bokeh shape quality: Amount of samples for the bokeh shape, higher means sharper bokeh shape but less performance. Raise until you see no difference between increments.
      Example:
      Image
    • Bokeh shape curvature: Deforms the polygon into circle (curvature == 1) or star shape (curvature == -1).
      Example:
      Image
    • Bokeh shape rotation: Angle of rotation of the bokeh shape.
    • Bokeh shape aspect ratio: This controls the width of the bokeh shape. ratio = 0 deforms bokeh shape to vertical line.
    • Bokeh Shape Weight Parameters (hidden if Shape Weight is disabled)
      • Bokeh shape weight curve: Curve of the bokeh weighting (donut effect). Higher values expand the dark area inside the bokeh shape. Test value in preview window.
      • Bokeh shape weight amount: Amount of the bokeh weighting (donut effect). Higher values make the darkening inside the bokeh shape more intensive. Test value in preview window.
      • Example: [img]http://abload.de/img/weightgqs98.png[/img]
    • Other Parameters
      • Shape chroma amount: ONLY SHOWS UP IF CA IS ENABLED IN FX FILE! Amount of color shift of the bokeh shape caused by chromatic aberration (color effect on the outside of the bokeh shape).
      • Blur render res mult: Scale of the bokeh blur. 0.5 means the bokeh blur is rendered in half the X Y resolution, which means only 1/4 of the fullres pixels are processed. Works exactly like ENB AO control "SizeScale". HUGE performance benefit.
      • Gaussian postblur width: Blur width of the small-scale gaussian blur after the main bokeh blur to make the shape a bit sharper and hide undersampling artifacts.
[/list]


SCREENSHOTS
Image
Image
Image
Last edited by Marty McFly on 22 Jan 2021, 19:27, edited 48 times in total.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: Skyrim SE Advanced Depth of Field

Thank you Marty.
Works neat.
Will wait for Boris to enable DNI separation in order to use this at its fullest.
For now, I'll try adding a prepass sharpening in it, I wonder if this shader works as a prepass, the same way it worked in DX9 version.
_________________
Lian Li PC011 Dynamic, Corsair AX 1500i PSU, i9 10850K @5.0 Ghz, Aorus Z490 Ultra, RTX3090 MSI Gaming X Trio, 32GB Corsair Vengeance Pro RGB RAM@3600, Corsair MP600 1TB NVME System Drive, 10 TB Storage, W10 Pro 64, Custom Hard Tubing Watercooling Loop

Offline
User avatar
*master*
Posts: 136
Joined: 08 Nov 2012, 15:24

Re: Skyrim SE Advanced Depth of Field

Wow, this is great! I'm looking forward to seeing where you go with this.

I actually ported over Light DoF's poisson blur from ReShade for my F4 ENB, but I didn't think to post it seperately. It has a particularly interesting appearance in F4/SSE because of how the noise samples interact with the temporal filter. But it doesn't really match this.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: Skyrim SE Advanced Depth of Field

I'll make this modular with own vertex shader and stuff like that so a simple #include should make it work for everyone in every preset. Currently looking for ways to improve performance as the ReShade variant could render to lower res target and save performance, now we render to fullscreen and read from RGBA16F instead of RGBA8 which is slower.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17427
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Skyrim SE Advanced Depth of Field

Post screenshots to first message, users frequently bypass topics without pictures.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: Skyrim SE Advanced Depth of Field

I will, thread is under construction. Hadn't much time yesterday to make a proper thread. But thanks for the heads up :)

Offline
User avatar
*sensei*
Posts: 341
Joined: 27 Dec 2011, 21:33
Location: Poland, Gdańsk

Re: Skyrim SE Advanced Depth of Field

Thank You Marty!

Image

Image

Image

Image

Image

Image

PS: Pro Tip - use the curve value of "1.0" rather than "4.0", we're dealing with HDR here :)
_________________
OS: Windows 10
CPU: AMD R5 3600
RAM: Corsair DDR4 16GB 3200MHz Vengeance
GPU: AMD Radeon 5700 XT
Sound Card: X-FI Titanium HD
Mobo: ASRock X370 Pro4
Monitor: M340CLZ 34" 3440x1440 100HZ AMD FREE Sync Curved Monitor

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: Skyrim SE Advanced Depth of Field

Erhm, how did you make circular DOF, I haven't copied that feature over in the build? Or did you just swiftly do that yourself? Also, on Skyrim a high curve is needed but that's why this param is there, so one can tweak it how (s)he needs it.

Offline
User avatar
*sensei*
Posts: 341
Joined: 27 Dec 2011, 21:33
Location: Poland, Gdańsk

Re: Skyrim SE Advanced Depth of Field

Marty McFly wrote:Erhm, how did you make circular DOF, I haven't copied that feature over in the build? Or did you just swiftly do that yourself? Also, on Skyrim a high curve is needed but that's why this param is there, so one can tweak it how (s)he needs it.
I've set the vertex count to 18 :P
_________________
OS: Windows 10
CPU: AMD R5 3600
RAM: Corsair DDR4 16GB 3200MHz Vengeance
GPU: AMD Radeon 5700 XT
Sound Card: X-FI Titanium HD
Mobo: ASRock X370 Pro4
Monitor: M340CLZ 34" 3440x1440 100HZ AMD FREE Sync Curved Monitor

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: Skyrim SE Advanced Depth of Field

Oh. Well, that works indeed. But not very performance efficient as more vertices mean also more densely accumulated samples. 6-7 vertices for circular look best.
@Topic: I did some math: maximum quality of 25 means 1950 samples for hexagonal bokeh. As I can keep 60fps with that setting and 0.5 render resolution mult this means, I have with 1950 samples a higher performance than GP DOF with quality 9 = 270 samples.
Post Reply