# Irrandiance Volume v.s. 4-Basis PRT in Farcry

This topic is 951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Recently I implemented an SH2 Irradiance-Volume sample to test its Diffuse GI effects. Given by some moderate volume density, I found it almost acceptable.

But when I digged into this, I found that FarCry 3 has used another solution for its diffuse GI, namely 'Deferred Radiance Transfer Volumes' (GDC 2012). Farcry 3's GI is good, and the most interesting thing is that they used a 4-basis PRT method to get the interpolated surrounding irradiance.

So there is my question:

Sine we can get 1 cube irradiance by 4 SH2 co-effs, why bothering to get them by interpolating an 4-basis PRT? Considering there are 4 SH2 co-effs we need to get the irradiance value for only 1 basis, we'll need 12 SH2 coeffs to get a irradiance in the cube... 3x costs than sample irradiance-vol solution. What is the MOTIVATION about Farcry's choice?

Edited by neoragex

##### Share on other sites
Most probalby it's about accuracy. I do not understand their method axactly, but using 2 band SH is very limited.
2 band SH can store one uniform ambient value, imagine as a sphere and the other 3 values build a direction to offset that sphere.
No matter if you imagine this as a sphere or a lobe, there is no way to capture lighting from opposite directions well, you would need more bands.

By using 4 x 2 band SH at 4 uniformly distributed directions they overcome that limitation,
but it's unclear to me how this is better than using a single SH with more bands.

##### Share on other sites

Most probalby it's about accuracy. I do not understand their method axactly, but using 2 band SH is very limited.

but it's unclear to me how this is better than using a single SH with more bands.

Thanks for your reply. I agree with your opinion and I also have the same question. I guess maybe the multi-basis PRT method is more suitable for their (FarCry) HDR outdoor scenes than a single SH with more bands?

##### Share on other sites
Higher order SHs have ringing artefacts, 2 band don't.
The combination of 4 * SH2 results will also have no ringing - that's the only advantage i can see (assuming performance is similar).

##### Share on other sites

If you're disappointed with 2-band spherical harmonics (perfectly understandable) you can take a look at spherical guassians, or just play around with SH/SG stuff here: https://github.com/kayru/Probulator

##### Share on other sites

It seems 2 band SH also has ringing. When I implemented my SH2 irr-vol I used an Lanczos window to reduce them. Since only trivial SH co-effs multiplies involved in this windowing ops, from the performance perspectives I feel it doesn't like a big deal. Maybe the storage & filtering performance cost is not be the point about the question.

The FarCry's motivation really confused me for a while until by chance I found the Order 1886 (Sig’15 course) also used an multi-basis SG baking solution. One of most interesting things about the course is that they shared some experiences about using SH3 irradiance-cube to represent the HDR lighting, namely, HDR lighting can cause some SH lobes to be very large negative numbers to cancel out the high positive co-effs, which is really bad for baking quality and compression.

So finally I find my own answer: Don’t ever use SH irradiance-cube under HDR lighting situation. The irradiance-cube representation by using low-band SH under HDR situation may be far from accuate, and it's not suitable for baking output. Use muli-basis PRT method instead.

Edited by neoragex

##### Share on other sites

It seems 2 band SH also has ringing. When I implemented my SH2 irr-vol I used an Lanczos window to reduce them. Since only trivial SH co-effs multiplies involved in this windowing ops, from the performance perspectives I feel it doesn't like a big deal. Maybe the storage & filtering performance cost is not be the point about the question.

The FarCry's motivation really confused me for a while until by chance I found the Order 1886 (Sig’15 course) also used an multi-basis SG baking solution. One of most interesting things about the course is that they shared some experiences about using SH3 irradiance-cube to represent the HDR lighting, namely, HDR lighting can cause some SH lobes to be very large negative numbers to cancel out the high positive co-effs, which is really bad for baking quality and compression.

So finally I find my own answer: Don’t ever use SH irradiance-cube under HDR lighting situation. The irradiance-cube representation by using low-band SH under HDR situation may be far from accuate, and it's not suitable for baking output. Use muli-basis PRT method instead.

Indeed, that was the conclusion we eventually came to while working on The Order. SH has some really great properties, but ultimately it doesn't do well for storing arbitrary lighting environments. It's not so bad if you're storing very low-frequency data from indirect lighting, but if ever try to bake in direct lighting from an area light source the result is unusable without filtering. But then once you filter, you completely lose the directionality which also doesn't look right. SG's are much better in this regard, and also have the capability of storing higher-frequency signals.

##### Share on other sites

I think in FarCry 3 they calculate the final irradiance on the CPU, then upload those irradiance values to the GPU via a 3D texture.

With PRT they could change their Sun position and radiance.

Also note that in Assassin's Creed : Black Flag, they just bake multiple light probes for different times of the day and assume that the sun position is fixed.

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633694
• Total Posts
3013378
×