I’m following some tutorials to load an MDL file and use it in Optix7, but sadly, no matter what I try, I cannot create the material definition.
Here’s an example of the code I’m trying to use:
auto database = neuray->get_api_componentmi::neuraylib::IDatabase();
auto scope = database->get_global_scope();
auto transaction = scope->create_transaction();// factory??
auto mdl_impexp_api = neuray->get_api_componentmi::neuraylib::IMdl_impexp_api();
auto mdl_factory = neuray->get_api_componentmi::neuraylib::IMdl_factory();
auto context = mdl_factory->create_execution_context();if (mdl_impexp_api->load_module(transaction, “gun_metal”, context) < 0) {
std::cerr << “ERROR: fail to load module\n”;
return 2;
}mi::base::Handle mtlDef(
transaction->accessmi::neuraylib::IMaterial_definition(“mdl::gun_metal”)
);
if (!mtlDef) {
std::cerr << “\nERROR: material definition\n”;
return 3;
}
I properly initialized the Neuray object, I added some MDL and resource paths to where I placed that specific file. I can even access the module with:
auto module = transaction->accessmi::neuraylib::IModule(“mdl::gun_metal”);
and print out a bunch of information about it. The only thing stopping my progress, so far, is the material definition to then potentially compile to PTX and load in Optix7.
What am I missing?
Thanks