Welcome, Guest.
Username: Password: Remember me

TOPIC: Correct Image Pipeline

Correct Image Pipeline 1 year 3 months ago #1

Hey Lucifer (and other shader developers),

I am a VFX artist and compositor. I also work in photography and film. Reshade is absolutely fantastic and one of the best things to happen for PC gamers in good while.

Something I have been thinking about since the mediator got released is correct image pipeline. When doing visual effects one of the things that needs to be understood is how a camera works and what comes first. I know we are dealing with a video game shader suite, but I think the same techniques apply here and will improve the look of things in general.

I'll start by quickly going over the correct pipeline in video or film. The very first thing that happens is light hitting the lens of the camera. No light, no image. Light includes everything you can see and depth of field. The next thing is lens artifacts. These include natural lens vignetting, lens filter flares, lens distortion, lens blur caused by low quality glass (field curvature lens blur), lens flares, airy disk glow, astigmatism and chromatic aberration. The last thing, if you are shooting on film, is film grain. Other image alteration like post vignetting and color correction come very last. Adhering to this order results in more correct composites and better looking final images.

The current framework is all over the place with effect order. The mediator allows you to re-position some effects but sometimes you can only move whole suites at a time which makes sorting this as a user almost impossible.

As an example, here is a list of all current framework effects in the correct order (with explanations if needed):

1. Light (everything that pre-exists in the scene):
Reflective Bump Mapping
Ambient Occlusion
Godrays (could be moved after DoF, it all depends on if you want blurred or sharp godrays. Behind DoF they behave more like their real world counterpart since they are physically in the scene and would therefore get blurred)
Depth of Field/Tilt Shift
Bloom Shaders
Ambient Light
Heat Haze
Motion Focus
Motion Blur
Deband

2. Lens:
Lens Dirt
Vignette (Can be moved to post vignetting. Depends on the user)
Lens Distortion Shaders
Lens Flare Shaders
Chromatic Aberration Shaders

3. Film:
Sharpening Shaders
Film Grain Shaders

4. Color Correction and other Post Edits:
TuningPalette (Should come first because a LUT would be your primary tool for color correction if you are using it. You don't want other color shaders to come before it)
All other SweetFX Color Related Shaders
All CustomFX Color Related Shaders
Image Conversion Shaders (Emboss, ASCII, Cartoon, Explosion, Advanced CRT, Pixelart CRT, Cel, Paint)
Post Vignette
Anti Aliasing Shaders
Dither
GR8MMFILM
Border
Splitscreen

For obvious reasons I left out the BasicFX, and I am not 100% sure where Gauss would go as it contains blurring, sharpening and bloom all at once. Best to leave that up to the user.

Sorry for the really long post. I also realize that setting this up might be difficult. It would be really awesome to have everything in the correct and logical order though. Thank you for your time!


Witanlore: Dreamtime
Last Edit: 1 year 3 months ago by vfxninjaeditor.
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick, BillyAlt, jas01

Correct Image Pipeline 1 year 3 months ago #2

I actually found putting Deband right before the general shaders was the best for me. Some shaders cause banding and if you have them after deband, they don't get debanded. Notably AO and DOF. I actually reported these a while back in the Framework forum thinking they just broke deband, but JPulowski suggested I move Deband after AO and DOF in the effect ordering and it fixed the issue.
I'm always learning.
The administrator has disabled public write access.

Correct Image Pipeline 1 year 3 months ago #3

Good note, I'll move it to the end of the 1st list.


Witanlore: Dreamtime
The administrator has disabled public write access.

Correct Image Pipeline 1 year 3 months ago #4

Constantine PC wrote:
I actually found putting Deband right before the general shaders was the best for me. Some shaders cause banding and if you have them after deband, they don't get debanded. Notably AO and DOF. I actually reported these a while back in the Framework forum thinking they just broke deband, but JPulowski suggested I move Deband after AO and DOF in the effect ordering and it fixed the issue.

Side note, do you have some recommended settings for deband? The last couple times I tried using it a stopped because it was frustrating me. It was really messing up the quality of the image.


Witanlore: Dreamtime
The administrator has disabled public write access.

Correct Image Pipeline 1 year 3 months ago #5

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
Please note that currently the AO and DoF shader overwrite any prior shader output. Therefore they have to be at the beginning.

I explained before why certain shader are grouped together. There is no suite group or rule for that but it depends on the individual techniques.

A shader is part of a technique and a technique is the group of one or more shader in the pipeline. While you could order a shader within its own technique, global ordering can only be done between techniques.

Why not have only one technique and order shader in it? Techniques are currently the structures that are allowed to be toggled, timed or similar. We need individual techniques to be able to toggle individual effects.

Why not having only one shader for each technique and therefore single shader groups? First of all each technique comes with a bit of overhead. Therefore, we have for example some color correction shader in sweetfx grouped together on purpose to minimize this overhead. Secondly, a shader developer that creates a complicated effects with several shader needs to specify his own fixed pipeline of shader within the technique of his effect to ensure it does not break. Some shader are dependent or should be in a certain fixed order by design.

All this is no limitation of ReShade, the Framework or the mediator but a decision by us shader developer to ensure proper functionality, results and performance :)
The administrator has disabled public write access.
The following user(s) said Thank You: Constantine PC

Correct Image Pipeline 1 year 3 months ago #6

  • BillyAlt
  • BillyAlt's Avatar
  • Offline
  • Posts: 42
  • Thank you received: 9
vfxninjaeditor wrote:
Constantine PC wrote:
I actually found putting Deband right before the general shaders was the best for me. Some shaders cause banding and if you have them after deband, they don't get debanded. Notably AO and DOF. I actually reported these a while back in the Framework forum thinking they just broke deband, but JPulowski suggested I move Deband after AO and DOF in the effect ordering and it fixed the issue.

Side note, do you have some recommended settings for deband? The last couple times I tried using it a stopped because it was frustrating me. It was really messing up the quality of the image.

Pretty much needs to be done on a per-game basis. Modern games you will want to go light on it as some have *very* detailed textures. Games like Witcher 3, Call of Duty: Advanced Warfare, Dying Light and others have very detailed and alias-prone textures. Banding is less noticeable in such high details as well.

Older games will benefit from stronger settings as they typically have lower detailed textures and much more noticeable banding, especially before HDRR became de facto.

Also, it is very important that debanding be placed last, as you said, even for some of ReShade's own shaders. Gaussian Anamorphic Flare and Ambient Light benefit greatly from Debanding. Ambient Occlusion can also benefit. You can get away from using less pretty setting but higher performance settings if you deband them afterwards.

I'm not a VFX artist by profession, but it's something I like to study in my spare time. I concur with most of vfxninjaeditor's suggestions. I will disagree with his Post-Antialiasing suggestions, however. You could put it anywhere, really, but I would recommend putting it before most everything else, especially Chromatic Aberration. Rendering Post-AA so late in the pipeline can make it very inaccurate and make the image much blurrier than it needs to be. One could argue it would best done after color-correction, especially for detecting chroma, but I still recommend doing it as early as possible. Pretty much all aliasing occurs before the ReShade shaders have their way with the frame.

A note, for less knowledgeable users: Some effects, like Ambient Occlusion, will look completely awful if done much later in the pipeline. Rendering Depth of Field before Ambient Occlusion would completely ruin the image, for instance.
The administrator has disabled public write access.

Correct Image Pipeline 1 year 3 months ago #7

  • Ioxa
  • Ioxa's Avatar
  • Offline
  • Posts: 267
  • Thank you received: 245
vfxninjaeditor wrote:
Constantine PC wrote:
I actually found putting Deband right before the general shaders was the best for me. Some shaders cause banding and if you have them after deband, they don't get debanded. Notably AO and DOF. I actually reported these a while back in the Framework forum thinking they just broke deband, but JPulowski suggested I move Deband after AO and DOF in the effect ordering and it fixed the issue.

Side note, do you have some recommended settings for deband? The last couple times I tried using it a stopped because it was frustrating me. It was really messing up the quality of the image.

I had this issues with Dead Space 2. The game has so much banding that the deband shader turned everything into a blurry mess, I came up with a pretty good way of getting some of the detail back though if you want to try it.

Open Deband.h and add these lines around line #75 (just before the additional dithering).
float3 luma = dot(col0,float3(0.2126, 0.7152, 0.0722));
float3 chroma = accu.rgb - dot(accu.rgb,float3(0.2126, 0.7152, 0.0722));
accu.rgb = lerp(accu.rgb,luma+chroma,DetailStrength);
Then open CustomFX.cfg and add this line with the rest of the Deband settings.
#define DetailStrength 0.70 //[0.00:1.00] //-
Doing this will put back some of the banding but keeping it between 0.50 and 0.70 seems to be the best balance.
The administrator has disabled public write access.
The following user(s) said Thank You: jas01