Unreal Engine & ENB Lens Flares

  • Elimina
  • Topic Author
More
8 years 5 months ago - 8 years 5 months ago #1 by Elimina Unreal Engine & ENB Lens Flares was created by Elimina
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: 8 years 5 months ago by Elimina.

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

  • Ganossa
More
8 years 5 months ago - 8 years 5 months ago #2 by Ganossa Replied by Ganossa on topic Unreal Engine & ENB Lens Flares
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: 8 years 5 months ago by Ganossa.

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

  • Elimina
  • Topic Author
More
8 years 5 months ago #3 by Elimina Replied by Elimina on topic Unreal Engine & ENB Lens Flares

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

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

  • Marty McFly
More
8 years 5 months ago - 8 years 5 months ago #4 by Marty McFly Replied by Marty McFly on topic Unreal Engine & ENB Lens Flares
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: 8 years 5 months ago by Marty McFly.
The following user(s) said Thank You: Elimina

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

  • Elimina
  • Topic Author
More
8 years 5 months ago - 8 years 5 months ago #5 by Elimina Replied by Elimina on topic Unreal Engine & ENB Lens Flares

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: 8 years 5 months ago by Elimina.

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

  • Marty McFly
More
8 years 5 months ago #6 by Marty McFly Replied by Marty McFly on topic Unreal Engine & ENB Lens Flares
Ah yes I see. I did some experiments this evening,.maybe I can post some screens tomorrow.
The following user(s) said Thank You: Elimina

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

  • Marty McFly
More
8 years 5 months ago - 8 years 5 months ago #7 by Marty McFly Replied by Marty McFly on topic Unreal Engine & ENB Lens Flares
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.

[img
Last edit: 8 years 5 months ago by Marty McFly.
The following user(s) said Thank You: Elimina

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

  • Elimina
  • Topic Author
More
8 years 5 months ago - 8 years 5 months ago #8 by Elimina Replied by Elimina on topic Unreal Engine & ENB Lens Flares

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: 8 years 5 months ago by Elimina.

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

  • Marty McFly
More
8 years 5 months ago - 8 years 5 months ago #9 by Marty McFly Replied by Marty McFly on topic Unreal Engine & ENB Lens Flares
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.

[img
Last edit: 8 years 5 months ago by Marty McFly.
The following user(s) said Thank You: Elimina

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

  • Elimina
  • Topic Author
More
8 years 5 months ago #10 by Elimina Replied by Elimina on topic Unreal Engine & ENB Lens Flares

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

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

  • Marty McFly
More
8 years 5 months ago - 8 years 5 months ago #11 by Marty McFly Replied by Marty McFly on topic Unreal Engine & ENB Lens Flares
Well the input of the lensflare shader is just the regular image, restriced to the very brightest parts, something like this:

[img


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

[img


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: 8 years 5 months ago by Marty McFly.
The following user(s) said Thank You: Ganossa, Elimina, 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.