Welcome, Guest.
Username: Password: Remember me

TOPIC: Unreal Engine & ENB Lens Flares

Unreal Engine & ENB Lens Flares 1 year 1 week ago #1

  • Elimina
  • Elimina's Avatar
  • Offline
  • ΞLIMINΛ
  • Posts: 329
  • Thank you received: 356
So, I have come up with two ideas. One of them could easily be done while the other is possible, but it would take a lot of work.

Lets start with the easy idea:

ENB Lens flare (Alternative McFX lens flare):

So, I do realize that we already have a similar lens flare inside of the framework, but I am very interested if the flare could also double for the common lens flare used in ENB. I'm pretty sure they are very similar in code, since the both work the same way but with different colors and different amounts of flare shapes. I was wondering if it would be possible for this to be imported into ReShade and used as a optional setting in the 'lens flare' effect (similar to how you have DoF & AO set up). Even if that is too difficult, it could also just be a separate effect that could be used along side the lens flare already provided by McFX. Here is a link to the code:
enbseries.enbdev.com/forum/viewtopic.php?f=7&t=2311

ENB Lens flare (Images by Marty McFly):



McFX Lens Flare (picture by Marty McFly):



Unreal Engine Lens Flare:

My other suggestion is similar to Advanced DoF except in the form of a lens flare. This has already been done in Unreal Engine 4, but I was wondering if ReShade would be able to have a similar lens flare. In UE 4, you are able to select the amount of vertices that each lens shape has, use a custom texture for the shapes, stretch the shapes, and set their color. I think that this would be the ultimate lens flare similar to ADoF.

Examples (Again, not my images):

Last Edit: 1 year 1 week ago by Elimina.
The administrator has disabled public write access.

Unreal Engine & ENB Lens Flares 1 year 1 week ago #2

  • Ganossa
  • Ganossa's Avatar
  • Offline
  • 최정장군
  • Posts: 790
  • Thank you received: 838
Just to avoid any confusion, the bloom shader is put together by Marty (it is an ME port) :) It made it into the GemFX suite when we thought about meaningful domains. (will be less confusing in the next release cause we are planning to change suite purposes)

Sorry for the off-topic ;)
Last Edit: 1 year 1 week ago by Ganossa.
The administrator has disabled public write access.

Unreal Engine & ENB Lens Flares 1 year 1 week ago #3

  • Elimina
  • Elimina's Avatar
  • Offline
  • ΞLIMINΛ
  • Posts: 329
  • Thank you received: 356
Ganossa wrote:
Just to avoid any confusion, the bloom shader is put together by Marty (it is an ME port) :) It made it into the GemFX suite when we thought about meaningful domains. (will be less confusing in the next release cause we are planning to change suite purposes)

Sorry for the off-topic ;)

yeah, I had it as a McFX port but then I was looking through the files to see how similar the codes were and I noticed that they were in the GemFX files, so I switched the names :P Ill probably switch them back to clear up any confusions people might have
The administrator has disabled public write access.

Unreal Engine & ENB Lens Flares 1 year 1 week ago #4

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
The first two pics of the enb lens flare are also from me :p

About polygonal lens flare, my polygon shaped blur I use in the ADOF can surely be used for that, I just need to rip out the unnecessary code parts that are for depth of field only. On weekend I might be able to do some experiments. The only problem I see is the size of the lens flare emitter. If it's small, then everything is fine but if it's large, the polygonal shape gets less visible.
Last Edit: 1 year 1 week ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: Elimina

Unreal Engine & ENB Lens Flares 1 year 1 week ago #5

  • Elimina
  • Elimina's Avatar
  • Offline
  • ΞLIMINΛ
  • Posts: 329
  • Thank you received: 356
Marty McFly wrote:
The first two pics of the enb lens flare are also from me :p

About polygonal lens flare, my polygon shaped blur I use in the ADOF can surely be used for that, I just need to rip out the unnecessary code parts that are for depth of field only. On weekend I might be able to do some experiments. The only problem I see is the size of the lens flare emitter. If it's small, then everything is fine but if it's large, the polygonal shape gets less visible.

I don't think that is a problem, because even in UE 4, if there is a large light source, it will just create more lens flare and blend them together which slightly deforms the shape still. It does seem to limit the space between each lens flare formed which slightly preserves the shape in some instances.

Example
Last Edit: 1 year 1 week ago by Elimina.
The administrator has disabled public write access.

Unreal Engine & ENB Lens Flares 1 year 1 week ago #6

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
Ah yes I see. I did some experiments this evening,.maybe I can post some screens tomorrow.
The administrator has disabled public write access.
The following user(s) said Thank You: Elimina

Unreal Engine & ENB Lens Flares 1 year 1 week ago #7

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
Bump.

Something along the lines of this here, Elimina? I know it's blurrier than the UE4 lensflare but this is always the problems with bloom or similiar effects. Make them sharp and you need a high resolution input with an intense blur that must run at fullscreen resolution, making it slow as fuck. Or you run it in lower resolution and use lower resolution input and it runs with a fraction of the fps cost but then it's blurry. Remember that this runs my Bokeh blur shader once for every flare so 4 flares makes the DOF blur run 4 times. In fullscreen input and processing this runs at 15 fps for me but with the current setup, hardly any fps cost.

Only problem I now have to sort out is that each flare needs too many control values, I cannot store them in one float4 variable per flare. It needs offset, size, vertices, quality and possibly curvature like the ENB lensflare. Maybe I can link quality to blur radius directly but then I have to take the controls over blur etc out of the hand of the user.

Last Edit: 1 year 1 week ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: Elimina

Unreal Engine & ENB Lens Flares 1 year 1 week ago #8

  • Elimina
  • Elimina's Avatar
  • Offline
  • ΞLIMINΛ
  • Posts: 329
  • Thank you received: 356
Marty McFly wrote:
Bump.

Something along the lines of this here, Elimina? I know it's blurrier than the UE4 lensflare but this is always the problems with bloom or similiar effects. Make them sharp and you need a high resolution input with an intense blur that must run at fullscreen resolution, making it slow as fuck. Or you run it in lower resolution and use lower resolution input and it runs with a fraction of the fps cost but then it's blurry. Remember that this runs my Bokeh blur shader once for every flare so 4 flares makes the DOF blur run 4 times. In fullscreen input and processing this runs at 15 fps for me but with the current setup, hardly any fps cost.

Only problem I now have to sort out is that each flare needs too many control values, I cannot store them in one float4 variable per flare. It needs offset, size, vertices, quality and possibly curvature like the ENB lensflare. Maybe I can link quality to blur radius directly but then I have to take the controls over blur etc out of the hand of the user.

It looks pretty damn awesome, not going to lie. I wasn't expecting a usable solution so quickly, but I guess you work fast :P
I know you have a lot of obstacles to get over still, but so far it looks fantastic
Last Edit: 1 year 1 week ago by Elimina.
The administrator has disabled public write access.

Unreal Engine & ENB Lens Flares 1 year 1 week ago #9

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
Thanks for you kind words. Yes, I work fast - if I work at all :p And it was mostly recycling old code I had on hold (I have a huge collection of random stuff I wrote over time but never used, pixel vignette, voronoise crystallize shader, DLAA and more, YACA used to be one them).
So I linked quality to blur and found another performance increase so here a picture with more offsets, it's kinda hard without a GUI to setup values that fit well together. Also with some lens dirt on top. Can't take screens of GTASA sun because it casts its own lensflare which is annoying.

Last Edit: 1 year 1 week ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: Elimina

Unreal Engine & ENB Lens Flares 1 year 1 week ago #10

  • Elimina
  • Elimina's Avatar
  • Offline
  • ΞLIMINΛ
  • Posts: 329
  • Thank you received: 356
Marty McFly wrote:
I was wondering how the coloration works on the lens flare. How exactly can users change the coloration when it comes to adding more shapes to the lens flare. It looks like you made some shapes have a blue tint, while other parts have white, red, and green coloration. Are the colors going to be predetermined or is the color that a user chooses for the lens flare going to have a variation of that color displayed on separate parts of the lens flare? just curious :P
The administrator has disabled public write access.

Unreal Engine & ENB Lens Flares 1 year 1 week ago #11

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
Well the input of the lensflare shader is just the regular image, restriced to the very brightest parts, something like this:



Now this input is scaled around the image center (negative scale factor flips it vertically and horizontally), tinted and added up:



So each of the scaled image copies can be tinted how the user wants it. My polygonal lensflare shader here just blurs the input with a polygonal shape before summing it up. Right now, my lensflare shader runs 15 times, with these directives per image copy:
RGB color of each copy
float3(0.5, 0.5, 0),
float3(0, 0.5, 0),
float3(0, 0, 0.5),
float3(0.2, 0.25, 0),
float3(0.15, 0, 0.0),
float3(0, 0.0, 0.15),
float3(0.2, 0.2, 0.05),
float3(0.25, 0.25, 0.25),
float3(1, 1, 1),
float3(0, 0.25, 1),
float3(0, 0,0.25),
float3(0, 0, 1),
float3(2, 2, 2),
float3(1, 1, 0.25),
float3(0, 0, 0)

factors for blur algorithm( scale factor, polygon blur size, vertices, quality)
float4(3.3, 10, 6, 3),
float4(-1.42, 50, 6, 5),
float4(-3, 50, 6, 5),
float4(-1, 80, 6, 6),
float4(0.85, 10, 6, 4),
float4(1.3, 10, 6, 4),
float4(-2.0, 30, 6, 5),
float4(-0.81, 30, 6, 5),
float4(-2, 10, 6, 3),
float4(1.3, 12, 6, 4),
float4(-1.5, 35, 6, 4),
float4(4, 20, 6, 4),
float4(10, 50, 6, 5),
float4(-2.15, 6, 6, 3),
float4(-1.4, 20, 6, 5)

So one of these copies runs with let's say blue as input, so I add float3(0.0,0.0,1.0) and I want it to be a rather large pentagon exactly on the opposite side of the screen center than the light source, I use float4(-1.0 [to flip it], 80 [pixels], 5 [pentagon], 6 [80 pixels radius needs such a quality or it will get artifacts]). "Simple" as that.
Last Edit: 1 year 1 week ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: Ganossa, Elimina, luluco250