Hey, I'm Simon and I'm making a game!! :)
Support me: Wishlist & Play Demo on Steam

Lensflares are usually done by using textures (like the one below) which are oriented to the camera or may also be created via post effect.

For X:Rebirth we used textures at first but had some problems with compression artifacts especially when we had huge lensflares like the haze around the sun which dominates big parts of the screen.

I learned a really interesting trick from our Art-Director Alex which is to not use textures at all. Let’s recap: Normally you have a quad with a texture on it:

But if you invest a bit more geometry like here in this triangle-wheel, define the center-vertex as white, the outer ones black and then set its material to additive blending, you’ll end up with a very similar result:

In X:Rebirth we used this for all elements of our lensflares:

Source: X:Rebirth

Here’s an example video showing the different elements in a “real-world”-example.
HIGH-RES version: mp4/webm


Source: X:Rebirth

I’m not exactly sure if the extra geometry steals more performance than “real” textures would, but with this system we made sure that no compression artifacts appeared and if I look at the results I think this tech is quiet promising:

Source: X:Rebirth

What do you think about this approach? Do you like it? Do you know similar stuff? Let me know in the comments or via mail, twitter or facebook!

Update 1
CeeJayDK shared two great links related to Triangulation and a Particle Trimming Tool which explain why the geometric-lensflares might be a bit less performant than using textures. But like he sais: The only way to find out is testing. :)
Update 2
Froyok created a HUGE post about lens flares: Custom Lens-Flare Post-Process in Unreal Engine! Don’t get discouraged about the title, it’s not “just” about Unreal, it contains a massive amount of information on how (and why) lens flares form with great examples from the real-world, film and games. Wow!

8 thoughts on “X:Rebirth – Geometric Lensflares

  1. Justin

    “I’m not exactly sure if the extra geometry steals more performance than “real” textures would”

    It might even save performance. Less overdraw than a quad and less memory without the texture image files loaded.

    Reply
    1. Simon Post author

      Good points :) Sure the rasterizer might drop some pixels because of the thin trianges but it seems to be fine :)

      Reply
    1. Simon Post author

      Yeah, Vertex-Color for the win! :) I really like playing around with stuff like that. It gives so much interesting control :)

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *