Gaussian Blur / Bloom / Unsharpmask

More
6 years 10 months ago - 6 years 10 months ago #61 by K-putt
Replied by K-putt on topic Gaussian Blur / Bloom / Unsharpmask
Could you write the shader so that it's tweakable via SweetFX's settings.txt?

Also, there is no way to disable the shader completely anymore. Except the Toggle. =(
There used to be "#define USE_GAUSS 1". Not sure if that actually worked though.
Last edit: 6 years 10 months ago by K-putt.

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

More
6 years 10 months ago #62 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask

Could you write the shader so that it's tweakable via SweetFX's settings.txt?

Also, there is no way to disable the shader completely anymore. Except the Toggle. =(
There used to be "#define USE_GAUSS 1". Not sure if that actually worked though.


I could... but it would require packaging this with a custom SweetFX_settings.txt. I was thinking of making a .txt for all these settings. I could make it so it would be easy to cut and paste them into SweetFX_settings.txt and as long as GAUSS.fx was hooked into SweetFX after the settings section it will use all the definitions in there (at least I think it will, haven't actually tried it). I'm gonna try to re-write this over the weekend and get rid of some stuff (basically my attempts to make up for the parts I can't figure out), when I do that I'll take all the definitions out of the .fx file and put em in a .txt file.

That USE_GAUSS setting was in the one I combined with SweetFX.fx. It worked, it just kept the file from using any of the GAUSS passes. When I move the definitions to the .txt. file I'll put it back in.
The following user(s) said Thank You: K-putt

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

More
6 years 10 months ago #63 by Wicked Sick
Replied by Wicked Sick on topic Gaussian Blur / Bloom / Unsharpmask
Ioxa, for quite some time, I am getting this error. I never brought it to you because I thought I was doing something wrong. But putting the shame aside, I have to ask: What should I do?

i.imgur.com/y718FBd.jpg

I have renamed the file to just "gauss.fx"

i.imgur.com/LkRsF4G.png

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

More
6 years 10 months ago #64 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
Thats the GAUSS4SweetFX.fx file, it's fine being renamed but when you put the #include line in SweetFX.fx it needs to be below the vertex shader, around line 190. It should look something like this,
/*----------------------.
  | ::  Vertex Shader  :: |
  '----------------------*/

void FullscreenTriangle(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD0)
{
	// Basic Buffer/Layout-less fullscreen triangle vertex shader - used for several of the passes.
	texcoord.x = (id == 2) ? 2.0 : 0.0;
	texcoord.y = (id == 1) ? 2.0 : 0.0;
	position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}


#include"GAUSS4SweetFX.fx"
  /*-----------------------.
  | ::     Cartoon      :: |
  '-----------------------*/

#if (USE_CARTOON == 1)
  // Cartoon
  #include "SweetFX\Shaders\Cartoon.h"
  #include "SweetFX\Shaders\CartoonWrap.h"
#endif

Or you can just put the #include line at the very bottom of the file, only difference is it will run after SweetFX instead of before it. Just make sure whatever is in quotes matches the file name.

Hopefully that will clear up the other error too, otherwise I may have made a typo.
The following user(s) said Thank You: Wicked Sick

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

More
6 years 10 months ago - 6 years 10 months ago #65 by Wicked Sick
Replied by Wicked Sick on topic Gaussian Blur / Bloom / Unsharpmask
Thank, Ioxa! It did the trick. Just inserted the line after the Vertex Shader section and loaded without errors ^_^ Thanks xD

EDIT:

Effect 6 reminds me of this!!!

www.emuparadise.me/fup/up/52771-Silent_Hill_(E)-1.jpg

XDDD


EDIT 2:

>//No Bloom for now.

Made me die a bit inside xD
Last edit: 6 years 10 months ago by Wicked Sick.

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

More
6 years 10 months ago #66 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
No problem, glad that worked! Effect 6 is the inverted image used to make the contrast mask, I was using that when making adjustments. If you add some color saturation to it it kinda looks like a negative.
I've been working on the contrast enhancement quite a bit and I think I've got it set pretty neutral now. The Lift setting in the one I uploaded may be a little low so if the shadows are too dark try raising it a bit, maybe around 0.600 for all three.

Haha, sorry about that, I gutted bloom to make the contrast mask. AddBloom might still work... I didn't really test it though. I've got bloom working again now though, I should have the updated files ready this weekend.

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

More
6 years 10 months ago #67 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
I updated these the other day but came across a couple errors so I fixed them and reuploaded.

The stand-alone GAUSS.fx seems to be much more stable now, may have been a problem with where the #include line was being placed. I changed the install instructions and bundled them with the download. Also updated the others in case there are still issues with this.

Moved the settings from the .fx file to a text file. Also cleaned them up a bit, a little easier to adjust now.

Still trying to figure out how the rest of the settings from the original worked (GaussSigma, GaussQuality, etc), if anyone has any ideas let me know.

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

More
6 years 10 months ago #68 by JPulowski
Replied by JPulowski on topic Gaussian Blur / Bloom / Unsharpmask

Still trying to figure out how the rest of the settings from the original worked (GaussSigma, GaussQuality, etc), if anyone has any ideas let me know.

When I was fiddling with the code I also saw those variables. I think those variables might be somehow hardcoded into the injector itself. It is better to ask Boulotaur2024, since he is the original author of the shader.

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

More
6 years 10 months ago #69 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask

When I was fiddling with the code I also saw those variables. I think those variables might be somehow hardcoded into the injector itself. It is better to ask Boulotaur2024, since he is the original author of the shader.


I think you're right about them being hardcoded, looking through the dx9 and the dx11 files I don't see them mentioned anywhere. Do you know how I could contact Boultaur?

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

More
6 years 10 months ago - 6 years 10 months ago #70 by crosire
Replied by crosire on topic Gaussian Blur / Bloom / Unsharpmask
They are indeed hardcoded. This is what they do in Boulotaurs injector, gathered from its source code:

GaussQuality:
Sets the amount of blurring iterations (how often the horizontal and vertical blurring pass is repeated). It's pretty much what you already implemented via GaussRadius. Values:
  • 0 => 1 iteration, Low
  • 1 => 3 iterations, Medium
  • 2 => 9 iterations, High
  • 3 => 12 iterations, Ultra
  • 4 => 96 iterations, OverKill
GaussSigma:
Affects scaling of the affect. Basically changes the rendertarget sizes. This is what he does in C++ code translated to equivalent ReShade shader code.
#if GaussEffect == 3 // Bloom
	#define GAUSS_WIDTH exp2(ceil(log2(BUFFER_WIDTH / max(1.0, GaussSigma * 4))))
	#define GAUSS_HEIGHT exp2(ceil(log2(BUFFER_HEIGHT / max(1.0, GaussSigma * 4))))
	#define PIXEL_SIZE float2(1.0 / GAUSS_WIDTH, 1.0 / GAUSS_HEIGHT)
#elif GaussEffect == 2 // Sharpen
	#define GAUSS_WIDTH BUFFER_WIDTH
	#define GAUSS_HEIGHT BUFFER_HEIGHT
	#define PIXEL_SIZE float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
#else // Blur
	#define GAUSS_WIDTH exp2(ceil(log2(BUFFER_WIDTH / max(1.0, GaussSigma))))
	#define GAUSS_HEIGHT exp2(ceil(log2(BUFFER_HEIGHT / max(1.0, GaussSigma))))
	#define PIXEL_SIZE float2(1.0 / GAUSS_WIDTH, 1.0 / GAUSS_HEIGHT)
#endif

...

texture HblurTex2D { Width = GAUSS_WIDTH; Height = GAUSS_HEIGHT; Format = R8G8B8A8; };
texture VblurTex2D { Width = GAUSS_WIDTH; Height = GAUSS_HEIGHT; Format = R8G8B8A8; };
Last edit: 6 years 10 months ago by crosire.
The following user(s) said Thank You: Ioxa

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

More
6 years 10 months ago #71 by Sh1nRa358
Replied by Sh1nRa358 on topic Gaussian Blur / Bloom / Unsharpmask
So which setting contains that glow? Seems to be gone again.

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

More
6 years 10 months ago - 6 years 10 months ago #72 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
Awesome! Thanks Crosire! This clears up another question I had about how sharpen would be affected by the different sigma widths, looks like it just ignores them. Also, 96 iterations? Does that mean it's doing 192 blur passes? I was thinking 5 was a lot.
EDIT: Am I reading the code right? is it basically saying GAUSS_WIDTH is equal to 2^logbase-2(BUFFER_WIDTH / GaussSigma * 4)?
I'm getting an error that says CreateTexture2D failed with -2147024809!
So I simplified the math down to BUFFER_WIDTH/GaussSigma * 4 and that works but it won't return a 1 when GaussSigma = 0. I tried using just the max function but that threw up the same error. I guess as long as I'm reading the math right I should be able to figure out a way to do it.

@Sh1nRa358 I think that glow comes from the Bloom Intensity setting I added as an attempt to replace the bloom exposure from the original. I removed it because it just wasnt the same. But even with that back in the color is still off... You're probably better off using the one I uploaded for you for now until I can figure out why they look so different.
Last edit: 6 years 10 months ago by Ioxa.

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

More
6 years 10 months ago - 6 years 10 months ago #73 by Wicked Sick
Replied by Wicked Sick on topic Gaussian Blur / Bloom / Unsharpmask
Are you going to update it, Ioxa?


EDIT:

oh, never mind, you already did xD

EDIT 2:

Ioxa, have you tried gauss with the preview 7?

forums.guru3d.com/showpost.php?p=5025393&postcount=542
Last edit: 6 years 10 months ago by Wicked Sick.

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

More
6 years 10 months ago #74 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
Oh yeah, I probably should have mentioned I updated it.

Yeah, i was using it with preview 7, I didn't run into any issues, did you? The install instructions will need to be updated but as long as you place the #include line below the vertex shader it should be fine.

Really I don't see why the location of the #include line should affect anything accept for when GAUSS.fx runs but for some reason placing it at the bottom of the file was causing crashes with SweetFX, it worked fine with ME though. When I get a chance I'll test it again with preview 7 and see if it still crashes.

Also, I noticed my video cards getting pegged at 99% a few times while using this, alt-tabbing out of the game a couple times fixed it.

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

More
6 years 10 months ago #75 by Wicked Sick
Replied by Wicked Sick on topic Gaussian Blur / Bloom / Unsharpmask
Actually, Ioxa, I am having trouble. The gaus simply don't work for me. I am sorry to bother you every time. I am putting a screenshot here so you can see what I have done. I guess it is right, no?

i.imgur.com/Uitv7Qa.png

I am using the ReSahde 0.15.0.716.

I feel dumb, I can't see what I have done wrong. I also haven't noticed the VGA usage while playing with gauss. Will have to check, but the game play was normal so far.

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

More
6 years 10 months ago - 6 years 10 months ago #76 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
No worries. If something isn't working there is a good chance I've made a mistake somewhere. Looking at your picture everything looks right...

Does SweetFX work when GAUSS.fx is hooked to it? You could try cutting the settings out of the GAUSS_settings.txt and pasting them into SweetFX_settings.txt that way it will update changes on the fly. The new version of ReShade will only look for changes to SweetFX_settings.txt before it recompiles. Just make sure GAUSS_settings.txt is empty, deleted, or renamed otherwise you'll get errors from the definitions being in both files.
Last edit: 6 years 10 months ago by Ioxa.

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

More
6 years 10 months ago - 6 years 10 months ago #77 by Wicked Sick
Replied by Wicked Sick on topic Gaussian Blur / Bloom / Unsharpmask
I was going to mention that thing about the TXT reading, but I only said the version of ReSahde.

SFX loads ok after following the instruction steps. I will try doing that you said now.

EDIT:

Pasting the stuff after the Custom Settings section didn't work.
Last edit: 6 years 10 months ago by Wicked Sick.

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

More
6 years 10 months ago #78 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
Strange... I really don't know why it won't work. Having the #include line in there should do something, even it just causes an error or a crash. Have you tried it with any other games?

You could try renaming GAUSS.fx to ReShade.fx just to see if it at least works. You could also try moving the #include line to the very bottom of SweetFX.fx to see if it causes the game to crash, then you will know it's seeing the include line. I don't own Witcher 2 so I can't do any testing of my own.

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

More
6 years 10 months ago #79 by Wicked Sick
Replied by Wicked Sick on topic Gaussian Blur / Bloom / Unsharpmask
With Sleeping Dogs, x64, it did work by not using GAUSS_settings.txt, but by pasting it into the sweetfx settings file.

Effect 4 has changed? Isn't like Silent Hill 1 cd cover anymore? xD It blurs all the screen: i.imgur.com/cM34JJf.png

And effect 1 gave me this error: i.imgur.com/o0EvjrY.png

I have changed only which effect to be used, not any of their values.

Tried the same stuff with the Witcher, that Worked with Sleeping Dogs, only change the dll, of course, but the same thing as before.
The following user(s) said Thank You: Ioxa

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

More
6 years 10 months ago #80 by Ioxa
Replied by Ioxa on topic Gaussian Blur / Bloom / Unsharpmask
Doh, I know what that error is from. It's because I just copied the sharpening code for the add sharpening option. If you set addSharp to 0 it should clear that up. Yeah, option 4 is just the blurred image for now, I may change that. It's not the negative image anymore because I realized unsharpmask already did what I was trying to do with that, wasted a lot of time on that, haha.

Maybe the problem is with 32bit games, I'll have to test that out. Did GAUSS.fx work with Witcher 2 when renaming it to ReShade.fx? If that works you can try adding SweetFX to that and running both that way. It would look something like this,

#include "Sweet.fx"
#include "SweetFX/GAUSS_settings.txt" //load Gaussian Blur settings
#if USE_GAUSS == 1
The following user(s) said Thank You: riccetto80

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