New isotropic scatterer material

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

Moderators: jromang, tomb, zcott, coordinators

New isotropic scatterer material

Postby paco » Thu Dec 09, 2010 12:45 pm

I've coded a new material which is an isotropic scatterer - it behaves like a thin cloud of dust or gas. The reason for it was to try and produce a realistic flame material - a thin isotropic emitting layer - which is why you get most light where you are viewing the flame along an edge, rather than looking face on. Anyway, I went for a material rather than an emitter because you can always put an emitter inside it.

Here's an image using the material (2000 S/p):
blend005.Scene.00164.png


The thin "shell" surrounding the flame is the new material - so the blue part below the main flame, and the red bit at the top. It's modeled as a mesh with an imagemap for a texture. Interestingly I also thought it might make a good mesh to fake SSS - and I tried this on the candle (nested internal meshes). The only light source in the scene is the flame itself.

Internally the scatterer BRDF is based on an F (not f as in pbrt ) of:
Code: Select all
*f_ += R*(1.0+param_a)/(param_a+coso)*(1.0+param_a)/(param_a+cosi)*coso;
Where param_a is a way of avoiding energy conservation issues, and is a rough measure of how isotropic the scattering is (param_a->0 for completely isotropic). I have a scaling factor which I still need to include.

There was some discussion earlier about whether the material is needed. I guess that's up to you guys. Certainly once volumetric emission and SSS are up and running - maybe not, although It might still be a quicker modeling alternative rather than using volumes. I wrote this to solve my own needs - so if you don't want to include it I wont be offended.

Anyway, here's my list of possible uses:

Any flame (afterburner, candle, fire, etc)
Gas nebulae
Fake SSS
Halo around an object
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby paco » Thu Dec 09, 2010 2:12 pm

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

Re: New isotropic scatterer material

Postby anomalydetected » Thu Dec 09, 2010 2:19 pm

Interesting idea. Love it!
anomalydetected
 
Posts: 235
Joined: Tue Feb 16, 2010 3:46 pm

Re: New isotropic scatterer material

Postby jeanphi » Thu Dec 09, 2010 2:31 pm

Hi,

So this is indeed working pretty well after all. What about you use a standard scattering phase function instead? Like Henniey-Greenstein (PhaseHG in core/volume.h) or Schlick (PhaseSchlick in core/volume.h), both being almost identical. Even better: make it selectable (ie make a BxDF per available phase function and have a material parameter to select the one you want) :)
The added benefit would be to save me from doing it, because I'm going to need exactly this for volume scattering ;)

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

Re: New isotropic scatterer material

Postby paco » Thu Dec 09, 2010 4:34 pm

Hm.... ok, will have a look at converting PhaseHG initially. Don't really have a name for the new material - scatterer?
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby jeanphi » Thu Dec 09, 2010 5:08 pm

Hi,

Yes, scatterer would fit. Actually, the new F member will just return the phase function as is (maybe multiplied by a SWCSpectrum component). Proper direction sampling for PhaseHG obey the following formula: cosTheta = 1/(2*g)*(1+g²-((1-g^2)/(1-g*(2*u-1)))^2) where u is a random variable in [0,1).

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

Re: New isotropic scatterer material

Postby paco » Thu Dec 09, 2010 5:35 pm

I had a look at the HG eqn on the net. The problem is that in it's current form it's not reciprocal.

Incidentally, I'm finding F/f a little confusing and for my own working use G/f.

For an isotropic scatterer you really should have G=1and f=1/ cos(theta_out) - but then f fails reciprocity. That's why I used a formula of G= 1/ cos(theta_in) so f is 1/ ( cos(theta_in) * cos(theta_out) ). This is derived by assuming that the surface element dA (used in most calculations) is actually a sphere rather than flat surface - so you lose the cos terms.

To avoid 1/0 errors I used z(cos)=(1+a)/(cos +a), which means that f is still not quite reciprocal as would be G= z(cos theta_in) F=z (cos theta_in) * 1/cos(theta_out). I figured best to throw in a term of cos(theta_out)*z(theta_out) which =1 for all but grazing angles to preserve reciprocity for f.

I figured reciprocity was something to be preserved at all costs - perhaps I am wrong? I'm hoping to write up my working so that if others want to play with bxdfs they have a clearer practical idea of how to proceed (I find the PBRT stuff a bit had wavy at times).

Anyway, at this stage i'd probably use the same trick for the HG - but just multiply the current formula by HG(g)?
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby jeanphi » Thu Dec 09, 2010 6:01 pm

Hi,

I'm completely lost at what you're saying, sorry. If using the phase functions, you should not take the normal into account, the formula gives scattering with reference to the incoming direction. For a purely isotropic scattering this doesn't matter.
This way the formula is reciprocal by construction, and the F member return value is the phase function value. SampleF value will just be 1 because the pdf is then equal to F and SampleF is basically F/pdf.
You just need to multiply the above by the scattering color to make it usable.

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

Re: New isotropic scatterer material

Postby paco » Thu Dec 09, 2010 9:49 pm

Well, if f(wo,wi) = g(wi) , ie just the phase function then surely f(wo,wi)!=f(wi,wo) unless wi=wo (ie, the bxdf does not obey helmholtz reciprocity)
paco
Developer
 
Posts: 456
Joined: Sun Feb 07, 2010 1:37 am

Re: New isotropic scatterer material

Postby jeanphi » Fri Dec 10, 2010 3:07 am

Hi,

I take it that g is the phase function, so the formula is:
F(wo, wi)=g(Dot(wo, wi))=g(Dot(wi, wo))=F(wi,wo)

Fully reciprocal.

Since we're dealing with scattering, you have no reference to the surface normal, the only normals to account for is the particles normals which are hidden in the phase function.

In terms of f, f(wo, wi)=g(Dot(wo, wi))/cos(wo) which is not reciprocal, but that's because the divide is there to hide the surface normal which is irrelevant in the case of scattering (you have a similar term for specular reflection). This cosine term will cancel out in all cases when f is used in the rendering equations.

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

Next

Return to Materials, API & Scene file format

Who is online

Users browsing this forum: No registered users and 1 guest