Welcome, Guest.
Username: Password: Remember me

TOPIC: Enhanced Lenz Flare

Enhanced Lenz Flare 9 months 3 weeks ago #1

  • luluco250
  • luluco250's Avatar
  • Offline
  • Posts: 80
  • Thank you received: 51
tl;dr I modified the lenz flare (in Bloom.h) so it supports custom distances (not limited to the center of the screen anymore) and custom amount of halos.

I was looking for a way to modify the lenz flare effect, so I ended up modifying it on my own.
In the part where there's:
Warning: Spoiler! [ Click to expand ]

I've replaced with this:
Warning: Spoiler! [ Click to expand ]

Now the code can change the distance based on fLenzDistance (optionally, based on iLenzUseCustomDistance) and also can render less halos based on iLenzFactors, instead of only 19.

My objective with this was that I was experimenting with Witcher 1 and was looking for a a good-looking but subtle lens flare, since the game doesn't have depth buffer access outside of cutscenes I had to be a bit creative so it didn't look too overdone.

Here's how what I modified in GemFX.cfg:
Warning: Spoiler! [ Click to expand ]


I was using a mix of Ambient Lighting (plus fine-tuned adaptation and lens from it, replaced the lens texture with the generic light sprite) and chapman lens, but I wasn't too fond of the look chapman lens had.
I was tempted to try using lenz instead but I knew it was normally restricted to the center of the screen, and had very little customization options, so I studied the code a bit and came up with this solution. Hopefully it's clean enough, I have really no experience with shaders, only programming in general so this isn't exactly my expertise.

This is the final look I got and am quite satisfied with it:
Warning: Spoiler! [ Click to expand ]


Any comments and/or suggestions are much appreciated, as I said before this is my first time doing something like this so tell me if I did anything wrong.
Last Edit: 9 months 3 weeks ago by luluco250.
The administrator has disabled public write access.
The following user(s) said Thank You: jas01

Enhanced Lenz Flare 9 months 3 weeks ago #2

  • luluco250
  • luluco250's Avatar
  • Offline
  • Posts: 80
  • Thank you received: 51
More screenshots for comparison:
Warning: Spoiler! [ Click to expand ]
Last Edit: 9 months 3 weeks ago by luluco250.
The administrator has disabled public write access.

Enhanced Lenz Flare 9 months 3 weeks ago #3

  • luluco250
  • luluco250's Avatar
  • Offline
  • Posts: 80
  • Thank you received: 51
And an example of the advantage of having a custom amount of halos:
Warning: Spoiler! [ Click to expand ]
Last Edit: 9 months 3 weeks ago by luluco250.
The administrator has disabled public write access.
The following user(s) said Thank You: jas01

Enhanced Lenz Flare 9 months 3 weeks ago #4

  • jas01
  • jas01's Avatar
  • Offline
  • Posts: 79
  • Thank you received: 10
* Off-topic

I can have HBAO+ in this game. Interested?

Warning: Spoiler! [ Click to expand ]
Last Edit: 9 months 3 weeks ago by jas01. Reason: Some stuff
The administrator has disabled public write access.

Enhanced Lenz Flare 9 months 3 weeks ago #5

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 610
  • Thank you received: 720
Uhm...the offsets and their count are intended to be freely selectable for the user, why making their control values global? The arrays for the lensflares currently hold 19 value pairs and the loop iterates 19 times for these 19 flares. You are free to modify those arrays and the loop count, the way the lensflare looks like is by no means fixed. You can replicate almost any lensflare with it. Besides, the lens flare scale is already controlled by one of the lensflare factors. Control values which are being stored by the lffactor array is deepness, curvature and inverse size. What you changed is the deepness. And why changing the aspect correction? Now the lensflare wideness is depending on the aspect ratio.
The administrator has disabled public write access.

Enhanced Lenz Flare 9 months 2 weeks ago #6

  • luluco250
  • luluco250's Avatar
  • Offline
  • Posts: 80
  • Thank you received: 51
Uhm...the offsets and their count are intended to be freely selectable for the user, why making their control values global? The arrays for the lensflares currently hold 19 value pairs and the loop iterates 19 times for these 19 flares. You are free to modify those arrays and the loop count, the way the lensflare looks like is by no means fixed. You can replicate almost any lensflare with it. Besides, the lens flare scale is already controlled by one of the lensflare factors. Control values which are being stored by the lffactor array is deepness, curvature and inverse size. What you changed is the deepness. And why changing the aspect correction? Now the lensflare wideness is depending on the aspect ratio.

As I already explained shaders isn't my area of expertise so forgive me beforehand for lack of knowledge.
What I wanted to do originally was simply have a bit more customization on the lenz effect. I have also noticed that the actual ENB lenz flare isn't restricted to the aspect ratio, which is fine by me (and is what I prefer), neither is ambient light's lens effect nor chapman lens, so I really have no idea why lenz had this restriction.

Now I do understand what you mean with the 19 flares but tl;dr I was lazy and just happened to find a quick solution, if you can help me understand what exactly I got wrong it'd be better (given what my idea was originally). But too specific terms are kinda hard to comprehend, I'm sure you can understand.
* Off-topic

I can have HBAO+ in this game. Interested?

Nice but given that this game isn't exactly well optimized I fear too much FPS loss, I find it looks fine enough as it is right now (the only problem of this game is the models and animations for me), but thanks I'll be sure to check it out!
The administrator has disabled public write access.
The following user(s) said Thank You: jas01

Enhanced Lenz Flare 9 months 2 weeks ago #7

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 610
  • Thank you received: 720
As far as I remember, ENB lensflare does have aspect correction.
The administrator has disabled public write access.

Enhanced Lenz Flare 9 months 2 weeks ago #8

  • luluco250
  • luluco250's Avatar
  • Offline
  • Posts: 80
  • Thank you received: 51
I remember messing around with a Fallout ENB and the lenz effect covered the whole screen, with wide aspect ratio.
Perhaps a better solution could be to scale up the shader to keep the 1x1 aspect ratio but cover the whole screen?

Regardless, I like the way it looks.

I'll do some experimenting and see if I can thoroughly enhance it.
Last Edit: 9 months 2 weeks ago by luluco250.
The administrator has disabled public write access.