New isotropic scatterer material

Discussion related to the LuxRender Material system, programming API and Scene file format.

Moderators: jromang, tomb, zcott, coordinators

Re: New isotropic scatterer material

Postby paco » Fri Dec 10, 2010 5:29 pm

and with *f_ += R;

blend001.Scene.00164.png
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby jeanphi » Sat Dec 11, 2010 8:21 am

Hi,

If you want to get back the results you first posted, you can use F=R/cosi (or min(R/cosi, maxvalue) if you want to prevent it from going to infinity). Or you could compute the length traveled through the layer given its depth and the angle to the surface normal. You should come to the same result in both cases.

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

Re: New isotropic scatterer material

Postby paco » Sat Dec 11, 2010 8:15 pm

Ok, so we agree then that the BxDF for a surface to mimic a volume scatterer is not simply F=g, but it's F=g/cosi, and that this preserves reciprocity, correct?

In that case I'd suggest that we put a flag in the BxDF to define if it's being used for a surface or a volume. If it's being used for a volume F=g. If it's being used for a surface, F=g/cosi (or some similar variant).

Specifically regarding the surface BxDF: As f is the function that needs to be reciprocal (not F) , and f = k . g (wi,wo) / ( cosi . coso) - then to avoid the 1/0 errors I used (1+a)/(cos +a) as it has an analytic integral and so can accurately normalized with :

k= (1 / 2Pi) * 1/ (1+a) * 1/(a ln ( a/(1+a) ) +1 )

which =1/2Pi as a->0 as expected.

However after giving it more thought, the second part doesn't vary that much. For a=0.1 it's 1.015, and i'd suggest that a should typically be smaller than this. So using min(R/cosi, maxvalue) as you suggested seems like a great idea. Although would R/(cosi+1/maxvalue) be more stable?

I must say i've learnt a lot going through all this - hope I haven't taken up too much of your time jeanphi!
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby jeanphi » Sun Dec 12, 2010 7:26 am

Hi,

If you have no depth and the surface is just a forced scattering event, then F=g.
If you introduce depth, scattering cross section and absorption, then you have:
F=s*g*exp(-k*di)*di*exp(-k*do)

where s is the scattering coefficient, k is the extinction coefficient (s+a), d is the depth of the layer, di=d/cosi, do=d/coso

I hope I didn't mixed up anything but this looks homogeneous, and is reciprocal.

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

Re: New isotropic scatterer material

Postby paco » Mon Dec 13, 2010 2:12 am

Interesting formula. The di, do make sense to me as the distance travelled through the medium - and the exponentials make sense. Where did the straight di term come from? Do you have a reference I can read so I don't make it too tedious for you?
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby jeanphi » Mon Dec 13, 2010 3:15 am

Hi,

A pretty nice paper I found is "Rendering Participating Media with Bidirectional Path Tracing" by Lafortune and Willems.
I think I Made a mistake in the previous formula, it should be (1-exp) instead of exp. The di term comes from integrating over the length traveled after scattering (unless I made another error in there).

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

Re: New isotropic scatterer material

Postby paco » Mon Dec 13, 2010 5:25 am

Thanks, will take a look!
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby paco » Tue Dec 21, 2010 2:12 am

Ok, i've had a look at the maths and I get the following f (very similar to yours) :
f1.png
f1.png (2.46 KiB) Viewed 143 times

which was derived by integrating the probability that an incoming photon gets scattered along it's path in direction theta_out with prob g, and that it does not get scattered again on it's way out. Ignores in-scattering.

In the limit that sigma->1 (ie, forced scattering) I get
f2.png
f2.png (1.27 KiB) Viewed 143 times

which does indeed become similar to my original formula as you suggested- except for the d term which puzzles me a little, however I can't find any obvious error in my working.

Anyway, if there are no obvious errors i'll implement this formula for the BRDF with parameters:

scattering (sigma),
absorption(a),
g (probably enumerate specific functions with relevant sub-parameters?)
thickness (d)
reflectance (R - so can apply a texture)

I'll calculate the applicable BTDF formula also. If it helps you then i'm happy to create a BRDF/BTDF combo in which you can select a scattering function and relevant parameters - and then call that "F" function from within mine to calculate g.
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby jeanphi » Tue Dec 21, 2010 3:22 am

Hi,

You could use HG or Schlick phase function instead of letting the user choose the model, and you could have sigma and a be texturable instead of adding R.
What do you think?
EDIT: the limit is not sigma->1 but sigma->inf, and in your material you can mix this BxDF with a null BxDF to get unscattered light.

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

Re: New isotropic scatterer material

Postby paco » Tue Dec 21, 2010 6:39 am

Fixed an error where I had k=1-s-a for some reason. Anyway, now the formulas are (and yes, i'll keep going until i get the same answer twice!):
f1.png
f1.png (2.42 KiB) Viewed 122 times

which if sigma->infinity (thanks!) becomes:
f2.png
f2.png (1.09 KiB) Viewed 122 times

Which doesn't have a d term anymore, however doesn't have a straight 1/cos(theta_in) either which bugs me. Will keep trying :)

I'm happy to stick with HG - I thought the user-selectable functions was your idea?

k and a can be texture inputs. I think perhaps a texture R term would be useful - could consider a scattering event as absorption/re-emission with a different spectrum?

Did you want a BxDF to wrap the HG function - or shall I just plug the HG formula in directly?
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

PreviousNext

Return to Materials, API & Scene file format

Who is online

Users browsing this forum: No registered users and 0 guests