XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Ambient Occlusion Post Processing Filter

Last post 05-14-2008 1:06 PM by jwatte. 3 replies.
  • 05-13-2008 8:57 AM

    Ambient Occlusion Post Processing Filter

    I have a need to create a full Ambient Occlusion Post Processing Filter that will compute lighting and such before rendering it to avoid rendering it in real time to save GPU/CPU Processing Power and so that it creates the nice lighting effects created from Ambient Occlusion.

    However i have no clue on how to go about this so expert help would be appreciated.

    It may be in DirectX or Open GL as long as it is in C++.

    Thanks

  • 05-13-2008 1:19 PM In reply to

    Re: Ambient Occlusion Post Processing Filter

    Ambient Occlusion does not pre-compute lighting. It only pre-computes one of the lighting terms; the direction-independent ambient term.

    To compute Ambient Occlusion, for each texel, trace a half-sphere of rays out from the surface, out to some local maximum length, and count the percentage that hit some other surface, rather than "getting out" to the wider yonder. The percentage that hit something else is the percentage of your ambient occlusion. Really fancy systems actually use the color of the surface you hit, too, to emulate radiosity in ambient occlusion. And, yes, this means that you have to have a uniquely mapped mesh, and you have to be able to do ray tracing within your mesh, similar to how you'd do a radiosity computation pass.

    At runtime, you simply modulate the ambient term with your ambient occlusion percentage look-up. You still have to calculate diffuse and specular, because those are position and camera dependent, respectively. If you want to pre-calculate diffuse, for the cases where neither light nor object moves, then you want regular good-old "light mapping," and there are tons of tools out there that can calculate the light mapping for you. I use DeleD, but there are many others, all the way from 3ds Max down to Giles.

    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 05-13-2008 8:42 PM In reply to

    Re: Ambient Occlusion Post Processing Filter

    Could you maybe give me some code on how to create my filter?

    Im not very good a coding big things yet.

  • 05-14-2008 1:06 PM In reply to

    Re: Ambient Occlusion Post Processing Filter

    I think if you google "calculating ambient occlusion" you will find some good references. In general, if you're not proficient in 3D math, though, you'll have a hard time implementing the creation, as the creation is best done as an interaction between geometry and texture, not just as a texture filter.
    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
Page 1 of 1 (4 items) Previous Next