|
|
Hi All,
I have been using studying the implementation of the media.cpp file for a
while and it seems there is a bug in Simulate_Media and sample_media.
Consider this code in sample_media
if (sample_method==3)
{
// We're doing the samples in order, so we can attenuate correctly
// instead of assuming a constant absorption/extinction.
// Therefore, we do the attenuation later (back up in Simulate_Media).
Te[0] *= Interval->ds;
Te[1] *= Interval->ds;
Te[2] *= Interval->ds;
}
else
{
// NOTE: this assumes constant absorption+extinction over the length of
the interval
Te[0] *= Interval->ds * exp(-Ex[0] * d0);
Te[1] *= Interval->ds * exp(-Ex[1] * d0);
Te[2] *= Interval->ds * exp(-Ex[2] * d0);
}
So it means that if sample_method!=3 then there should be no attenuation in
Simulate_Media.
Here is the code from Simulate_Media which shows that there is no checking
done for the sampling
method and the attenuation is done for all the methods.
for (i = 0; i < intervals; i++)
{
/* Add total emission. */
Te[0] += curr->te[0] / (DBL)curr->samples * exp(-Od[0]);
Te[1] += curr->te[1] / (DBL)curr->samples * exp(-Od[1]);
Te[2] += curr->te[2] / (DBL)curr->samples * exp(-Od[2]);
/* Add optical depth of current interval. */
Od[0] += curr->od[0] / (DBL)curr->samples;
Od[1] += curr->od[1] / (DBL)curr->samples;
Od[2] += curr->od[2] / (DBL)curr->samples;
curr++;
}
This means that it will do attenuation twice, once in sample_media and next
in Simulate_Media for all methods except 3.
If I understand it correctly then the equations of the volume rendering for
absorbing and emitting media suggest
that the attenuation should be done only once.
So, does this implementaion sound incorrect or am I missing something?
Can someone please help me with this?
Thanks a ton,
Maurya
http://www-scf.usc.edu/~mauryash
Post a reply to this message
|
|