36 |
|
* hides geometry in front of the surface when rays hit from behind, |
37 |
|
* and applies only the transmission and backside reflectance properties. |
38 |
|
* Reflection is ignored on the hidden side, as those rays pass through. |
39 |
< |
* For the MAT_SBSDF type, we check for a strong "through" component. |
39 |
> |
* For the MAT_ABSDF type, we check for a strong "through" component. |
40 |
|
* Such a component will cause direct rays to pass through unscattered. |
41 |
|
* A separate test prevents over-counting by dropping samples that are |
42 |
|
* too close to this "through" direction. BSDFs with such a through direction |
43 |
|
* will also have a view component, meaning they are somewhat see-through. |
44 |
< |
* A MAT_BSDF type with zero thickness behaves the same as a MAT_SBSDF |
44 |
> |
* A MAT_BSDF type with zero thickness behaves the same as a MAT_ABSDF |
45 |
|
* type with no strong through component. |
46 |
|
* The "up" vector for the BSDF is given by three variables, defined |
47 |
|
* (along with the thickness) by the named function file, or '.' if none. |
55 |
|
* not multiplied. However, patterns affect this material as a multiplier |
56 |
|
* on everything except non-diffuse reflection. |
57 |
|
* |
58 |
< |
* Arguments for MAT_SBSDF are: |
58 |
> |
* Arguments for MAT_ABSDF are: |
59 |
|
* 5+ BSDFfile ux uy uz funcfile transform |
60 |
|
* 0 |
61 |
|
* 0|3|6|9 rdf gdf bdf |
86 |
|
RREAL toloc[3][3]; /* world to local BSDF coords */ |
87 |
|
RREAL fromloc[3][3]; /* local BSDF coords to world */ |
88 |
|
double thick; /* surface thickness */ |
89 |
< |
COLOR cthru; /* "through" component for MAT_SBSDF */ |
89 |
> |
COLOR cthru; /* "through" component for MAT_ABSDF */ |
90 |
|
SDData *sd; /* loaded BSDF data */ |
91 |
|
COLOR rdiff; /* diffuse reflection */ |
92 |
|
COLOR runsamp; /* BSDF hemispherical reflection */ |
96 |
|
|
97 |
|
#define cvt_sdcolor(cv, svp) ccy2rgb(&(svp)->spec, (svp)->cieY, cv) |
98 |
|
|
99 |
< |
/* Compute "through" component color for MAT_SBSDF */ |
99 |
> |
/* Compute "through" component color for MAT_ABSDF */ |
100 |
|
static void |
101 |
|
compute_through(BSDFDAT *ndp) |
102 |
|
{ |
236 |
|
diffY = 0; |
237 |
|
setcolor(cdiff, 0, 0, 0); |
238 |
|
} |
239 |
< |
/* need projected solid angles */ |
239 |
> |
/* need projected solid angle */ |
240 |
|
omega *= fabs(vsrc[2]); |
241 |
– |
ec = SDsizeBSDF(&tomega, ndp->vray, vsrc, SDqueryMin, ndp->sd); |
242 |
– |
if (ec) |
243 |
– |
goto baderror; |
241 |
|
/* check indirect over-counting */ |
242 |
|
if ((vsrc[2] > 0) ^ (ndp->vray[2] > 0) && bright(ndp->cthru) > FTINY) { |
243 |
< |
double dx = vsrc[0] + ndp->vray[0]; |
244 |
< |
double dy = vsrc[1] + ndp->vray[1]; |
245 |
< |
if (dx*dx + dy*dy <= (2.5*4./PI)*(omega + tomega + |
246 |
< |
2.*sqrt(omega*tomega))) |
243 |
> |
double dx = vsrc[0] + ndp->vray[0]; |
244 |
> |
double dy = vsrc[1] + ndp->vray[1]; |
245 |
> |
SDSpectralDF *dfp = (ndp->pr->rod > 0) ? |
246 |
> |
((ndp->sd->tf != NULL) ? ndp->sd->tf : ndp->sd->tb) : |
247 |
> |
((ndp->sd->tb != NULL) ? ndp->sd->tb : ndp->sd->tf) ; |
248 |
> |
|
249 |
> |
if (dx*dx + dy*dy <= (2.5*4./PI)*(omega + dfp->minProjSA + |
250 |
> |
2.*sqrt(omega*dfp->minProjSA))) |
251 |
|
return(0); |
252 |
|
} |
253 |
+ |
ec = SDsizeBSDF(&tomega, ndp->vray, vsrc, SDqueryMin, ndp->sd); |
254 |
+ |
if (ec) |
255 |
+ |
goto baderror; |
256 |
|
/* assign number of samples */ |
257 |
|
sf = specjitter * ndp->pr->rweight; |
258 |
|
if (tomega <= 0) |
628 |
|
raytrans(r); /* hide our proxy */ |
629 |
|
return(1); |
630 |
|
} |
631 |
+ |
if (hasthick && r->crtype & SHADOW) /* early shadow check #1 */ |
632 |
+ |
return(1); |
633 |
|
nd.mp = m; |
634 |
|
nd.pr = r; |
635 |
|
/* get BSDF data */ |
636 |
|
nd.sd = loadBSDF(m->oargs.sarg[hasthick]); |
637 |
< |
/* early shadow check */ |
637 |
> |
/* early shadow check #2 */ |
638 |
|
if (r->crtype & SHADOW && (nd.sd->tf == NULL) & (nd.sd->tb == NULL)) |
639 |
|
return(1); |
640 |
|
/* diffuse reflectance */ |
695 |
|
return(1); |
696 |
|
} |
697 |
|
setcolor(nd.cthru, 0, 0, 0); /* consider through component */ |
698 |
< |
if (m->otype == MAT_SBSDF) { |
698 |
> |
if (m->otype == MAT_ABSDF) { |
699 |
|
compute_through(&nd); |
700 |
|
if (r->crtype & SHADOW) { |
701 |
|
RAY tr; /* attempt to pass shadow ray */ |