Optix Model Import

May I ask about the problem with model loading
When I was studying the examples in the Optix tutorial (optimx7course master), I probably understood that it was through a model.cpp file to correspond the triangles and texture maps in the model, and then put them into SBT for binding. Then, I just needed to instantiate the model class in the main function and pass in the model address, as shown below.
Model * model=loadOBJ (“…/…/models/sponza. obj”);
But after downloading a relatively complex example, I couldn’t quite sort out the logic of the code and couldn’t find where to load the model. The name of this example is OptiX Raytracer master. The example I am seeing now is adapted by someone else, and it is done in the following way:
auto tianhuaban_checker = std::make_shared(“Textures4\7.jpg”);
auto tianhuaban_diffuse = std::make_shared(tianhuaban_checker);
auto tianhuaban_matrix = sutil::Matrix4x4::translate(make_float3(-170.0f, 425.0f, -150.0f))
* sutil::Matrix4x4::rotate(M_PIf, make_float3(0.0f, 0.0f, 0.0f));
auto tianhuaban_model_ps = PrimitiveInstance(Transform());
auto tianhuaban_model = createTriangleMesh(“model\m_model4\tianhuaban.obj”);
tianhuaban_model_ps.addPrimitive(tianhuaban_model, tianhuaban_diffuse);

Divide the model into many blocks based on different materials and import them one by one. I also learned how to import the model, but when encountering a very complex model, I don’t know what to do. I would like to ask how to import the model in this example (OptiX Raytracer master). I don’t have the original code for this instance, but what I see is the modified version. Could you please see if you can find this instance, Then teach me how to import the model. I feel that this example is much more complex than the tutorial (optimx7 course master), and I am a bit confused about the logical relationships between the various files.
Thank you!!

The name of this example is OptiX Raytracer master.
I don’t have the original code for this instance, but what I see is the modified version

Please understand that if you do not provide any links to the code bases you’re talking about, there is no way for people on this developer forum to explain what is happening where inside this application of yours.

I would recommend single-stepping through your application inside a debugger and when you arrive at an OptiX API call, look into the OptiX Programming Guide and OptiX API Reference to see what exactly they are doing. https://raytracing-docs.nvidia.com/

You can also attack that problem from the bottom by looking at the OptiX API calls done inside your application.

At one point inside the application code, the geometry acceleration structures (GAS) with the geometric primitives need to be built by calling optixAccelBuild. That is the place where the geometric primitives of the model parts are provided to OptiX. If you track that input data back to where it came from inside that code base, you will arrive at the place where the OBJ loader has parsed these into some local data structure.

Similarly for the instance acceleration structures (IAS) above that which contain a matrix and a traversableHandle with some GAS usually, and other important fields like the shader binding table (SBT) offset and a user defined instance ID, which place the model parts into your world and can define the assigned material shader inside the SBT.

If you need to understand how to build GAS and IAS in OptiX, you should start with simpler examples by working through the OptiX Programming Guide and the OptiX SDK example code.

I wrote some more complex introductory examples which show how to generate some triangulated shapes (plane, box, sphere, torus) in object space at runtime and then build the GAS of those
and place them into the scene with OptiX instances

Loading any model file format is more or less involved, while the OBJ and its MTL material file format are not too complicated.
In the end the above steps need to happen on the model parts as well somewhere in your code.

The more advanced examples there are using the ASSIMP library to load mesh data of supported model file formats into a simple local scene graph which is then traversed and flattened with a two-level IAS->GAS structure which is fully hardware accelerated on RTX boards.

There are also multiple different ways how to assign materials to different parts of a model, which could even go down to a different material per triangle if needed (like some CAD applications do), so there is also not a unique answer to that question. It depends what the application implements.
For example, in my OptiX applications I’m assigning the material via the OptixInstance data because that allows reusing the same GAS data with different materials.