Predefined materials

Set of basic configurations and an utility method plotoptix.materials.make_material() to create user defined materials.

plotoptix.materials.m_clear_glass = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__glass.ptx::__closesthit__radiance__glass', 'VarFloat': {'light_emission': 0.0, 'radiation_length': 0.0}, 'VarFloat3': {'refraction_index': [1.4, 1.4, 1.4], 'subsurface_color': [1.0, 1.0, 1.0], 'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 12}}

Glass, with reflection and refraction simulated. Color components meaning is “attenuation length” and the color range is <0; inf>. Set radiation_length > 0 to enable sub-surface scattering. It is supported in background modes plotoptix.enums.MissProgram.AmbientAndVolume, plotoptix.enums.MissProgram.TextureFixed and plotoptix.enums.MissProgram.TextureEnvironment, see also plotoptix.NpOptiX.set_background_mode(). Use subsurface_color to set diffuse color of scattering (RGB components range should be <0; 1>). Volumes can emit light in subsurface_color if light_emission > 0.

plotoptix.materials.m_diffuse = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__diffuse.ptx::__closesthit__radiance__diffuse', 'VarUInt': {'flags': 2}}

Lambertian diffuse material. Note it is available by default under the name “diffuse”. Use color components range <0; 1>.

plotoptix.materials.m_dispersive_glass = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__glass.ptx::__closesthit__radiance__glass', 'VarFloat': {'light_emission': 0.0, 'radiation_length': 0.0}, 'VarFloat3': {'refraction_index': [1.4, 1.42, 1.45], 'subsurface_color': [1.0, 1.0, 1.0], 'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 12}}

Clear glass, with reflection and refraction simulated. Refraction index is varying with the wavelength, resulting with the light dispersion. Color components meaning is “attenuation length” and the range is <0; inf>. Set radiation_length > 0 to enable sub-surface scattering. It is supported in background modes plotoptix.enums.MissProgram.AmbientAndVolume, plotoptix.enums.MissProgram.TextureFixed and plotoptix.enums.MissProgram.TextureEnvironment, see also plotoptix.NpOptiX.set_background_mode(). Use subsurface_color to set diffuse color of scattering (RGB components range should be <0; 1>). Volumes can emit light in subsurface_color if light_emission > 0.

plotoptix.materials.m_eye_normal_cos = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__cos.ptx::__closesthit__radiance__cos'}

Fast material, color is shaded by the cos(eye-hit-normal). Use color components range <0; 1>.

plotoptix.materials.m_flat = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__flat.ptx::__closesthit__radiance__flat'}

Super-fast material, color is just flat. Use color components range <0; 1>.

plotoptix.materials.m_matt_diffuse = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__diffuse.ptx::__closesthit__radiance__diffuse', 'VarFloat': {'base_roughness': 1}, 'VarUInt': {'flags': 2}}

Oren-Nayar diffuse material. Surface roughness range is <0; inf), 0 is equivalent to the Lambertian “diffuse” material.

plotoptix.materials.m_matt_glass = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__glass.ptx::__closesthit__radiance__glass', 'VarFloat': {'base_roughness': 0.2, 'light_emission': 0.0, 'radiation_length': 0.0}, 'VarFloat3': {'refraction_index': [1.4, 1.4, 1.4], 'subsurface_color': [1.0, 1.0, 1.0], 'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 12}}

Glass with surface roughness configured to obtain matt appearance. Color components meaning is “attenuation length” and the color range is <0; inf>. Set radiation_length > 0 to enable sub-surface scattering. It is supported in background modes plotoptix.enums.MissProgram.AmbientAndVolume, plotoptix.enums.MissProgram.TextureFixed and plotoptix.enums.MissProgram.TextureEnvironment, see also plotoptix.NpOptiX.set_background_mode(). Use subsurface_color to set diffuse color of scattering (RGB components range should be <0; 1>). Volumes can emit light in subsurface_color if light_emission > 0.

plotoptix.materials.m_matt_plastic = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__reflective.ptx::__closesthit__radiance__reflective', 'VarFloat': {'base_roughness': 0.001, 'reflectivity_index': 0.0, 'reflectivity_range': 0.5}, 'VarFloat3': {'refraction_index': [2.0, 2.0, 2.0], 'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 6}}

Similar to plotoptix.materials.m_plastic but slightly rough surface.

plotoptix.materials.m_metallic = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__reflective.ptx::__closesthit__radiance__reflective', 'VarFloat': {'base_roughness': 0.002}, 'VarUInt': {'flags': 6}}

reflectivity_index = 1 and reflectivity_range = 1. In this configuration the shading algorithm overrides surface_albedo with the color assigned to each primitive (RGB range <0; 1>), which results with colorized reflections. Roughness of the surface should be usually small.

Type

Strongly reflective, metallic material. Note, this material has default values

plotoptix.materials.m_mirror = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__reflective.ptx::__closesthit__radiance__reflective', 'VarFloat3': {'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 6}}

Reflective mirror, quite simple to calculate and therefore fast material. Note, this material has default values: reflectivity_index = 1 and reflectivity_range = 1. In this configuration the shading algorithm overrides surface_albedo with the color assigned to each primitive (RGB range <0; 1>), which results with colorized reflections.

plotoptix.materials.m_plastic = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__reflective.ptx::__closesthit__radiance__reflective', 'VarFloat': {'reflectivity_index': 0.0, 'reflectivity_range': 0.5}, 'VarFloat3': {'refraction_index': [2.0, 2.0, 2.0], 'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 6}}

Combined reflective and diffuse surface. Reflection fraction may be boosted with reflectivity_index set above 0 (up to 1, resulting with mirror-like appearance) or minimized with a lower than default reflectivity_range value (down to 0). Higher refraction_index gives a more glossy look.

plotoptix.materials.m_shadow_catcher = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__shadow_catcher.ptx::__closesthit__radiance__shadow_catcher', 'VarFloat': {'base_roughness': 0}, 'VarUInt': {'flags': 2}}

Diffuse material, transparent except shadowed regions. Colors, textures, roughness can be set as for other diffuse materials. Useful for preparation of packshot style images.

plotoptix.materials.m_thin_walled = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__glass.ptx::__closesthit__radiance__glass', 'VarFloat': {'light_emission': 0.0, 'radiation_length': 0.0}, 'VarFloat3': {'refraction_index': [1.9, 1.9, 1.9]}, 'VarUInt': {'flags': 44}}

Ideal for the soap-like bubbles. Reflection amount depends on the refraction index, however, there is no refraction on crossing the surface. Reflections can be textured or colorized with the primitive colors, and the color values range is <0; inf).

plotoptix.materials.m_transparent_diffuse = {'OcclusionProgram': 'chit7_occlusion_transp.ptx::__closesthit__occlusion_transparency', 'RadianceProgram': 'materials7_radiance__diffuse_masked.ptx::__closesthit__radiance__diffuse_masked', 'VarFloat': {'base_roughness': 0}, 'VarUInt': {'flags': 2}}

Diffuse material with transparency set according to alpha channel of ColorTextures. Roughness can be set to Lambertian or Oren-Nayar with base_roughness parameter.

plotoptix.materials.m_transparent_metallic = {'OcclusionProgram': 'chit7_occlusion_transp.ptx::__closesthit__occlusion_transparency', 'RadianceProgram': 'materials7_radiance__reflective_masked.ptx::__closesthit__radiance__reflective_masked', 'VarFloat': {'base_roughness': 0.002}, 'VarUInt': {'flags': 6}}

Strongly reflective, metallic material with transparency set according to alpha channel of ColorTextures. See also plotoptix.materials.m_metallic.

plotoptix.materials.m_transparent_plastic = {'OcclusionProgram': 'chit7_occlusion_transp.ptx::__closesthit__occlusion_transparency', 'RadianceProgram': 'materials7_radiance__reflective_masked.ptx::__closesthit__radiance__reflective_masked', 'VarFloat': {'base_roughness': 0, 'reflectivity_index': 0.0, 'reflectivity_range': 0.5}, 'VarFloat3': {'refraction_index': [2.0, 2.0, 2.0], 'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 6}}

Combined reflective and diffuse surface with transparency set according to alpha channel of ColorTextures. See plotoptix.materials.m_plastic and plotoptix.materials.m_matt_plastic for details.

plotoptix.materials.m_volume_color = {'OcclusionProgram': 'chit7_occlusion.ptx::__closesthit__occlusion', 'RadianceProgram': 'materials7_radiance__volcolor.ptx::__closesthit__radiance__volcolor', 'VarFloat': {'light_emission': 0.0, 'radiation_length': 0.0}, 'VarFloat3': {'subsurface_color': [1.0, 1.0, 1.0], 'surface_albedo': [1.0, 1.0, 1.0]}, 'VarUInt': {'flags': 12}}

Volume color, experimental.

plotoptix.materials.make_material(shader: Union[MaterialType, str], color: Any = [1.0, 1.0, 1.0, 1.0], color_tex: Union[list, str] = [], roughness: float = 0.0, roughness_tex: Union[list, str] = [], metalness: float = 0.0, metalness_tex: Union[list, str] = [], normal_tex: Union[list, str] = [], normaltilt_iar: float = 1.0, specular: float = 0.0, albedo_color: Any = [1.0, 1.0, 1.0], subsurface_color: Any = [1.0, 1.0, 1.0], radiation_length: float = 0.0, light_emission: float = 0.0, refraction_index: Any = [1.41, 1.41, 1.41], flags: Union[MaterialFlag, str] = MaterialFlag.Neutral) dict[source]

Create a dictionary of material parameters.

Resulting dictionary should be used as an input to plotoptix.NpOptiX.setup_material().

Parameters
  • shader (MaterialType or string) –

    Name of the material type, selects the shader programs and material capabilities, see plotoptix.enums.MaterialType.

    Dictionary parameter names: RadianceProgram and flags.

  • color (Any, optional) –

    Base color of the material, modulated by an optional texture and geometry primitive color. Single value means a constant gray level. 3(4)-component array means constant RGB(RGBA) color.

    Dictionary parameter name: base_color.

  • color_tex (list or string, optional) –

    List of color texture names or a single texture name. Each texture should be RGBA, and uploaded with plotoptix.NpOptiX.set_texture_2d() or plotoptix.NpOptiX.load_texture() before using plotoptix.NpOptiX.setup_material().

    Dictionary parameter name: ColorTextures.

  • roughness (float, optional) –

    Base roughness value, modulated by an optional texture.

    Dictionary parameter name: base_roughness.

  • roughness_tex (list or string, optional) –

    List of roughness texture names or a single texture name. Each texture should be grayscale, and uploaded with plotoptix.NpOptiX.set_texture_2d() or plotoptix.NpOptiX.load_texture() before using plotoptix.NpOptiX.setup_material().

    Dictionary parameter name: RoughnessTextures.

  • metalness (float, optional) –

    Base metalness value, modulated by an optional texture.

    Dictionary parameter name: reflectivity_index.

  • metalness_tex (list or string, optional) –

    List of metalness texture names or a single texture name. Each texture should be grayscale, and uploaded with plotoptix.NpOptiX.set_texture_2d() or plotoptix.NpOptiX.load_texture() before using plotoptix.NpOptiX.setup_material().

    Dictionary parameter name: MetalnessTextures.

  • normal_tex (list or string, optional) –

    List of normal texture names or a single texture name. Each texture should be plotoptix.enums.RtFormat.Float2, encoding UV normal tilt in the tangent space, and uploaded with plotoptix.NpOptiX.set_texture_2d() before using plotoptix.NpOptiX.setup_material().

    Dictionary parameter name: NormalTextures.

  • normaltilt_iar (float, optional) –

    Inverse aspect ratio of the normal texture, \(height / width\).

    Dictionary parameter name: normaltilt_iar.

  • specular (float, optional) –

    Amount of specular reflection.

    Dictionary parameter name: reflectivity_range.

  • albedo_color (Any, optional) –

    Surface albedo color, modulates the reflected rays color. Single value means a gray level. 3-component array means an RGB color.

    Dictionary parameter name: surface_albedo.

  • subsurface_color (Any, optional) –

    Sub-surface scattering color, modulates color of rays scattered inside the volume. Single value means a gray level. 3-component array means an RGB color.

    Dictionary parameter name: subsurface_color.

  • radiation_length (float, optional) –

    Mean free path length for the sub-surface scattering (free path length has an exponential distribution).

    Dictionary parameter name: radiation_length.

  • light_emission (float, optional) –

    Amount of light emission from the diffuse scattering on surfaces or in the sub-surface scattering for transmissive materials.

    Dictionary parameter name: light_emission.

  • refraction_index (Any, optional) –

    Refraction index for transmissive materials. Single value means an uniform refraction of all colors. 3-component array allows for dispersion simulation (individual refraction index values fror each RGB component).

    Dictionary parameter name: refraction_index.

  • flags (MaterialFlag or string) –

    Name of the material flag, modifies the material shader behavior, see plotoptix.enums.MaterialFlag.

    Dictionary parameter names: flags.

Returns

out

Return type

Dictionary of parameters, ready to use with plotoptix.NpOptiX.setup_material().