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:
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:
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!
“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.
Good points :) Sure the rasterizer might drop some pixels because of the thin trianges but it seems to be fine :)
Very interesting approach. And loved the results. Good work
Thank you :) There’s a really interesting discussion about this topic on reddit: https://www.reddit.com/r/gamedev/comments/3q9j8h/i_posted_a_new_game_art_trick_about_using/
This is always a nice trick to use vertex colors instead of real texture if you need scalability and as Justin is pointing, it even might save performances. :)
btw : This makes me thing about this trick : http://simonschreibt.de/gat/homeworld-2-backgrounds/
Well done !
Yeah, Vertex-Color for the win! :) I really like playing around with stuff like that. It gives so much interesting control :)
U mean anamorphic lens flare?
What exactly do you want to know? I’m not sure if I understood your question. :)