The MDL material state structure inside the MDL SDK is a representation of the renderer state as defined in section 19 "Renderer state" in the MDL specification. More...
#include <target_code_types.h>
Public Attributes | |
tct_float3 | normal |
The result of state::normal(). More... | |
tct_float3 | geom_normal |
The result of state::geometry_normal(). More... | |
traits::tct_derivable_float3 | position |
The result of state::position(). More... | |
tct_float | animation_time |
The result of state::animation_time(). More... | |
traits::tct_derivable_float3 const * | text_coords |
An array containing the results of state::texture_coordinate(i). More... | |
tct_float3 const * | tangent_u |
An array containing the results of state::texture_tangent_u(i). More... | |
tct_float3 const * | tangent_v |
An array containing the results of state::texture_tangent_v(i). More... | |
tct_float4 * | text_results |
The texture results lookup table. More... | |
char const * | ro_data_segment |
A pointer to a read-only data segment. More... | |
tct_float4 const * | world_to_object |
A 4x4 transformation matrix in row-major order transforming from world to object coordinates. More... | |
tct_float4 const * | object_to_world |
A 4x4 transformation matrix in row-major order transforming from object to world coordinates. More... | |
tct_int | object_id |
The result of state::object_id(). More... | |
tct_float | meters_per_scene_unit |
The result of state::meters_per_scene_unit(). More... | |
The MDL material state structure inside the MDL SDK is a representation of the renderer state as defined in section 19 "Renderer state" in the MDL specification.
It is used to make the state of the renderer (like the position of an intersection point on the surface, the shading normal and the texture coordinates) 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.
The number of available texture spaces should be set with the "num_texture_spaces"
option of the mi::neuraylib::IMdl_backend::set_option() method.
The number of available texture results should be set with the "num_texture_results"
option of the mi::neuraylib::IMdl_backend::set_option() method. This option is only relevant if code is generated via mi::neuraylib::IMdl_backend::translate_material_df() or mi::neuraylib::ILink_unit::add_material_df().
The MDL specification also mentions some methods which are not or only partially implemented:
state::motion()
, state::geometry_tangent_u()
and state::geometry_tangent_v()
are currently only implemented in the GLSL backend,state::wavelength_base()
is currently not implemented in any backend,state::rounded_corner_normal()
currently just returns the normal
field of the state. tct_float mi::neuraylib::Shading_state_material_impl<with_derivatives>::animation_time |
The result of state::animation_time().
It represents the time of the current sample in seconds.
tct_float3 mi::neuraylib::Shading_state_material_impl<with_derivatives>::geom_normal |
The result of state::geometry_normal().
It represents the geometry normal as determined by the renderer.
tct_float mi::neuraylib::Shading_state_material_impl<with_derivatives>::meters_per_scene_unit |
The result of state::meters_per_scene_unit().
The field is only used if the "fold_meters_per_scene_unit"
option is set to false. Otherwise, the value of the "meters_per_scene_unit"
option will be used in the code.
tct_float3 mi::neuraylib::Shading_state_material_impl<with_derivatives>::normal |
The result of state::normal().
It represents the shading normal as determined by the renderer. This field will be updated to the result of "geometry.normal"
by BSDF init functions, if requested during code generation.
tct_int mi::neuraylib::Shading_state_material_impl<with_derivatives>::object_id |
The result of state::object_id().
It is an application-specific identifier of the hit object as provided in a scene. It can be used to make instanced objects look different in spite of the same used material. This field is only used if the uniform state is included.
tct_float4 const* mi::neuraylib::Shading_state_material_impl<with_derivatives>::object_to_world |
A 4x4 transformation matrix in row-major order transforming from object to world coordinates.
The last row is always implied to be (0, 0, 0, 1) and does not have to be provided. It is used by the state::transform_*() methods. This field is only used if the uniform state is included.
traits::tct_derivable_float3 mi::neuraylib::Shading_state_material_impl<with_derivatives>::position |
The result of state::position().
It represents the position where the material should be evaluated.
char const* mi::neuraylib::Shading_state_material_impl<with_derivatives>::ro_data_segment |
A pointer to a read-only data segment.
For "PTX", "LLVM-IR" and "native" JIT backend:
"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
.
tct_float3 const* mi::neuraylib::Shading_state_material_impl<with_derivatives>::tangent_u |
An array containing the results of state::texture_tangent_u(i).
The i-th entry represents the texture tangent vector of the i-th texture space at the current position, which points in the direction of the projection of the tangent to the positive u axis of this texture space onto the plane defined by the original surface normal.
tct_float3 const* mi::neuraylib::Shading_state_material_impl<with_derivatives>::tangent_v |
An array containing the results of state::texture_tangent_v(i).
The i-th entry represents the texture bitangent vector of the i-th texture space at the current position, which points in the general direction of the positive v axis of this texture space, but is orthogonal to both the original surface normal and the tangent of this texture space.
traits::tct_derivable_float3 const* mi::neuraylib::Shading_state_material_impl<with_derivatives>::text_coords |
An array containing the results of state::texture_coordinate(i).
The i-th entry represents the texture coordinates of the i-th texture space at the current position.
tct_float4* mi::neuraylib::Shading_state_material_impl<with_derivatives>::text_results |
The texture results lookup table.
Values will be modified by BSDF init functions to avoid duplicate texture fetches and duplicate calculation of values. This field is only relevant for code generated with mi::neuraylib::IMdl_backend::translate_material_df() or mi::neuraylib::ILink_unit::add_material_df(). In other cases this may be NULL
.
tct_float4 const* mi::neuraylib::Shading_state_material_impl<with_derivatives>::world_to_object |
A 4x4 transformation matrix in row-major order transforming from world to object coordinates.
The last row is always implied to be (0, 0, 0, 1) and does not have to be provided. It is used by the state::transform_*() methods. This field is only used if the uniform state is included.