Game Development Community

Resource: Ambient Occlusion for TGE Interiors

by Ryan Mounts · 07/11/2008 (5:34 am) · 28 comments

NOTICE: Resource updated 8/4/08.

Here's the resource for adding interior ambient occlusion to TGE mentioned in my last blog post. This resource details the engine code changes to enable parameterized ambient occlusion calculations directly inside Torque... no external editors or converters.

Personal disclaimer: I'm not the greatest programmer in the world, so if you have any suggestions for optimizing or otherwise improving the code, please share! :)

Obligatory images

i291.photobucket.com/albums/ll284/rmounts/AO_Tut_Cover.jpg
i291.photobucket.com/albums/ll284/rmounts/AO_compare.jpg
(Church dif created by Benjamin Naulls)
Page «Previous 1 2
#1
07/11/2008 (6:07 am)
Good job on getting this.
It definitively boosts rendering up.

I'm hoping to see this officially integrated some day.
#2
07/11/2008 (7:34 am)
Great work! Thanks for sharing.
#3
07/11/2008 (8:04 am)
Can't thank you enough for this. Awesome work man.
#4
07/11/2008 (10:50 am)
Sweet
#5
07/11/2008 (1:07 pm)
Really kickin' resource. Nice work! =)
#6
07/11/2008 (2:06 pm)
Nice!
#7
07/11/2008 (2:16 pm)
will this work in TGEA?
#8
07/11/2008 (2:35 pm)
The ambient occlusion code listed in Appendix A should be able to be dropped right into TGEA and work just fine. The only difference, if I remember correctly, is that the InteriorInstance class in TGEA does not have an "onStaticModified" method, so you would just have to move that code to "onPostApply" instead. The persistence and caching code in Appendix B might need some rework, though. I plan to integrate this into TGEA next, so if all goes smoothly you might see something released next week.
#9
07/11/2008 (2:40 pm)
this is awesome. very nice presentation.
i especially appreciate that you separated the core AO functionality from the AO caching.
#10
07/11/2008 (2:50 pm)
btw, with regard to randomizing the hemisphere dome,
you might be interested in this page, where i talk a bit about choosing random points uniformly distributed on a sphere in constant time. which would slow down the lighting a bit, but would let you use an integer for "Quality" instead of a multiple-choice.
#11
07/11/2008 (3:35 pm)
Awesome!
#12
07/11/2008 (4:46 pm)
@ Orion

That's really interesting... yeah, initially I wanted to make the number of rays parametric, but couldn't really find an algorithm, so I ended up using geodesic domes with increasing tesselation values to generate the (approximately) evenly spaced rays across the hemisphere. The only problem is that the number of rays increases geometrically with each iteration. Although performance wise it's nice having the rays in memory, as you noticed, the limited quality settings can be restrictive. I've found that Draft quality is fine in most cases, and Low has always provided plenty of smoothing for my purposes. I'll bookmark that page and maybe get a chance to try it out sometime down the road.
#13
07/11/2008 (5:23 pm)
ryan - i also realized it wouldn't need to be such a performance hit, if you pre-calculated a couple hundred hemisphere points and then chose between those hemispheres randomly.
#14
07/11/2008 (6:56 pm)
Just wanted to say.. wow.. definitely cool. This should be a prime candidate for head yes? I can't think of any reason someone wouldnt want it. Performance is better and the look is way better.

Thanks so much for sharing.
#15
07/11/2008 (7:25 pm)
question, while i love the PDF, wouldnt including a text version of all the code changes, increase the accuracy of inserting this code. I think were going to see alot of code errors from transfering the code. But so far so good, im going to try this.
#16
07/11/2008 (8:03 pm)
@Edward

You can already copy and paste the text directly from the PDF. Just use the text selection tool (look on the toolbar for the button with the word "Select" on it) to grab the lines you need right out of the code snippets. It may need a little reformatting when you paste it, such as adding back in some newline characters, but it should work.
#17
07/11/2008 (10:15 pm)
any chance someone smarter than me can get this working in TGEA and make a how-to or something?
#18
07/11/2008 (11:17 pm)
Wow!!

--Mike
#19
07/12/2008 (10:12 am)
Awesome! Will be testing soon...
#20
07/15/2008 (12:53 am)
Will try this out. Thanks.
Page «Previous 1 2