I am trying to implement a custom add-on for Mitsuba, but when I use the Heightfield I have defined in another function call(WaveBrdfAccel) in main.cpp it compiles without any problems but when I try to render the scene I get an error that says: undefined symbol: _ZTVN7mitsuba11HeightfieldE

Is there something special I need to do to implement this properly in Mitsuba's frameworks?

I am trying this on Mitsuba version 0.5.0 (Linux, 64 bit). If I remove the heightfield parameter from the WaveBrdfAccel declaration then This error does not occur which leads me to believe​ there is something wrong in the way I am calling it but I cannot figure it out.

Here is my main.cpp file :

GPTWorkResultTest *spec;

            GPTWorkResultEXR heightfieldImage(heightfieldFilename);
            Heightfield heightfield(&heightfieldImage, texelWidth, vertScale);
            Query query;
                query.mu_p = Vector2(mu_x, mu_y);
                query.sigma_p = sigma_p;
                query.lambda = lambda;

            WaveBrdfAccel waveBrdfAccel(&heightfield, diffModel); 

the Heightfield and WaveBrdfAccel class both in waveBrdf.h:

class Heightfield {
     explicit Heightfield() {}
     Heightfield(GPTWorkResultEXR *heightfieldImage, Float texelWidth = 1.0, Float vertScale = 1.0)
        : mHeightfieldImage(heightfieldImage), mTexelWidth(texelWidth), mVertScale(vertScale) {}
    GaborKernel g(int i, int j, Float F, Float lambda);

    Vector2 n(Float i, Float j);
    GPTWorkResultEXR *mHeightfieldImage;
    Float mTexelWidth;      // in microns.
    Float mVertScale;


class WaveBrdfAccel {

explicit WaveBrdfAccel(Heightfield *heightfield, string method);

 comp queryIntegral(const Query &query, int layer, int xIndex, int yIndex);


and finally the inclusion in waveBrdf.cpp:

WaveBrdfAccel::WaveBrdfAccel(Heightfield *heightfield, string method) {
cout << "IT IS ACTUALLY running wave" << endl;

MTS_IMPLEMENT_CLASS(WaveBrdfAccel, false, WorkResult)


I am not sure exactly why this is the case but I managed to fix it by simply separating the class definitions into sperate header files. If anyone knows why this worked would love to know!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.