Kabloom! GUI bloom control rev3, now in header file

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

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Great work! Here's a pic with blendmode 4:

Image

Offline
*master*
Posts: 117
Joined: 22 Feb 2013, 03:33

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Thanks for sharing. Do you mean you think you found a bug? If so, what are your settings and are you using a lens effect? If you are, and depending on how you configured it, that looks expected for mode 4.

As a caveat, the blend modes besides mode 1 may not be to everyone's taste, and they may cause weird stuff with certain settings. I put those in for the curious to experiment or for people after a specific unusual look, but if you are in a hurry just stick to mode 1. My favorite is #5 because it's softer and affects overall brightness slightly less, and that one works with a decent range of settings for me, but they all probably need to be configured differently to look pleasant, and mode 1 should be considered the "supported" mode. Screens I took were with mode 1 and other modes may look very different.

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

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Nono its no bug, I'm very satisfied with the result, just wanted to showcase what I could achieve with it, preferring mode 4 over the rest. Btw Mode 5 seems to have no visual change for me, strangely. Even with high bloom amount I see no changes at all.

Offline
*master*
Posts: 117
Joined: 22 Feb 2013, 03:33

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Oh, okay, great! Also you are right about blend mode 5 with high bloom amounts, I forgot to update that comment because EBloomAmount used to work backwards in blend mode 5. I have updated the comment, also made a slight edit to get rid of an artifact I just found.

With high bloom amounts, mode 5 should look close or identical to mode 4, but still different from mode one. With low amounts (1.0 or less) however, there should be a slight intensity reduction and a more gradual dropoff compared to mode 4. If anyone would like to help me confirm that I'm not insane, you can:
  • repaste the code snippets over your current file
  • try these settings in descending order: 1.5, 0.8, 0.95, 1.8, 1.8
  • set EBloomAmount to 0.8
  • find a high contrast scene with bloom on a dark background
  • take comparison screens of modes 4 and 5 with minimal movement between shots.
I would do it myself, but Dark Souls 2 is not so conducive to precise testing like that. There's a lot of extra math in mode 5, and I would be surprised if theres no difference, and I notice a small difference personally.

Edit: these settings are meaningless now, however I have confirmed for myself that there is a very large difference between modes 4 and 5 with most settings.
Last edited by Kermles on 15 Jun 2014, 02:50, edited 2 times in total.

Offline
*blah-blah-blah maniac*
Posts: 552
Joined: 11 Apr 2012, 03:24

Re: Simple bloom control code for use in enbeffect.fx, GUI r

I can't get this to work with my enb. Can you upload your enbeffect.fx file and maybe your preset?
_________________
i5-6600k -- Nvidia GTX 970 -- 16Gb ram @3200mhz

Offline
*master*
Posts: 117
Joined: 22 Feb 2013, 03:33

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Preset I used for screens is the PureENB on dark souls nexus, has a nice "default" kind of look for testing code. I did very few changes to it that I remember, and it uses a default enbeffect.fx I believe.

I think that if this isn't working in your file, it is because there is another part of the file trying to apply bloom already. My file would not make a difference for porting to yours, there will have to be edits done if you want to keep your current enbeffect.fx file, and if you don't then you will have to try to migrate settings and it might not go smoothly if you use a different file than me. I can modify your file for you, but to avoid having to do this for everyone, and since this was intended to be a code release for the DIY-oriented, the problem is that someone else's code is creating and performing operations on the variable "xcolorbloom". It is created again by my code, and while I could just use the existing one, there could be unknown changes made to it before my code touches it and that would cause problems, so it has to be edited either way.

The general way to fix this is to download either notepad++ http://notepad-plus-plus.org/download/v6.6.4.html or, very preferably, notepad++ and NVIDIA FX Composer https://developer.nvidia.com/fx-composer. If using notepad++, click language at the top of the screen, go down to C, then click C# after loading your file. If using FX Composer, start a new empty project, add a new empty HLSL FX file to the project, then overwrite any existing code on the screen with the code from your file. Then for either program hit CTRL+F, search for "xcolorbloom", and then put the character combination enclosed here in parentheses (/*) in front of the line containing the first mention of it, then the character combination (*/) at the end of the line with the last mention of it. This turns it into a comment, text that will no longer be run as code. If you downloaded FX composer, hit the "Compile" button to see if it runs properly. If it doesn't then it will say why, and it will show you the line that is causing a problem. Double click it and see if you know what is going wrong. If you did not download FX Composer, then save your file and load your game with ENB on, and see if the effects are getting applied still. If so, it is working, if not, you will never know why, so go download FX Composer like I told you to if you still want it to work.

These are the lines that should be commented out on a stock enbeffect.fx file:

Code: Select all

float4 xcolorbloom=tex2D(_s3, _v0.xy);

	xcolorbloom.xyz=xcolorbloom-r1;
	xcolorbloom.xyz=max(xcolorbloom, 0.0);
	r1.xyz+=xcolorbloom*EBloomAmount;
On a non-stock file, they may look different, and they may need extra steps. If you cannot figure any of this out, ask me and I will try to do it if I get the time, or if I'm lucky and I've done this right, someone with an audience might put this in a premade enbeffect file for others to use. I would rather let someone else do that who is a little better for it than me if they think it's worth it, if not then probably not much is lost without this code and it will just be headaches for me and the people who use it, so I'll wait to pass that benchmark this time.
Last edited by Kermles on 12 Jun 2014, 09:58, edited 1 time in total.

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

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Wait, does that mean that there's a simpler way than windows texteditor? Damn.

Offline
*master*
Posts: 117
Joined: 22 Feb 2013, 03:33

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Yeah, I was pretty happy to find it. It's not being actively developed anymore, so enjoy while they are still hosting it. It has some useful effect samples too, really handy tool. Now they've migrated to some kind of Visual Studio extension that's supposed to be fancier I think, but that's far more work than I'm willing to go through for an environment to test stuff like this.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1938
Joined: 05 Mar 2012, 02:08

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Hi there Kermles and welcome back to the modding seat :)
Looks to be a nice new addition from you and I will be sure to try it out and see how it works.



Marty McFly;
Notepad++ is far better than windows notepad and so is FX Composer as well.
Some tips on setting Notepad++ up for HLSL environment - http://pastebin.com/Sx1E8uV5

Offline
*sensei*
Posts: 372
Joined: 28 Jul 2013, 23:26

Re: Simple bloom control code for use in enbeffect.fx, GUI r

Nice, but doesn't this whole thing depend a great deal on what is inside enbbloom.fx ... I assume this is coded towards using the default bloom fx file...

In that case... here more mix modes and stuff for your joy :p

Code: Select all

//Screen blend
color.xyz = 1.0f - ( 1.0f - saturate( color.xyz )) * ( 1.0f - saturate( xcolorbloom.xyz * EBloomAmount ));

Code: Select all

//Bloom texture manipulation using Levels (like Photoshop levels control), add own GUI
//inBlack range 0.0 - 1.0, default 0.0
//inGamma range 0.0 - 10.0, default 1.0
//inWhite range 0.0 - 1.0, default 1.0
//outBlack range 0.0 - 1.0, default 0.0
//outWhite range 0.0 - 1.0, default 1.0
//EInteriorFactor disabled in DS2

float inBlack = lerp( inBlackN, inBlackD, ENightDayFactor ); 
float inGamma = lerp( inGammaN, inGammaD, ENightDayFactor ); 
float inWhite = lerp( inWhiteN, inWhiteD, ENightDayFactor ); 
float outBlack = lerp( outBlackN, outBlackD, ENightDayFactor ); 
float outWhite = lerp( outWhiteN, outWhiteD, ENightDayFactor ); 

xcolorbloom.xyz = saturate( xcolorbloom.xyz );
xcolorbloom.xyz = pow( max( xcolorbloom.xyz - inBlack , 0.0f ) / max( inWhite - inBlack, 0.0001f ), inGamma ) * max( outWhite - outBlack, 0.0001f ) + outBlack;

//Using add mode here to add bloom to color... can put anything else here.
color.xyz += ( xcolorbloom.xyz * EBloomAmount );
There's some more advanced mix modes, ie combining Photoshop "Soft Light" blend mode (contrast) with "Screen" blend mode or "Add" mode, or any fantastic code soup of them.
Post Reply