Jump to content

  • Log In with Google      Sign In   
  • Create Account

Light halos, lens flares, volumetric stuff


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
14 replies to this topic

#1 spek   Prime Members   -  Reputation: 997

Like
0Likes
Like

Posted 14 April 2013 - 10:45 AM

Any advice on anno-2013 light/lens flares?

 

I'm trying to beautify the scene a bit with volumetric lighting. There are many different ways to do, and one I'm planning to implement is to make 3D textures that contain (pre baked) radiance per cell, and local fog densities. Pretty much how the "Humus" demo on volumetric fog worked.

 

However, that is way too rough for fine halo's around lamps, and neither does it produce lens flares or other post effects. So far I've always been using simple 2D sprites that either rotate with the camera or keep on place. Effective, but when looking from nearby, you can often detect the flat quad shape somehow.

 

I guess modern engines still use all kinds of (cheap) tricks combined to get a result, but maybe I missed some cool techniques from the last X years?

 

Rick



Sponsor:

#2 belfegor   Crossbones+   -  Reputation: 2718

Like
0Likes
Like

Posted 14 April 2013 - 11:04 AM

I like the crosses glares in "HDRLightning" demo from dx sdk, but never get time to study it and try to reproduce it myself.



#3 Rhetorician   Members   -  Reputation: 119

Like
0Likes
Like

Posted 14 April 2013 - 02:03 PM

I haven't studied that demo either, but from what I remember, it's just a screen-space effect.

#4 TheChubu   Crossbones+   -  Reputation: 4766

Like
0Likes
Like

Posted 14 April 2013 - 02:06 PM

STALKER Clear Sky had pretty nice volumetric fog (smoke actually) that collided with other objects. Though I dunno if GSC ever published how they did it.


Edited by TheChubu, 14 April 2013 - 02:06 PM.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator


#5 MJP   Moderators   -  Reputation: 11774

Like
2Likes
Like

Posted 15 April 2013 - 01:48 AM

Lens flares and lenticular halos don't really have to do anything with volumetric lighting, that's phenomena that results from light refracting and reflecting inside of a lens enclosure. Producing a physically-plausible result in a game would require some attempt at simulating the path of light through the various lenses, for instance by using the ray-tracing approach taken by this paper. Just about all games crudely simulate these effects using screen-space blur kernels combined with sprites controlled by occlusion queries.
 

Volumetrics is mostly concerned with the scattering and absorption of light as it travels through participating media. Most games don't come anywhere close to simulating this, since it's complex and expensive. I don't think you will get very far with pre-computing anything, since you typically want to simulate the fog so that it moves about the level. You also usually want to attenuate the density with noise, to produce more realistic-looking cloud shapes.



#6 spek   Prime Members   -  Reputation: 997

Like
0Likes
Like

Posted 15 April 2013 - 11:02 AM

Thanks for that movie/paper, really useful!

 

The "flare" sprites indeed aren't volumetric in terms of what causes them. But so far my simple sprites (not post image FX as explained in the link) show their sprite behavior by intersecting the geometry when rotating with the camera. Anyway, volumetric lighting, flares and halo's have to complement each other some way. But as you explain, it seems all three are still different (fakish) systems.

 

Not sure if it's much different than what the link explains, but I came accross UDK 4 lens/flares & blooming which looks pretty cool as well:

http://www.unrealengine.com/files/misc/The_Technology_Behind_the_Elemental_Demo_16x9_(2).pdf

Though I'm not sure how they implement that "dirt" map. Just adding some "random" sprites may look nice once, but gets tiring quickly if not applied smartly.

 

 

As for (low frequency) realtime lighting, I liked the possibilities Crytek's LPV technique introduced. While filling 3D textures, you can measure the radiance at any given point. At least nearby the camera. Now I already have a different realtime GI technique so adding LPV would kill the performance, but baking radiance into a low resolution grid could help lighting local dust, fog or smoke sprites. Far from accurate, but better than having nothing or needing heavier per-light computations while 90% of the lamps never change or move in ,my scenes.

 

Greets



#7 Rhetorician   Members   -  Reputation: 119

Like
0Likes
Like

Posted 15 April 2013 - 11:03 AM

Yeah, this topic seemed kinda dissonant when I first read it. I think the original poster is looking for some sort of per-pixel lense flares. I'm not exactly sure about how a volumetric effect fits into such a topic. Despite how I believe the original poster seems confused, maybe they're on to something, like beginners' luck ? ... happy.png

 

Edit:

Well, participating media can strongly influence how lense flares look...


Edited by Reflexus, 15 April 2013 - 11:04 AM.


#8 LancerSolurus   Members   -  Reputation: 616

Like
0Likes
Like

Posted 15 April 2013 - 12:22 PM

You might want to take a look at the page linked below, it might be what you are looking for (specifically the smoke and rain demos)

 

https://developer.nvidia.com/nvidia-graphics-sdk-directx


******************************************************************************************
Youtube Channel


#9 spek   Prime Members   -  Reputation: 997

Like
0Likes
Like

Posted 15 April 2013 - 01:06 PM

Well, I'm not confused, though lens flares and volumetric lighting are two different things indeed (so the title is misleading). But with a halo around a lamp, I refer to particles in the air making the light visible. Smoke, fog, dust, rain, et cetera. That actually is a volumetric effect (but maybe halo is the wrong word), although many games still fake this complex effect by simply putting a sprite around the lightsource. This is where several techniques overlap a bit. Sprites, HDR bloom, volumetric lighting, particles, and eventually lens flare to improve the effect some more.

 

@LancerSolurus

Thanks for the link. Never really looked at the smoke and rain demo's yet. The "volumetric light" demo on that same page is what I currently have implemented for some lights, but it's quite an expensive effect so it can't be used on large scales (at least in my case the performance would get a big hit).

 

Greets



#10 Rhetorician   Members   -  Reputation: 119

Like
0Likes
Like

Posted 15 April 2013 - 08:37 PM

Yeah, I realized what you meant and applied an edit to my post:

"Well, participating media can strongly influence how lense flares look..."

smile.png

 

Green Beets


Edited by Reflexus, 15 April 2013 - 08:37 PM.


#11 Hodgman   Moderators   -  Reputation: 31843

Like
1Likes
Like

Posted 15 April 2013 - 10:11 PM

Lens flare sprites should never intersect with the world, as they're simulating something "inside the camera". Simply turn off depth testing for these.
"Glow sprites" that represent the halo that occurs in our eyes are the same deal -- no depth testing. However, both these effects do need some form of occlusion testing so they fade/disappear as the light is hidden by closer geometry. I like to do this by sampling the depth buffer at the light's position.

In my last game we used old-school sprite based lens flares and image based lens flares, with both effects modulated by an artist-drawn 'dirty lens' mask texture. To determine the sun's occlusion (for fading out the sprite-based lens flare), I did a Boolean depth comparison on a 16x16 area of the depth buffer where the sun should be, and then downsampled these results to a single 8-bit visibility fraction.

For "glow sprites" that represent fog around the light, you need to use "soft depth testing" ("soft particles", "soft billboards", etc might turn up some material). Instead of clipping against the world at intersections, these will then fade out as they approach an intersection, which almost completely hides the fact that they're a sprite (the remaining problem is when the camera enters the "volume").

#12 Frenetic Pony   Members   -  Reputation: 1402

Like
0Likes
Like

Posted 15 April 2013 - 10:49 PM

Sprites could work for fog if you're targeting low power systems. If you're targeting high power systems (the new consoles/high end PCs) you'll want atmospheric scattering EG: http://www.cs.berkeley.edu/~ravir/papers/singlescat/scattering.pdf and for godrays something like: http://download-software.intel.com/sites/default/files/LightScatteringGDC2013_final.pdf


Edited by Frenetic Pony, 16 April 2013 - 12:37 AM.


#13 spek   Prime Members   -  Reputation: 997

Like
1Likes
Like

Posted 15 April 2013 - 11:42 PM

Using a mini depth buffer to approximate visibility sounds smart, got to keep that in mind instead of doing traditional culling.

 

Hmmm, I tried soft particles before, but usually in narrow crowded spots they wouldn't be visible much, because they would always (almost) collide and therefore fade out. Well, that could be a matter of tweaking.

 

The biggest problem I had with glow-sprites, soft or not, were rectangular shaped lights such as fluorescent "tubes". The sprite can't rotate with the camera in this case, unless it scales itself depending on the view vector or something. Keep it a fixed rotation did the job for most angles, but as soon as you stand in a 90 degree angle, you still notice the flatness, if you can see the sprite at all.

 

That's why I was thinking about defining a 3D shape (such a sphere or cube) around lamps and then render a view dependant sprite in it. But I didn't implement anything yet, neither do I have a battle plan. But maybe someone else has experience?

 

 

@Frenetic Pony

That's a lot of formula's, usually my brains crash then :) But I'll give it a try and read, I always thought that Atmospheric Scattering, at least in games, was more for bigger scaled (outdoor) fog and skies, rather than doing glow sprites which are a very local effect? Either how, it needs to be a relative cheap effect as in my case I have many lights that can appear everywhere.

 

Anyway, thanks for the links!

 

 

Btw, maybe useful for others, I found this about implementing lens-flares

http://john-chapman-graphics.blogspot.nl/2013/02/pseudo-lens-flare.html



#14 Frenetic Pony   Members   -  Reputation: 1402

Like
0Likes
Like

Posted 16 April 2013 - 12:39 AM

@Frenetic Pony

That's a lot of formula's, usually my brains crash then smile.png But I'll give it a try and read, I always thought that Atmospheric Scattering, at least in games, was more for bigger scaled (outdoor) fog and skies, rather than doing glow sprites which are a very local effect? Either how, it needs to be a relative cheap effect as in my case I have many lights that can appear everywhere.

 

Works for unlimited lights, err, and highlights, and it's basically what the sprites would be approximating in the first place. But if you need cheap, better atmospheric scattering might not be the way to go.


Edited by Frenetic Pony, 16 April 2013 - 12:40 AM.


#15 lipsryme   Members   -  Reputation: 1046

Like
0Likes
Like

Posted 16 April 2013 - 05:55 AM

I think the technique john chapman is describing is exactly the same as the one being used in UE4 (and a few other recent games I've noticed).

It works quite nicely as a post effect on every light source (or rather bright spots like bloom). Needs a bit of fine tuning though...like making the texture look good, plus you might not want to have half of the screen full of lens flares xD


Edited by lipsryme, 16 April 2013 - 05:58 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS