Volume Tau() with zero absorption

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: jromang, tomb, zcott, coordinators

Volume Tau() with zero absorption

Postby Lord Crc » Mon May 28, 2012 10:34 pm

Hi,

how should we handle ClearVolume/HomogenousVolume Tau() if one of the components are zero?

The RGB -> spectrum conversion may lead to some portion of the spectrum being negative, so I added a clamp to the absorption (in SigmaA) as the negative values caused the Exp in Scatter() to blow up.

The problem is that I forgot that of course zero times infinity = NaN, and ray.maxt is often +infinity...

So, should we instead clamp the absorption to some very small value, say 1e-30 or something? Perhaps we could add a check to see if all components are black, in which case we return 0, otherwise clamp?

If not, what would be the right thing to do? If sigma_a is absolutely zero then it should of course be zero, but one can imagine the input going to zero, in which case the value is indeterminate.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

Re: Volume Tau() with zero absorption

Postby jeanphi » Tue May 29, 2012 2:21 am

Hi,

I think that the fix should go in the places where Tau is used because if the value is 0 then we can save an exp computation since the value should be kept unmodified. Having a small value won't fix the issue as inf*epsilon=inf and this will lead to complete absorption.
Alternately, we can enforce a non inf value for maxt.

Jeanphi
jeanphi
Developer
 
Posts: 6570
Joined: Mon Jan 14, 2008 7:21 am

Re: Volume Tau() with zero absorption

Postby Lord Crc » Tue May 29, 2012 8:24 am

I think it's bad to have an interface where it's expected that Tau() may return NaN for some components. I think can come back and bite us down the line.

Thinking a bit more about it I think using a huge, but non-inf, maxt value would be best as it would be the least surprising for users.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm

Re: Volume Tau() with zero absorption

Postby jeanphi » Tue May 29, 2012 9:27 am

Hi,

Maybe just check the value of sigma and return 0 if sigma is <= 0, that should be safe enough, I hadn't rechecked the code and had forgotten about the exact return of Tau.

Jeanphi
jeanphi
Developer
 
Posts: 6570
Joined: Mon Jan 14, 2008 7:21 am

Re: Volume Tau() with zero absorption

Postby Lord Crc » Tue May 29, 2012 11:49 am

Yeah, I guess that's just as good. We'll have to document for users in any case that they may get surprising results if they have sigmas which have parts of the spectrum zero and parts non-zero.

For example I'm going to modify the luxblend exporter to use the "colordepth" texture as it should be less prone to these special cases.
May contain traces of nuts.
User avatar
Lord Crc
Developer
 
Posts: 4450
Joined: Sat Nov 17, 2007 2:10 pm


Return to Architecture & Design

Who is online

Users browsing this forum: No registered users and 0 guests