What data does AMBFILE store?


#1

I’m trying to understand when I can use the AMBFILE and when I need to clear it. In the simplest scenario, I render out a scene and it writes to AMBFILE. Now, let’s say I want to re-render it with a higher resolution. I can keep the AMBFILE and just re-render it.

Now, let’s say I add a brand new object in my scene. Is it OK to keep the previous AMBFILE, or will it skew the results of the simulation?

What if all the objects are the same, but the view settings (-vv, -vh, etc) change to capture other parts of the scene, or zoom in or out to parts of the scene. Will it benefit from keeping the AMBFILE? (i.e. is the AMBFILE view-independent?)

I guess all my uncertainties stem from the fact that I don’t actually know what the AMBFILE stores. It would be good to learn more :slight_smile:


#2

Hi Dion,

the ambient file holds a cache for the ambient illuminance on the
surfaces of your model. And this cache was one of the key innovations
that made Radiance such an outstanding piece of software in the field of
daylight simulation, for more than 25 year by now…

The underlying idea is that the ambient (diffuse-indirect) illuminance
changes only gradually for adjacent positions on a surface, but is
computationally quite elaborate if you have a complex scene with many
ambient bounces (diffuse-indirect interreflection steps).

The answer to your question should now be obvious - everything that may
affect the ambient illuminance distribution in your scene should make
you re-generate that cache. All changes that do not change the light
propagation at all (e.g. changes of the view-point or direction, image
resolution) are not critical. Changing the parameters of the ambient
calculation (everything starting with -a, and -lw) is typically a good
reason to start with a new ambient file. Changes to the scene should
almost always render the ambient file invalid - almost, since you may
argue that adding some thin, dark object that does have almost no effect
on the diffuse interreflection would probably be acceptable. But the
general rule is - changes to the scene (geometry or materials) or to the
ambient parameters should trigger regeneration of the ambient file.

By the way, if your scene gets overly complex (I remember your grass
instances…), it may become more efficient to disable the ambient cache
(-aa 0) than to build a cache for all the millions of surfaces of your
scene.

Cheers, Lars.


#3

A halfway measure to setting -aa 0 (which turns off the ambient cache) in scenes with complex geometry whose importance to illumination is minimal is to use the -ae and -aE options to exclude certain surface modifiers from the calculation.

By the way, the rad program automatically removes the ambient file whenever you updated a scene or object file, but it does not detect when you have modified the rad input file itself.


#4

Makes perfect sense! Thanks very much for the tips!


#5

Getting slightly off-topic, but I’ve always wondered if rad *should* detect if you modified the rad input file itself. I often do something like “touch scene.rad” to quickly trick the system to think I changed the scene when I actually just changed the .rif file. Would it be reasonable to adjust rad behavior to assume if the .rif file changes at all, then rad should start from scratch? In some cases this would rebuild the octree when maybe just the ambient file needed to be deleted, but on the other hand the scene files list might have been changed in the .rif file. (if I recall correctly) Even deleting files manually doesn’t always cause rad to recreate them (maybe depending on file type?).


#6

Yeah, I debated this one myself. Sometimes, I want to update the scene after a change to the rad input file, other times not. Adding a file that is new to the “scene” variable will trigger a rebuild if the file is newer than the octree. Removing the octree is probably the most direct way to force a rebuild, rather than using “touch” on one of the inputs.

Bear in mind that the “objects” variable can include any files you want to trigger a rebuild when they change, so you could always add your rad input file to that list if that’s the behavior you prefer. It’s just not added automatically to the checks – you could say I left the final decision to you.