We have a standalone framework which integrates the Indigo SDK to open our own file format, build a Indigo scene and render images - this is working nice and smooth, no errors or complaints when compiling and running from Visual Studio 2017. It is essentially a static lib which contains our file parser, convenience functions and stuff and runs the Indigo .dll in the background. Using it standalone it is launched and handled from our own software.
Now we are working on receiving Indigo renderings within the Unreal Engine, using the same static library as the standalone tool. The Unreal engine / editor seems to be very picky concerning memory leaks, this is where we have a problem now:
I can render an empty scene (skylight, basic camera, no geometry) and receive the images, so the framework itself is working. As soon as I set an HDR image in the background settings node Unreal breaks on an error regarding a corrupted heap. I can continue the execution and receive the correct rendered images. There are more errors when adding geometry, but for the moment I'd like to track down this one:
Here's where I load the HDR image, it's pretty similar to the example code in the SDK:
Code: Select all
Indigo::Texture emission_texture;
emission_texture.path = environment_info.hdr_filepath.c_str();
emission_texture.exponent = pow(environment_info.contrast, CONTRAST_EXP);
emission_texture.tex_coord_generation = new Indigo::SphericalTexCoordGenerator(environment_rotation);
// ==== MATERIAL
Reference<Indigo::DiffuseMaterial> environment_hdr_material = new Indigo::DiffuseMaterial();
environment_hdr_material->name = "Environment HDR";
environment_hdr_material->albedo = new Indigo::ConstantWavelengthDependentParam(Reference<Indigo::Spectrum>(new Indigo::UniformSpectrum(0)));
environment_hdr_material->emission = new Indigo::TextureWavelengthDependentParam(emission_texture);
double temperature = environment_info.whitebalance;
double gain = 1.0;
environment_hdr_material->base_emission = new Indigo::ConstantWavelengthDependentParam(new Indigo::BlackBodySpectrum(temperature, gain));
environment_hdr_material->backface_emit = true;
background_settings_node->background_material = environment_hdr_material;
//================ Emission scale ================
double exposure = EXPOSURE_SCALE * pow(environment_info.exposure, EXPOSURE_EXP);
background_settings_node->emission_scale = new Indigo::EmissionScale(Indigo::EmissionScale::Measure::LUMINANCE, exposure, new Indigo::SceneNodeMaterial());
If I uncomment the following line it works (it's using the default skylight background then that I add as default earlier):
Code: Select all
background_settings_node->background_material = environment_hdr_material;
The engine breaks later when I initialize the Indigo renderer with the scene (InitializeWithScene(...)). the debug message refers to ntdll.dll but without further details.
Is it possible that there's a memory leak when handling HDR images in the renderer during initialization?