[REQ]Lens shader to bloom glow shader

share shaders here
  • Author
  • Message
Offline
User avatar
*sensei*
Posts: 341
Joined: 27 Dec 2011, 21:33
Location: Poland, Gdańsk

[REQ]Lens shader to bloom glow shader

Is it possible to rewrite Boris Lens shader to a glow shader? So there wouldn't be any distortion, just bright halo around the bright spot. I only manage to remove color tint from it, so it's not pink anymore, it picks the color from the source of lens (You can check it out in my config, enbbloom.fx). I think it would be more useful and realistic, many new games have somthink like that.
_________________
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: 17549
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ]Lens shader to bloom glow shader

Example photo required.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

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

Re: [REQ]Lens shader to bloom glow shader

I would like to simulate an effect of looking at surface that reflects very bright light (like sun on very sunny day). Somthing like bloom, but not as wide, aplied only to very bright specular. That's why I thought lens shader would be perfect. Without pink tint and distortion it would do the job. These are not the best examples, but You should know what I mean:

Image

Image
_________________
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
*master*
Posts: 119
Joined: 05 Jan 2012, 22:34
Location: France

Re: [REQ]Lens shader to bloom glow shader

Uhhh...
You can achieve that with ENB bloom you know...?

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

Re: [REQ]Lens shader to bloom glow shader

icelaglace wrote:Uhhh...
You can achieve that with ENB bloom you know...?
Not at all, bloom is different, it affects whole screen, while lens (when properly set) affect only very bright spots. Besides, it already looks good, all I need is color tint and distortion removal. The ending effect would be the same like You would now point the crosshair exacly at the light source spot.

I hope that I explained that well.
_________________
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: 17549
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ]Lens shader to bloom glow shader

It's just a bloom. Make source of light more intense or make bloom more contrast before output in final pass of it's shader, before lenz fx computed. Actually lenz image source have contrast applied the same way to achieve more correct look for Deus Ex 3 game, which do not have proper hdr intensities, that's why i did that math for lenz.
This code in enbbloom.fx is applying contrast to lenz (LenzParameters.y value as contrast):

Code: Select all

float maxlenz=max(templenz.x, max(templenz.y, templenz.z));
float tempnor=(maxlenz/(1.0+maxlenz));
tempnor=pow(tempnor, LenzParameters.y);
templenz.xyz*=tempnor;
Insert after bloom*=0.142857; in shader PS_BloomPostPass this:

Code: Select all

float TBloomContrast=2.0;//tweak this
float maxb=max(bloom.x, max(bloom.y, bloom.z));
float tempnorb=(maxb/(1.0+maxb));
tempnorb=pow(tempnorb, TBloomContrast);
bloom.xyz*=tempnorb;
Hope didn't any typo mistakes.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

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

Re: [REQ]Lens shader to bloom glow shader

I thought You will modifie these:

Code: Select all

	//deepness, curvature, inverse size
	const float3 offset[4]=
	{
		float3(1.6, 4.0, 1.0),
		float3(0.7, 0.25, 2.0),
		float3(0.3, 1.5, 0.5),
		float3(-0.5, 1.0, 1.0)
	};
	//color filter per reflection
	const float3 factors[4]=
	{
		float3(1.0, 1.0, 1.0),
		float3(1.0, 1.0, 1.0),
		float3(1.0, 1.0, 1.0),
		float3(1.0, 1.0, 1.0)
	};
That way I removed color tint, but I wasn't sure how to modify the distortion code. Anyway, I apllied Your code into enbbloom but I have to redownload Skyrim so I will reply in couple of hours.
_________________
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
*sensei*
Posts: 341
Joined: 27 Dec 2011, 21:33
Location: Poland, Gdańsk

Re: [REQ]Lens shader to bloom glow shader

Ok, it works and it's pretty awesome. Thank You very much Boris. I'm just having troubles tweaking it properly, it's hard to balance it to make it look realistic but not blinding (I have direct lighting set to 5, so it's quite high). Also, I don't know is it a bug or what but even thought I edited Lens shader to don't have pink/blue tint, it still does. But that's minor problem, not a big deal. I'll upload some screenshots when I finish tweaking my config for it. Once again, thanks a bunch Boris, You are awesome.

EDIT:
float TBloomContrast=2.0;//tweak this - doesn't seems to do anything.
_________________
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: 17549
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: [REQ]Lens shader to bloom glow shader

TBloomContrast - it is contrast for bloom, values must be between 1.0 and 6.0 for your needs, it must work, may be you just don't see this.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

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

Re: [REQ]Lens shader to bloom glow shader

ENBSeries wrote:TBloomContrast - it is contrast for bloom, values must be between 1.0 and 6.0 for your needs, it must work, may be you just don't see this.
Might be.

Hopefuly I managed to tweak it with normal bloom values. You can check the final effect in my config topic or in Skyrim gallery topic.
_________________
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
Post Reply