Author Topic: New Lensflares  (Read 6981 times)

0 Members and 1 Guest are viewing this topic.

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
One thing I've been working on recently is Lensflares. The way we did them previously was rather simple: You could define a couple of lensflare bitmaps for stars, and if that star was in frame, we rendered those bitmaps in vaguely appropriate places.

Now, that is certainly sufficient for some light lensflare action, but sometimes, you do want a bit more. So I looked around, and found this post by a gentleman called John Chapman, who presented a relatively easy to use (and performant) solution to generate flares using a shader. I then integrated that into the engine, and voila:


Pay particular attention to the way subspace vortices look now.

Now, this isn't going to go into the nightlies just yet. Before that happens, I want to give mission designers some control over the parameters the shader uses, as well as the ability to add a dirt mask. But once that's done (and it shouldn't take too long), this will find its way into a nightly near you.

IF you want to check this out for yourself, the branch can be found here: https://github.com/The-E/fs2open.github.com/tree/jjabrams_ogl3

Do note that in order to work, you need this texture in data/effects.
« Last Edit: August 26, 2016, 06:41:15 pm by The E »
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

  

Offline Luis Dias

  • 211
hmm. they behave weirdly. And I am yet to understand its logic... does it do explosions? Is every bright pixel on the screen taking to account? Or just subspace vortices? I notice the star in that video never renders a lensflare...
Regardless, I don't quite like it. Definitely not JJ standard :D

 
Anamorphic bloom would really help the JJ look along, I guess.

e: reference material: this is a raytrace simulation of the lens flare in a normal camera:



This is an anamorphic lens flare, presumably simulated, which is what you can see everywhere in Abrams Trek:



vs. the prototype FSO lens flares, it has that really big horizontal bloom where the light is (which, for me at least, is the thing I first think of as 'lens flare') and its ghosts don't really have any chromatic aberration.
« Last Edit: August 26, 2016, 08:02:26 pm by Phantom Hoover »
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
I kinda agree, which is why I am looking into methods for generating more physically correct flares.

Is every bright pixel on the screen taking to account? Or just subspace vortices? I notice the star in that video never renders a lensflare...

For a complete breakdown of how this works, read the article I linked to; short answer: Yes, every bright pixel gets taken into account.

Suns may not count for this at the moment, because rendering things is weird :P But I am looking into fixing this (and tweaking the overall effect to look better).
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Suns may not count for this at the moment, because rendering things is weird :P But I am looking into fixing this (and tweaking the overall effect to look better).
Well, if you do make it account for suns, you'd probably also want to disable the bitmap-based lensflares, or you'd get lensflares of lensflares (lensflareception?).
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
That was one of the first things I did :P
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Suns may not count for this at the moment, because rendering things is weird :P But I am looking into fixing this (and tweaking the overall effect to look better).
Well, if you do make it account for suns, you'd probably also want to disable the bitmap-based lensflares, or you'd get lensflares of lensflares (lensflareception?).

The future of JAD, you've found it!
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 
 

Offline Kolgena

  • 211
Looks a bit like the dirty lens effect from XCOM2. Looks good.

 

Offline Oddgrim

  • 29
  • I like building stuff.
    • Art Thumblr
[GhostOfMjn: I can provide hi res vasudan ass]
[Hades]: we have so much in common we should bang.
My models page:
http://p3d.in/u/Oddgrim

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
So I was looking for better lensflare algorithms, but couldn't actually find any (well, any that are entirely shader-based, that is). There are a few very interesting physically based lensflare rendering papers out there, but unfortunately the authors decided to not open-source their solution, but rather patent them. I think I'll just clean this up and then make a PR for it.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline soresu

  • 22
Could the source of Unreal engine offer any pointers? I have seen pages with screenshots of lens flares on Epics own learning/reference docs.

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Could the source of Unreal engine offer any pointers? I have seen pages with screenshots of lens flares on Epics own learning/reference docs.

Problem is, I have no experience working with the UE code, and while I know where the relevant source code is, I have no idea what it actually means or how it works.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
To get an inspiration, you may want to see how they look in the 2012 Total Recall remake and JJ Abrams's Star Trek films.

Regarding engines, what about CryEngine3/CryEngine (3.6-4)/CryEngine V and Unity3D in terms of this topic?

EDIT: I amended to add clarification. BTW, I've viewed The E's video on lensflares in Blue Planet and it's tremendous. I think it would be nice to add them to all flashes and glows depending on intensity and tone.
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...

 

Offline Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
I've implemented your lens flares in my build.
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...