CorgiFX: CanvasFog, CanvasMasking and other stuff

  • Posts: 5
3 weeks 4 days ago - 1 day 7 hours ago #1 by originalnicodr

Hi everyone, so I use reshade for some time now, and there were a few things that i was always tought as "hmm that would be cool", so this last week I decided to write them down instead of studying (hehe).

I like using reshade to make a game look better, but also to make screenshots. What i like the most about it is the depth buffer and how you can play with it to make cool stuff. I primarly did these things for myself and shared them with some friends who told me to share it here too, so shout out to the FRAMED folks for helping me test them out. Special shout out to Otis for answering my questions.

The thing is i didnt knew much about writting shaders before this (i still dont really), so i started editing those shaders, copy-pasting stuff and seeing how people do stuff. In the shaders i share today i wrote down in which shader i based the stuff i did or if there was any specific shader that i took some ideas from. Hopefully I am not breaking any rule by sharing them here. If i do please let me know to resolve it.

Also, since its my first time writting shaders, expect to find some "uncommon" things in the code (to put it lightly). Hopefully i can clean them up more and add stuff that i come up with.

So without furtherdo here are the shaders.


If you are familiar with the Adaptive Fog shader then you know how the fog from that shader looks like, if not its basically a color you choose to blend with the depth. Taking that as an initial point i added the option to use gradients in the fog instead of a single color.


- Gradients: The available gradients are linear, radial, strip and diamond, all of them with their own settings.
- Colors with alpha channel: Besides having the option to choose 2 colors in the gradient, you can also change the alpha channel values to play around
- Color samplers: You can select the colors of the gradients to be the same as a pixel on the screen
- Fog Types: The name isnt the best, but it means that you can choose to use the adaptive fog-type or the emphasize fog-type wich isnt a fog technically speaking, but it affects the "surface" that are on the fog range (rather than the whole space in the area). Will let some pictures bellow.
- Blending modes: I added different ways for the fog to blend with the screen. The available blending modes are the following:
  • Normal
  • Multiply
  • Screen
  • Overlay
  • Darken
  • Lighten
  • Color Dodge
  • Color Burn
  • Hard Light
  • Soft Light
  • Difference
  • Exclusion
  • Hue
  • Saturation
  • Color
  • Luminosity
  • Linear burn
  • Linear dodge
  • Vivid light
  • Linearlight
  • Pin light
  • Hardmix
  • Reflect
  • Glow

Last blending modes functions kindly provided by prod80.

Some example images

Radial gradient with screen blending mode

Example of "emphasize-type fog"


While doing the CanvasFog shader i thought that it would be cool to have these gradient stuff alongside the depth buffer to use as a mask, so here it is.

Its has almost the same features as in the CanvasFog shader, not very much to add. Some example images below.

Some example images

Using a LUT shader with "emphasize type fog mask"


So again in one of the "i want this shader to have this option" moments i made some changes to the StageDepth shader. Here are the stuff it can do.

- Scale: Possibility to adjust the scale of the image in both axis individually
- Rotation: This one speaks for itself, you can rotate the image
- Blending Modes: I wrote them for the CanvasFog shader and figured out they can be usefuls if applied to an image
- Depth Control: It already was in the original StageDepth. It uses the depth buffer to decide to show the image or not

Since this last one is more an enhanced shader than a new one i will understand if i have to take it out from the post.

You can find these shaders and more example images on my repo: CorgiFX .

So thats it. Sorry for the low quality images, Monster Hunter World is one of the few game i have installed to test stuff right now.

Things to do:

- Make the shaders interface more user friendly
- Fix the strip gradient dont mantaining the scale while changing the angle
- Fix the diamond gradient to rotate with the modifications done in the x and y axes
- Fix blending modes that clip some values
- Fix the StageDepthPlus shader loading the image with square aspect ratio
- Change the gradient to other color space
- Work on the emphasize-type fog more

Any bug or suggestion you got don't hesitate in hitting me up.

I made these shaders for screenshooting propuses, but maybe you find an use for them in gameplay. Hopefully these shaders will come handy, my intention with this was creating more freedom to make stuff, so cant wait for what you came up with!
The following user(s) said Thank You: crosire, OtisInf, Viper_Joe, Marty, mbah.primbon, SpajdrEX, moyevka, prod80

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

  • Posts: 5
1 day 7 hours ago #2 by originalnicodr
So a little update that i think it deserve its own post:

So I added a new feature in the StageDepthPlus shader. Now you can use a depth map with the image to decide wether or not show the .png. Example below.

Not the best quiality example, but enough to show how it works

And not only that, I have edited the ReShade.fxh file to mix this depth image with the actual depth buffer, so you can use the images depth with other shaders that use the depth buffer. This feature is very experimental, if you want to use it check the readme file in the repo to know how to turn it on.

A little example with CineDOF

As an extra I added some bools to invert the layer horizontally or vertically.


And another shader. I noticed a lot of double exposure shots recently, and I thought shooting and putting the image in a layer shader must be a bummer, so I made a thing for that.

Introducing FreezeShot, align the camera, adjust the depth of the subject you want to take the screenshot from and press the Freeze bool and uala! You can move and adjust it like any layer shader (with the benefit of making the background of the shot invisible for instance). Maybe its better if you just take save the picture in a file, but i think it might come handy for quick experimentation.

It has the same controls as the StageDepthPlus. It can also saves the depth buffer when you freeze the image, so you can make the layer interact with the scene.

Freezing and flipping the image

Frozen image using the saved depth to interact with the scene

This features might not be very useful, but i enjoyed making them. I have also started working on a ColorMask shader, but its still being worked on. If you want to check it out too head over the repo. Link in the original post.

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