direction interpolation debugging..

metadata
Wenzel Jakob 2011-04-14 18:01:11 +02:00
parent 068e6139e5
commit bd195d13da
3 changed files with 37 additions and 11 deletions

View File

@ -30,7 +30,7 @@ MTS_NAMESPACE_BEGIN
#define HETVOL_EARLY_EXIT 1
/// Generate a few statistics related to the implementation?
#define HETVOL_STATISTICS 1
// #define HETVOL_STATISTICS 1
#if defined(HETVOL_STATISTICS)
static StatsCounter avgNewtonIterations("Heterogeneous volume",

View File

@ -22,7 +22,9 @@
#include <mitsuba/render/medium.h>
#include <mitsuba/render/sampler.h>
#define MICROFLAKE_STATISTICS 1
/// Generate a few statistics related to the implementation?
// #define MICROFLAKE_STATISTICS 1
#include "microflake_fiber.h"
MTS_NAMESPACE_BEGIN
@ -71,7 +73,8 @@ public:
Float f(const PhaseFunctionQueryRecord &pRec) const {
if (pRec.mRec.orientation.isZero()) {
/* Switch to uniform sampling */
return 1/(4*M_PI);
// return 1/(4*M_PI);
return 0.0f;
}
Frame frame(pRec.mRec.orientation);
@ -90,8 +93,8 @@ public:
inline Float sample(PhaseFunctionQueryRecord &pRec, Sampler *sampler) const {
if (pRec.mRec.orientation.isZero()) {
/* Switch to uniform sampling */
pRec.wo = squareToSphere(sampler->next2D());
return 1.0f;
//pRec.wo = squareToSphere(sampler->next2D());
return 0.0f;
}
Frame frame(pRec.mRec.orientation);

View File

@ -270,14 +270,37 @@ public:
y2 >= m_res.y || z2 >= m_res.z)
return Vector(0.0f);
const Float fx = p.x-x1, fy = p.y-y1, fz = p.z-z1;
const Float fx = p.x - x1, fy = p.y - y1, fz = p.z - z1;
const float3 *vectorData = (float3 *) m_data;
/* Nearest neighbor */
return m_volumeToWorld(vectorData[
(((fz < .5) ? z1 : z2) * m_res.y +
((fy < .5) ? y1 : y2)) * m_res.x +
((fx < .5) ? x1 : x2)].toVector());
#if 0
/* Nearest neighbor */
Vector value = vectorData[
(((fz < .5) ? z1 : z2) * m_res.y +
((fy < .5) ? y1 : y2)) * m_res.x +
((fx < .5) ? x1 : x2)].toVector();
#else
Float _fx = 1.0f - fx, _fy = 1.0f - fy, _fz = 1.0f - fz;
const float3
&d000 = vectorData[(z1*m_res.y + y1)*m_res.x + x1],
&d001 = vectorData[(z1*m_res.y + y1)*m_res.x + x2],
&d010 = vectorData[(z1*m_res.y + y2)*m_res.x + x1],
&d011 = vectorData[(z1*m_res.y + y2)*m_res.x + x2],
&d100 = vectorData[(z2*m_res.y + y1)*m_res.x + x1],
&d101 = vectorData[(z2*m_res.y + y1)*m_res.x + x2],
&d110 = vectorData[(z2*m_res.y + y2)*m_res.x + x1],
&d111 = vectorData[(z2*m_res.y + y2)*m_res.x + x2];
Vector value = (((d000*_fx + d001*fx)*_fy +
(d010*_fx + d011*fx)*fy)*_fz +
((d100*_fx + d101*fx)*_fy +
(d110*_fx + d111*fx)*fy)*fz).toVector();
#endif
if (!value.isZero())
return normalize(m_volumeToWorld(value));
else
return Vector(0.0f);
}
bool supportsFloatLookups() const {