I didn't know if to post this in New Theories and Research, or here, but I decided here.
This has probably been invented before, but I thought of it on my own, and better told and already known about then not told and not known about.
Goal of algorithm: Very cheap ambient occlusion (actually, I don't know if that's the right term), which means at least less than 10 distance estimator calls. This rules out shooting another ray, let alone the multitudes required for the method described at
http://en.wikipedia.org/wiki/Ambient_occlusion.
The purpose is to decrease render time at the cost of shading accuracy. This is not a replacement for true ambient occlusion or global illumination, just a cheap approximation.
The roots of the idea are in
http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf that slideshow, near the bottom, under the title "Rendering with distance fields :: Ambient Occlusion" (ctrl-f it). The algorithm is as follows:
Start at a point 'p' that is almost exactly distance 'distance' away from the fractal (all pixels in a region should be the same distance away), and a normal 'dir' that represents the normalized normal at that point. Being exactly 'distance' away and having an accurate normal are critical to this method.
Then start a ray 'shot' starting from 'p' and going in the direction of the normal. Iterate only a few steps, 5 works well. Higher numbers mean everything is more shaded and more affected by distant objects. Once done, take the distance you
could have gone if you were on a perfectly flat plane going straight up- which happens to be (initialDistance * pow(2, stepCount - 1)) if stepCount is the number of steps you took (it should be a constant). Divide total distance actually traveled by this "could have gone" distance, and you have your shading value.
The result is a average quality ambient occlusion test that only takes 3-7 distance estimator calls, depending on how shaded you want it to be.
Why it works: If the surroundings of a point you are testing is wide open, then the ray will go the same distance as if it were in a open plane, resulting in a shade value of 1. However, if there is a wall right in front of it, it will obviously not go as far, resulting in a shade value less than 1.
Some optimized hlsl code-
float OcclusionTest(float3 p, float3 dir, float delta) // delta is another name for 'distance'
{
float totalDistance = delta; // initialize totalDistance to delta, for we know that it is delta away from the fractal
for (int i = 0; i < AoStepcount; i++) // AoStepcount is about 5 for me
totalDistance += DE(p + dir * totalDistance); // standard simplified raytracing
return totalDistance / (delta * pow(2, AoStepcount)); // modified from formula in proposal, because we initialized totalDistance to delta and not zero
}
Attached is an image where only this method was used to color the Mandelbox.