Previous Blog Next Blog
Prev/Next Blog
by date

Resource: Ambient Occlusion for TGE Interiors

Resource: Ambient Occlusion for TGE Interiors
Name:Ryan Mounts 
Date Posted:Jul 11, 2008
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Ryan Mounts

Blog post
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





(Church dif created by Benjamin Naulls)

Recent Blog Posts
List:07/16/08 - Resource: Ambient Occlusion for TGEA Interiors
07/11/08 - Resource: Ambient Occlusion for TGE Interiors
06/25/08 - Native Ambient Occlusion for Interiors in TGE
06/17/08 - Custom Lightmaps for TGEA Interiors
04/03/08 - Add Custom Lightmaps to Interiors
01/24/08 - Update: Max2Ctor 1.0.1
01/10/08 - Tutorial: Export 3dsmax directly to Constructor
01/09/08 - Free Resource for 3dsmax Users

Submit ResourceSubmit your own resources!

Stephan (viKKing) Bondier   (Jul 11, 2008 at 06:07 GMT)
Good job on getting this.
It definitively boosts rendering up.

I'm hoping to see this officially integrated some day.

Rene Damm   (Jul 11, 2008 at 07:34 GMT)
Great work! Thanks for sharing.

Zach Gipson   (Jul 11, 2008 at 08:04 GMT)
Can't thank you enough for this. Awesome work man.

ando   (Jul 11, 2008 at 10:50 GMT)
Sweet

Michael Perry   (Jul 11, 2008 at 13:07 GMT)
Really kickin' resource. Nice work! =)

Dan Keller   (Jul 11, 2008 at 14:06 GMT)
Nice!

James Brad Barnette   (Jul 11, 2008 at 14:16 GMT)
will this work in TGEA?

Ryan Mounts   (Jul 11, 2008 at 14:35 GMT)
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.

Orion Elenzil   (Jul 11, 2008 at 14:40 GMT)   Resource Rating: 5
this is awesome. very nice presentation.
i especially appreciate that you separated the core AO functionality from the AO caching.

Orion Elenzil   (Jul 11, 2008 at 14:50 GMT)   Resource Rating: 5
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.

Koushik   (Jul 11, 2008 at 15:35 GMT)
Awesome!

Ryan Mounts   (Jul 11, 2008 at 16:46 GMT)
@ 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.

Orion Elenzil   (Jul 11, 2008 at 17:23 GMT)   Resource Rating: 5
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.

Flybynight Studios   (Jul 11, 2008 at 18:56 GMT)   Resource Rating: 5
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.

Edward   (Jul 11, 2008 at 19:25 GMT)
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.

Ryan Mounts   (Jul 11, 2008 at 20:03 GMT)
@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.

James Brad Barnette   (Jul 11, 2008 at 22:15 GMT)
any chance someone smarter than me can get this working in TGEA and make a how-to or something?

Michael Hense   (Jul 11, 2008 at 23:17 GMT)
Wow!!

--Mike

Daniel Buckmaster   (Jul 12, 2008 at 10:12 GMT)
Awesome! Will be testing soon...

fairuz   (Jul 15, 2008 at 00:53 GMT)
Will try this out. Thanks.

Eric \"Intangir\" Rutherford   (Jul 18, 2008 at 22:17 GMT)
that looks awesome, i cant wait to try it out tonight

Ryan Mounts   (Jul 21, 2008 at 15:12 GMT)
This resource has been updated to fix a shadow biasing problem (see discussion here).
Edited on Jul 21, 2008 15:12 GMT

Ryan Mounts   (Aug 05, 2008 at 01:10 GMT)
This resource has been updated to fix a problem with patches of black where they shouldn't be (see discussion here).

Sailendu Behera   (Aug 10, 2008 at 05:10 GMT)
WOW... AO is really a very nice thing.

You must be a member and be logged in to either append comments or rate this resource.