The Nodal Scene Interface (NSI) is a simple yet expressive API to describe a scene to a renderer. From geometry declaration, to instancing, to attribute inheritance and shader assignments, everything fits in 12 API calls. The following subsections demonstrate how to achieve most common manipulations.
...
In NSI, a geometry is rendered only if connected to the scene's root (which has the special handle ".root"). It is possible to directly connect a geometry node (such as the simple polygon above) to scene's root but it wouldn't be very useful. To place/instance a geometry anywhere in the 3D world a transform node is used as in the code snippet below.
...
Instancing is as simple as connecting a geometry to different attributes (yes, instances of instances are supportedpossible).
Code Block | ||||
---|---|---|---|---|
| ||||
const char *k_instance2 = "more translation"; trs[13] += 1.0; /* translate in Y+ */ nsi.Create( k_instance2, "transform" ); nsi.Connect( k_poly_handle, "", k_instance2, "objects" ); nsi.Connect( k_instance2, "", NSI_SCENE_ROOT, "objects" ); /* We know have two instances of the same polygon in the scene */ |
...
Shaders are created as any other nodes using the NSICreate
API call. They are not assigned directly on geometry geometries but through an intermediate attributes nodes. Having an extra indirection allows for more flexible export as we will see in the following chapters.
...
NSI has a powerful camera description features that allow rendering of multiple points of view at once (as in stereo renders). Moreover, a single camera can be used to render multiple different screens. This is achieved by separating the camera's view description from screen's characteristics such as resolution, crop and shading samples. This It means that it is possible to render two different images using the same camera with each image having its own resolution and quality settings.
...