View Full Version : Halo's Sun
10-28-2003, 09:27 AM
For those of you guys who have played Halo, have you noticed how they render the sun when it gradually gets blocked by another object. It's like the sun gets cut off clockwise on both sides and has a really cool effect. Anybody know how they do it?
10-28-2003, 09:29 AM
One way to do it would be to render it multiple times with increasing size but decreasing alpha.
10-28-2003, 09:48 AM
I haven't had a chance to look at the effect, but it sounds like they're doing an occlusion query. See the GL_ARB_occlusion_query extension. What you do is start an occlusion query and render a small camera-facing polygon at the sun's location with depth test turned on. Later, get the occlusion query result back and use the percentage of depth-passed pixels to determine the alpha value for the sun.
10-28-2003, 10:20 AM
Looks like another thread on the 'Sun & halo' also talk about this.
[This message has been edited by Elixer (edited 10-28-2003).]
10-28-2003, 12:56 PM
There seems to be some glow extrusion going on. The effect is pretty amazing.
Look here (http://www.ystart.de/upload/1066908133.jpg) (not my screenshot, may expire sometime).
No idea how it's done really.
10-28-2003, 01:16 PM
I did a similar effect for the Nvidia game/demo Bridge-It.
Once the entire scene was rendered (ie. z-buffer is complete) I render the sun with z-testing into the destination alpha. Next I read back the area into a texture. Then I render the sun using this texture about ~40 times getting slightly bigger each time while reducing the alpha. (I move the texture's alpha into the out color * sun color)
For the over glow this is what I did. I had auto-mip-map generation turned on the read back texture, so the final 1x1 mip-map's alpha should be an average of the top mip-map's values. So if the sun is full or partially obscured, the value will start going black. So I simply render a full screen quad with texture coordinates that force the lowest mip-map to be used. (ie for a 1024x768 screen, I use (1024,768) texture coordinates.
(Once again I use the textures alpha as the output color * a scale value)
This method has no CPU involvement so should cause no stalls. It should also be able to be done in un-extended OpenGL 1.1 (except for the overglow)(I have not thought all the logic through yet but I don't do anything that special) but I used some short vertex and fragment programs to reduce the number of passes and so I could have a static vertex buffer.
If you want to see this effect, adjust the time of day to sunset in Bridge-It and position an object (ie the bridge or mountain) in front of the sun and move around.
10-28-2003, 01:56 PM
Great, "godrays", although it's a bit limited, still a very cool effect.
[This message has been edited by dorbie (edited 10-28-2003).]
IIRC Mohaa had a much better effect (much more realistic). The more you looked at the sun, the less you could see (at least I think it was Mohaa...).
10-28-2003, 11:33 PM
Chris Butcher of Bungie talked (briefly) about this effect on GD-Algorithms: http://www.geocrawler.com/mail/msg.php3?msg_id=8038509&list=4856
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.