Ambient Occlusion that doesn't use normals

Started by
1 comment, last by Stainless 9 years, 9 months ago

I have created a tool for modders of the game IL2.

One of the things I want to add is baking of AO maps.

I tried one technique that basically put's a camera at a vertex looking along the normal, renders the aircraft, and counts the number of pixels drawn to work out how occluded a vert is, but it produced awful results.

Looking at the meshes I was using as test subjects, lot's of the normals are wrong. I've tried a couple of techniques to correct them, but they are not very successful and I don't think just doing vertex based AO will produce the quality I want.

So I am trying to come up with a technique that doesn't use normals.

Has anyone come across a technique for generating AO maps that doesn't require the use of normals?

Advertisement
There are three distinct questions here I think:
1. Compute a value per vertex, or for each pixel of a low resolution AO texture? You should probably go with the latter, all vertex baked things usually look ugly.
2. How to cast rays to compute occlusion? The approach you described uses a rasterizer as a cheap way to cast rays, but you can just as well implement a cheap raytracer. The latter has the benefit, that for one spot, you can shoot rays just in every direction and you are not restricted to a < 180° fov. If you want to stick with the rasterization approach, you can take 6 pictures with 90° fov for each spot, similarly to how you would render a cube map. That would allow you to shoot rays in every direction but stick with rasterization instead of raytracing.
3. Finally, do you have to shoot the rays in the general direction of the normal? Usually no, just shoot rays in every direction, evenly distributed, and if more than 50% don't hit anything, the spot is completely unoccluded, if 0% don't hit anything it's completely occluded.
For every spot on a flat surface, about 50% will always hit that surface, so they are wasted computational effort. If you have the normal of the surface, you can skip every direction that is pointing backwards into the surface, but you don't necessarily need it.

That's a good point, if I assume that 50% of rays will intersect with something, then the normal becomes irrelevant. I can just shoot rays evenly distributed over the volume.... like that idea.

I have already put in code to allow mode swaps in the baker, I just wanted to start with vertex based calculations as an experiment to get the basic techniques working.

You will be able to swap over to per pixel techniques if you want to, I agree most of the time it's worth the extra baking time.

This topic is closed to new replies.

Advertisement