MDL SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::Shading_state_environment Struct Reference

The MDL environment state structure inside the MDL SDK is a representation of the renderer state in the context of an environment lookup as defined in section 19 "Renderer state" in the MDL specification. More...

#include <target_code_types.h>

Public Attributes

tct_float3 direction
 The result of state::direction(). More...
 
char const * ro_data_segment
 A pointer to a read-only data segment. More...
 

Detailed Description

The MDL environment state structure inside the MDL SDK is a representation of the renderer state in the context of an environment lookup as defined in section 19 "Renderer state" in the MDL specification.

It is used to make the state of the renderer (like the evaluation direction for the environment) available to the generated code.

All spatial values in this structure, i.e. scales, vectors, points and normals, have to be given in internal space (see section 19.2 "Coordinate space transformations" in the MDL specification for more information about the internal space). You can choose the meaning of internal space by setting the "internal_space" option via the mi::neuraylib::IMdl_backend::set_option() method to "world" or "object". The default is world space.

Member Data Documentation

 direction

tct_float3 mi::neuraylib::Shading_state_environment::direction

The result of state::direction().

It represents the lookup direction for the environment lookup.

 ro_data_segment

char const* mi::neuraylib::Shading_state_environment::ro_data_segment

A pointer to a read-only data segment.

For "PTX", "LLVM-IR" and "native" JIT backend:

  • If the MDL code contains large data arrays, compilation time may increase noticeably, as a lot of source code will be generated for the arrays. To avoid this, you can set the "enable_ro_segment" option to "on" via the mi::neuraylib::IMdl_backend::set_option() method. Then, data of arrays larger than 1024 bytes will be stored in a read-only data segment, which is accessible as the first segment (index 0) returned by mi::neuraylib::ITarget_code::get_ro_data_segment_data(). The generated code will expect, that you make this data available via the ro_data_segment field of the MDL material state. Depending on the target platform this may require copying the data to the GPU.

For other backends, this should be NULL.