Enhanced Lenz Flare

  • luluco250
  • Topic Author
More
8 years 2 months ago - 8 years 2 months ago #1 by luluco250 Enhanced Lenz Flare was created by luluco250
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!

I've replaced with this:
Warning: Spoiler!

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!


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!


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: 8 years 2 months ago by luluco250.
The following user(s) said Thank You: jas01

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

  • luluco250
  • Topic Author
More
8 years 2 months ago - 8 years 2 months ago #2 by luluco250 Replied by luluco250 on topic Enhanced Lenz Flare
More screenshots for comparison:
Warning: Spoiler!
Last edit: 8 years 2 months ago by luluco250.

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

  • luluco250
  • Topic Author
More
8 years 2 months ago - 8 years 2 months ago #3 by luluco250 Replied by luluco250 on topic Enhanced Lenz Flare
And an example of the advantage of having a custom amount of halos:
Warning: Spoiler!
Last edit: 8 years 2 months ago by luluco250.
The following user(s) said Thank You: jas01

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

  • jas01
More
8 years 2 months ago - 8 years 2 months ago #4 by jas01 Replied by jas01 on topic Enhanced Lenz Flare
* Off-topic

I can have HBAO+ in this game. Interested?

Warning: Spoiler!
Last edit: 8 years 2 months ago by jas01. Reason: Some stuff

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

  • Marty McFly
More
8 years 2 months ago #5 by Marty McFly Replied by Marty McFly on topic Enhanced Lenz Flare
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.

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

  • luluco250
  • Topic Author
More
8 years 2 months ago #6 by luluco250 Replied by luluco250 on topic Enhanced Lenz Flare

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 following user(s) said Thank You: jas01

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

  • Marty McFly
More
8 years 2 months ago #7 by Marty McFly Replied by Marty McFly on topic Enhanced Lenz Flare
As far as I remember, ENB lensflare does have aspect correction.

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

  • luluco250
  • Topic Author
More
8 years 2 months ago - 8 years 2 months ago #8 by luluco250 Replied by luluco250 on topic Enhanced Lenz Flare
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: 8 years 2 months ago by luluco250.

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

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.