Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualHodgman

Posted 19 January 2012 - 04:48 PM

On this car chase game (click for trailer) we used some really simple techniques like MJP mentions.
To use a frame from the video as an example:
Posted Image

[A] are MJP's "cards". We called this same technique "coronas" or "billboard sprites", it's been a common technique in games since forever.
Every frame, I found the location in front of each headlight and drew a rectangle there using additive blending, textured with a glow effect.
To get occlusion working, I drew them with depth-testing disabled (so they would overlap the scene), but hid the whole sprite if the centre was hidden. To implement this hiding/occlusion feature, when drawing the 'sprite' on the CPU, I projected their positions into screen space (by using the projection matrix) and passed this position in as a shader variable. Inside the shader, every pixel sampled the depth-buffer at this same location, and compared the sampled depth against the projected depth. If the sampled depth was closer, then every pixel output black colour instead of the texture colour.

[C] is just a regular bloom shader, which blurs the white headlight geometry a small amount.

[B] is the bloom results applied a second time, but using (1-texCoords) instead, which flips them over the screen to make a fake lens flare.

#1Hodgman

Posted 19 January 2012 - 04:46 PM

On this car chase game (click for trailer) we used some really simple techniques like MJP mentions.
To use a frame from the video as an example:
Posted Image

(A) are MJP's "cards". We called this same technique "coronas" or "billboard sprites", it's been a common technique in games since forever.
Every frame, I found the location in front of each headlight and drew a rectangle there using additive blending, textured with a glow effect.
To get occlusion working, I drew them with depth-testing disabled (so they would overlap the scene), but hid the whole sprite if the centre was hidden. To implement this hiding/occlusion feature, when drawing the 'sprite' on the CPU, I projected their positions into screen space (by using the projection matrix) and passed this position in as a shader variable. Inside the shader, every pixel sampled the depth-buffer at this same location, and compared the sampled depth against the projected depth. If the sampled depth was closer, then every pixel output black colour instead of the texture colour.

© is just a regular bloom shader, which blurs the white headlight geometry a small amount.

(B) is the bloom results applied a second time, but using (1-texCoords) instead, which flips them over the screen to make a fake lens flare.

PARTNERS