wahn / rs_pbrt

Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code. See also https://www.rs-pbrt.org/about ...
https://www.rs-pbrt.org
Other
811 stars 59 forks source link

[parse_blend_file] Allow basic instancing #126

Closed wahn closed 4 years ago

wahn commented 4 years ago

Right now we expect the object name to be exactly the same as the mesh name, the material name etc. For textures we already have an exception. Now we would like to re-use mesh information (and attached materials) for several objects following a naming convention (like this):

screenshot

Right now we get a warning like this:

WARNING: looking up object_to_world by name ("ceilingLamp_metal") failed

So, while we found a mesh with the name ceilingLamp_metal we could could search for objects (and their transformation matrices) with names like ceilingLamp_metal1, ceilingLamp_metal2, etc. That is not using real instances (yet), but could allow to re-use the same geometry for several objects with different transformations.

wahn commented 4 years ago

Commit f82f9d53552780caeee6f368cb4959eebe3722d7 follows a naming convention like this: If the instances (objects with transformation info) are called _objectname1, _objectname2, etc., the shared mesh should be called _objectname, and the material (shared for all objects) should be called _objectname1 (notice the trailing one). If you follow that naming convention each instance of the shared mesh will show up in the rendering:

classroom_ao