../_images/banner_07.jpg

API reference#

Overview#

This API reference documentation was automatically generated using the Autodoc Sphinx extension.

Autodoc automatically processes the documentation of Mitsuba’s Python bindings, hence all C++ function and class signatures are documented through their Python counterparts. Mitsuba’s bindings mimic the C++ API as closely as possible, hence this documentation should still prove valuable even for C++ developers.

Core#

mitsuba.render(scene, params=None, sensor=0, integrator=None, seed=0, seed_grad=0, spp=0, spp_grad=0)#

This function provides a convenient high-level interface to differentiable rendering algorithms in Mi. The function returns a rendered image that can be used in subsequent differentiable computation steps. At any later point, the entire computation graph can be differentiated end-to-end in either forward or reverse mode (i.e., using dr.forward() and dr.backward()).

Under the hood, the differentiation operation will be intercepted and routed to Integrator.render_forward() or Integrator.render_backward(), which evaluate the derivative using either naive AD or a more specialized differential simulation.

Note the default implementation of this functionality relies on naive automatic differentiation (AD), which records a computation graph of the primal rendering step that is subsequently traversed to propagate derivatives. This tends to be relatively inefficient due to the need to track intermediate program state. In particular, it means that differentiation of nontrivial scenes at high sample counts will often run out of memory. Integrators like rb (Radiative Backpropagation) and prb (Path Replay Backpropagation) that are specifically designed for differentiation can be significantly more efficient.

Parameter scene (mi.Scene):

Reference to the scene being rendered in a differentiable manner.

Parameter params (Any):

An optional container of scene parameters that should receive gradients. This argument isn’t optional when computing forward mode derivatives. It should be an instance of type mi.SceneParameters obtained via mi.traverse(). Gradient tracking must be explicitly enabled on these parameters using dr.enable_grad(params['parameter_name']) (i.e. render() will not do this for you). Furthermore, dr.set_grad(...) must be used to associate specific gradient values with parameters if forward mode derivatives are desired. When the scene parameters are derived from other variables that have gradient tracking enabled, gradient values should be propagated to the scene parameters by calling dr.forward_to(params, dr.ADFlag.ClearEdges) before calling this function.

Parameter sensor (int, mi.Sensor):

Specify a sensor or a (sensor index) to render the scene from a different viewpoint. By default, the first sensor within the scene description (index 0) will take precedence.

Parameter integrator (mi.Integrator):

Optional parameter to override the rendering technique to be used. By default, the integrator specified in the original scene description will be used.

Parameter seed (int)

This parameter controls the initialization of the random number generator during the primal rendering step. It is crucial that you specify different seeds (e.g., an increasing sequence) if subsequent calls should produce statistically independent images (e.g. to de-correlate gradient-based optimization steps).

Parameter seed_grad (int)

This parameter is analogous to the seed parameter but targets the differential simulation phase. If not specified, the implementation will automatically compute a suitable value from the primal seed.

Parameter spp (int):

Optional parameter to override the number of samples per pixel for the primal rendering step. The value provided within the original scene specification takes precedence if spp=0.

Parameter spp_grad (int):

This parameter is analogous to the seed parameter but targets the differential simulation phase. If not specified, the implementation will copy the value from spp.

Parameter scene (mi.Scene):

no description available

Parameter sensor (Union[int, mi.Sensor]):

no description available

Parameter integrator (mi.Integrator):

no description available

Parameter seed (int):

no description available

Parameter seed_grad (int):

no description available

Parameter spp (int):

no description available

Parameter spp_grad (int):

no description available

Returns → mi.TensorXf:

no description available


mitsuba.set_variant()#

Set the variant to be used by the mitsuba module. Multiple variant names can be passed to this function and the first one that is supported will be set as current variant.

Returns → None:

no description available


mitsuba.variant()#

Return currently enabled variant

Returns → str:

no description available


mitsuba.traverse(node)#

Traverse a node of Mitsuba’s scene graph and return a dictionary-like object that can be used to read and write associated scene parameters.

See also mitsuba.SceneParameters.

Parameter node (mitsuba.Object):

no description available

Returns → mitsuba.python.util.SceneParameters:

no description available


class mitsuba.SceneParameters#

Dictionary-like object that references various parameters used in a Mitsuba scene graph. Parameters can be read and written using standard syntax (parameter_map[key]). The class exposes several non-standard functions, specifically torch`(), update`(), and keep`().

__init__()#

Private constructor (use mitsuba.traverse() instead)

items()#
Returns → a set-like object providing a view on D’s items:

no description available

keys()#
Returns → a set-like object providing a view on D’s keys:

no description available

flags(key)#

Return parameter flags

Parameter key (str):

no description available

set_dirty(key)#

Marks a specific parameter and its parent objects as dirty. A subsequent call to update`() will refresh their internal state.

This method should rarely be called explicitly. The SceneParameters` will detect most operations on its values and automatically flag them as dirty. A common exception to the detection mechanism is the scatter() operation which needs an explicit call to set_dirty`().

Parameter key (str):

no description available

update(values=None)#

This function should be called at the end of a sequence of writes to the dictionary. It automatically notifies all modified Mitsuba objects and their parent objects that they should refresh their internal state. For instance, the scene may rebuild the kd-tree when a shape was modified, etc.

The return value of this function is a list of tuples where each tuple corresponds to a Mitsuba node/object that is updated. The tuple’s first element is the node itself. The second element is the set of keys that the node is being updated for.

Parameter values (dict):

Optional dictionary-like object containing a set of keys and values to be used to overwrite scene parameters. This operation will happen before propagating the update further into the scene internal state.

Parameter values (dict):

no description available

Returns → list[tuple[Any, set]]:

no description available

keep(keys)#

Reduce the size of the dictionary by only keeping elements, whose keys are defined by ‘keys’.

Parameter keys (None, str, [str]):

Specifies which parameters should be kept. Regex are supported to define a subset of parameters at once. If set to None, all differentiable scene parameters will be loaded.

Parameter keys (None | str | list[str]):

no description available

Returns → None:

no description available


mitsuba.variants()#

Return a list of all variants that have been compiled

Returns → typing.List[str]:

no description available


mitsuba.set_log_level(arg0)#
Parameter arg0 (mitsuba::LogLevel):

no description available

Returns → None:

no description available


class mitsuba.ArgParser#

Minimal command line argument parser

This class provides a minimal cross-platform command line argument parser in the spirit of to GNU getopt. Both short and long arguments that accept an optional extra value are supported.

The typical usage is

ArgParser p;
auto arg0 = p.register("--myParameter");
auto arg1 = p.register("-f", true);
p.parse(argc, argv);
if (*arg0)
    std::cout << "Got --myParameter" << std::endl;
if (*arg1)
    std::cout << "Got -f " << arg1->value() << std::endl;
__init__(self)#
add(overloaded)#
add(self, prefix, extra=False)#

Register a new argument with the given list of prefixes

Parameter prefixes (List[str]):

A list of command prefixes (i.e. {“-f”, “–fast”})

Parameter extra (bool):

Indicates whether the argument accepts an extra argument value

Parameter prefix (str):

no description available

Returns → mitsuba.ArgParser.Arg:

no description available

add(self, prefixes, extra=False)#

Register a new argument with the given prefix

Parameter prefix:

A single command prefix (i.e. “-f”)

Parameter extra (bool):

Indicates whether the argument accepts an extra argument value

Returns → mitsuba.ArgParser.Arg:

no description available

executable_name(self)#
Returns → str:

no description available

parse(self, arg0)#

Parse the given set of command line arguments

Parameter arg0 (List[str]):

no description available

Returns → None:

no description available


class mitsuba.AtomicFloat#

Atomic floating point data type

The class implements an an atomic floating point data type (which is not possible with the existing overloads provided by std::atomic). It internally casts floating point values to an integer storage format and uses atomic integer compare and exchange operations to perform changes.

__init__(self, arg0)#

Initialize the AtomicFloat with a given floating point value

Parameter arg0 (float):

no description available


class mitsuba.DefaultFormatter#

Base class: mitsuba.Formatter

The default formatter used to turn log messages into a human-readable form

__init__(self)#
has_class(self)#
See also:

set_has_class

Returns → bool:

no description available

has_date(self)#
See also:

set_has_date

Returns → bool:

no description available

has_log_level(self)#
See also:

set_has_log_level

Returns → bool:

no description available

has_thread(self)#
See also:

set_has_thread

Returns → bool:

no description available

set_has_class(self, arg0)#

Should class information be included? The default is yes.

Parameter arg0 (bool):

no description available

Returns → None:

no description available

set_has_date(self, arg0)#

Should date information be included? The default is yes.

Parameter arg0 (bool):

no description available

Returns → None:

no description available

set_has_log_level(self, arg0)#

Should log level information be included? The default is yes.

Parameter arg0 (bool):

no description available

Returns → None:

no description available

set_has_thread(self, arg0)#

Should thread information be included? The default is yes.

Parameter arg0 (bool):

no description available

Returns → None:

no description available


class mitsuba.DummyStream#

Base class: mitsuba.Stream

Stream implementation that never writes to disk, but keeps track of the size of the content being written. It can be used, for example, to measure the precise amount of memory needed to store serialized content.

__init__(self)#

class mitsuba.FileStream#

Base class: mitsuba.Stream

Simple Stream implementation backed-up by a file.

The underlying file abstraction is std::fstream, and so most operations can be expected to behave similarly.

__init__(self, p, mode=<EMode., ERead)#

Constructs a new FileStream by opening the file pointed by p.

The file is opened in read-only or read/write mode as specified by mode.

Throws if trying to open a non-existing file in with write disabled. Throws an exception if the file cannot be opened / created.

Parameter p (mitsuba.filesystem.path):

no description available

Parameter mode (mitsuba.FileStream.EMode):

no description available

Parameter ERead (0>):

no description available

class EMode#

Members:

ERead#

Opens a file in (binary) read-only mode

EReadWrite#

Opens (but never creates) a file in (binary) read-write mode

ETruncReadWrite#

Opens (and truncates) a file in (binary) read-write mode

__init__(self, value)#
Parameter value (int):

no description available

property EMode.name#
path(self)#

Return the path descriptor associated with this FileStream

Returns → mitsuba.filesystem.path:

no description available


class mitsuba.MemoryStream#

Base class: mitsuba.Stream

Simple memory buffer-based stream with automatic memory management. It always has read & write capabilities.

The underlying memory storage of this implementation dynamically expands as data is written to the stream, à la std::vector.

__init__(self, capacity=512)#

Creates a new memory stream, initializing the memory buffer with a capacity of capacity bytes. For best performance, set this argument to the estimated size of the content that will be written to the stream.

Parameter capacity (int):

no description available

capacity(self)#

Return the current capacity of the underlying memory buffer

Returns → int:

no description available

owns_buffer(self)#

Return whether or not the memory stream owns the underlying buffer

Returns → bool:

no description available


class mitsuba.Stream#

Base class: mitsuba.Object

Abstract seekable stream class

Specifies all functions to be implemented by stream subclasses and provides various convenience functions layered on top of on them.

All read*() and write*() methods support transparent conversion based on the endianness of the underlying system and the value passed to set_byte_order(). Whenever host_byte_order() and byte_order() disagree, the endianness is swapped.

See also:

FileStream, MemoryStream, DummyStream

class EByteOrder#

Defines the byte order (endianness) to use in this Stream

Members:

EBigEndian#
ELittleEndian#

PowerPC, SPARC, Motorola 68K

ENetworkByteOrder#

x86, x86_64

__init__(self, value)#
Parameter value (int):

no description available

property EByteOrder.name#
byte_order(self)#

Returns the byte order of this stream.

Returns → mitsuba.Stream.EByteOrder:

no description available

can_read(self)#

Can we read from the stream?

Returns → bool:

no description available

can_write(self)#

Can we write to the stream?

Returns → bool:

no description available

close(self)#

Closes the stream.

No further read or write operations are permitted.

This function is idempotent. It may be called automatically by the destructor.

Returns → None:

no description available

flush(self)#

Flushes the stream’s buffers, if any

Returns → None:

no description available

host_byte_order()#

Returns the byte order of the underlying machine.

Returns → mitsuba.Stream.EByteOrder:

no description available

read(self, arg0)#

Writes a specified amount of data into the stream. note This does not handle endianness swapping.

Throws an exception when not all data could be written. Implementations need to handle endianness swap when appropriate.

Parameter arg0 (int):

no description available

Returns → bytes:

no description available

read_bool(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_double(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_float(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_int16(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_int32(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_int64(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_int8(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_line(self)#

Convenience function for reading a line of text from an ASCII file

Returns → str:

no description available

read_single(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_string(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_uint16(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_uint32(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_uint64(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

read_uint8(self)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Returns → object:

no description available

seek(self, arg0)#

Seeks to a position inside the stream.

Seeking beyond the size of the buffer will not modify the length of its contents. However, a subsequent write should start at the sought position and update the size appropriately.

Parameter arg0 (int):

no description available

Returns → None:

no description available

set_byte_order(self, arg0)#

Sets the byte order to use in this stream.

Automatic conversion will be performed on read and write operations to match the system’s native endianness.

No consistency is guaranteed if this method is called after performing some read and write operations on the system using a different endianness.

Parameter arg0 (mitsuba.Stream.EByteOrder):

no description available

Returns → None:

no description available

size(self)#

Returns the size of the stream

Returns → int:

no description available

skip(self, arg0)#

Skip ahead by a given number of bytes

Parameter arg0 (int):

no description available

Returns → None:

no description available

tell(self)#

Gets the current position inside the stream

Returns → int:

no description available

truncate(self, arg0)#

Truncates the stream to a given size.

The position is updated to min(old_position, size). Throws an exception if in read-only mode.

Parameter arg0 (int):

no description available

Returns → None:

no description available

write(self, arg0)#

Writes a specified amount of data into the stream. note This does not handle endianness swapping.

Throws an exception when not all data could be written. Implementations need to handle endianness swap when appropriate.

Parameter arg0 (bytes):

no description available

Returns → None:

no description available

write_bool(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (bool):

no description available

Returns → object:

no description available

write_double(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (float):

no description available

Returns → object:

no description available

write_float(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (float):

no description available

Returns → object:

no description available

write_int16(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available

write_int32(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available

write_int64(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available

write_int8(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available

write_line(self, arg0)#

Convenience function for writing a line of text to an ASCII file

Parameter arg0 (str):

no description available

Returns → None:

no description available

write_single(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (float):

no description available

Returns → object:

no description available

write_string(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (str):

no description available

Returns → object:

no description available

write_uint16(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available

write_uint32(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available

write_uint64(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available

write_uint8(self, arg0)#

Reads one object of type T from the stream at the current position by delegating to the appropriate serialization_helper.

Endianness swapping is handled automatically if needed.

Parameter arg0 (int):

no description available

Returns → object:

no description available


class mitsuba.StreamAppender#

Base class: mitsuba.Appender

%Appender implementation, which writes to an arbitrary C++ output stream

__init__(self, arg0)#

Create a new stream appender

Remark:

This constructor is not exposed in the Python bindings

Parameter arg0 (str):

no description available

logs_to_file(self)#

Does this appender log to a file

Returns → bool:

no description available

read_log(self)#

Return the contents of the log file as a string

Returns → str:

no description available


class mitsuba.ZStream#

Base class: mitsuba.Stream

Transparent compression/decompression stream based on zlib.

This class transparently decompresses and compresses reads and writes to a nested stream, respectively.

__init__(self, child_stream, stream_type=<EStreamType., EDeflateStream, level=-1)#

Creates a new compression stream with the given underlying stream. This new instance takes ownership of the child stream. The child stream must outlive the ZStream.

Parameter child_stream (mitsuba.Stream):

no description available

Parameter stream_type (mitsuba.ZStream.EStreamType):

no description available

Parameter EDeflateStream (0>):

no description available

Parameter level (int):

no description available

class EStreamType#

Members:

EDeflateStream#
EGZipStream#

A raw deflate stream

__init__(self, value)#
Parameter value (int):

no description available

property EStreamType.name#
child_stream(self)#

Returns the child stream of this compression stream

Returns → object:

no description available


class mitsuba.FileResolver#

Base class: mitsuba.Object

Simple class for resolving paths on Linux/Windows/Mac OS

This convenience class looks for a file or directory given its name and a set of search paths. The implementation walks through the search paths in order and stops once the file is found.

__init__(self)#

Initialize a new file resolver with the current working directory

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.FileResolver):

no description available

append(self, arg0)#

Append an entry to the end of the list of search paths

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → None:

no description available

clear(self)#

Clear the list of search paths

Returns → None:

no description available

prepend(self, arg0)#

Prepend an entry at the beginning of the list of search paths

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → None:

no description available

resolve(self, arg0)#

Walk through the list of search paths and try to resolve the input path

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → mitsuba.filesystem.path:

no description available


class mitsuba.Formatter#

Base class: mitsuba.Object

Abstract interface for converting log information into a human- readable format

__init__(self)#
format(self, level, class_, thread, file, line, msg)#

Turn a log message into a human-readable format

Parameter level (mitsuba.LogLevel):

The importance of the debug message

Parameter class_ (mitsuba.Class):

Originating class or nullptr

Parameter thread (mitsuba::Thread):

Thread, which is responsible for creating the message

Parameter file (str):

File, which is responsible for creating the message

Parameter line (int):

Associated line within the source file

Parameter msg (str):

Text content associated with the log message

Returns → str:

no description available


mitsuba.Log(level, msg)#
Parameter level (mitsuba.LogLevel):

no description available

Parameter msg (str):

no description available

Returns → None:

no description available


class mitsuba.Loop#
init(self)#
Returns → None:

no description available

put(self, arg0)#
Parameter arg0 (function):

no description available

Returns → None:

no description available

set_eval_stride(self, arg0)#
Parameter arg0 (int):

no description available

Returns → None:

no description available

set_max_iterations(self, arg0)#
Parameter arg0 (int):

no description available

Returns → None:

no description available


class mitsuba.MemoryMappedFile#

Base class: mitsuba.Object

Basic cross-platform abstraction for memory mapped files

Remark:

The Python API has one additional constructor <tt>MemoryMappedFile(filename, array)<tt>, which creates a new file, maps it into memory, and copies the array contents.

__init__(self, filename, size)#

Create a new memory-mapped file of the specified size

Parameter filename (mitsuba.filesystem.path):

no description available

Parameter size (int):

no description available

__init__(self, filename, write=False)#

Map the specified file into memory

Parameter filename (mitsuba.filesystem.path):

no description available

Parameter write (bool):

no description available

__init__(self, filename, array)#
Parameter filename (mitsuba.filesystem.path):

no description available

Parameter array (numpy.ndarray):

no description available

can_write(self)#

Return whether the mapped memory region can be modified

Returns → bool:

no description available

create_temporary(arg0)#

Create a temporary memory-mapped file

Remark:

When closing the mapping, the file is automatically deleted. Mitsuba additionally informs the OS that any outstanding changes that haven’t yet been written to disk can be discarded (Linux/OSX only).

Parameter arg0 (int):

no description available

Returns → mitsuba.MemoryMappedFile:

no description available

data(self)#

Return a pointer to the file contents in memory

Returns → capsule:

no description available

filename(self)#

Return the associated filename

Returns → mitsuba.filesystem.path:

no description available

resize(self, arg0)#

Resize the memory-mapped file

This involves remapping the file, which will generally change the pointer obtained via data()

Parameter arg0 (int):

no description available

Returns → None:

no description available

size(self)#

Return the size of the mapped region

Returns → int:

no description available


class mitsuba.ParamFlags#

This list of flags is used to classify the different types of parameters exposed by the plugins.

For instance, in the context of differentiable rendering, it is important to know which parameters can be differentiated, and which of those might introduce discontinuities in the Monte Carlo simulation.

Members:

Differentiable#

Tracking gradients w.r.t. this parameter is allowed

NonDifferentiable#

Tracking gradients w.r.t. this parameter is not allowed

Discontinuous#

Tracking gradients w.r.t. this parameter will introduce discontinuities

__init__(self, value)#
Parameter value (int):

no description available

property name#

class mitsuba.PluginManager#

The object factory is responsible for loading plugin modules and instantiating object instances.

Ordinarily, this class will be used by making repeated calls to the create_object() methods. The generated instances are then assembled into a final object graph, such as a scene. One such examples is the SceneHandler class, which parses an XML scene file by essentially translating the XML elements into calls to create_object().

get_plugin_class(self, name, variant)#

Return the class corresponding to a plugin for a specific variant

Parameter name (str):

no description available

Parameter variant (str):

no description available

Returns → mitsuba.Class:

no description available

instance()#

Return the global plugin manager

Returns → mitsuba.PluginManager:

no description available


class mitsuba.ScopedSetThreadEnvironment#

RAII-style class to temporarily switch to another thread’s logger/file resolver

__init__(self, arg0)#
Parameter arg0 (mitsuba.ThreadEnvironment):

no description available


class mitsuba.Spiral#

Base class: mitsuba.Object

Generates a spiral of blocks to be rendered.

Author:

Adam Arbree Aug 25, 2005 RayTracer.java Used with permission. Copyright 2005 Program of Computer Graphics, Cornell University

__init__(self, size, block_size=32, passes=1)#

Create a new spiral generator for the given size, offset into a larger frame, and block size

Parameter size (mitsuba.Vector):

no description available

Parameter block_size (int):

no description available

Parameter passes (int):

no description available

block_count(self)#

Return the total number of blocks

Returns → int:

no description available

max_block_size(self)#

Return the maximum block size

Returns → int:

no description available

next_block(self)#

Return the offset, size, and unique identifier of the next block.

A size of zero indicates that the spiral traversal is done.

Returns → Tuple[mitsuba.Vector, int]:

no description available

reset(self)#

Reset the spiral to its initial state. Does not affect the number of passes.

Returns → None:

no description available


class mitsuba.Struct#

Base class: mitsuba.Object

Descriptor for specifying the contents and in-memory layout of a POD- style data record

Remark:

The python API provides an additional dtype() method, which returns the NumPy dtype equivalent of a given Struct instance.

__init__(self, pack=False, byte_order=<ByteOrder., HostByteOrder)#

Create a new Struct and indicate whether the contents are packed or aligned

Parameter pack (bool):

no description available

Parameter byte_order (mitsuba.Struct.ByteOrder):

no description available

Parameter HostByteOrder (2>):

no description available

class ByteOrder#

Members:

LittleEndian :

BigEndian :

HostByteOrder :

__init__(self, value)#
Parameter value (int):

no description available

property ByteOrder.name#
class Field#

Field specifier with size and offset

property Field.blend#

For use with StructConverter::convert()

Specifies a pair of weights and source field names that will be linearly blended to obtain the output field value. Note that this only works for floating point fields or integer fields with the Flags::Normalized flag. Gamma-corrected fields will be blended in linear space.

property Field.flags#

Additional flags

Field.is_float(self)#
Returns → bool:

no description available

Field.is_integer(self)#
Returns → bool:

no description available

Field.is_signed(self)#
Returns → bool:

no description available

Field.is_unsigned(self)#
Returns → bool:

no description available

property Field.name#

Name of the field

property Field.offset#

Offset within the Struct (in bytes)

Field.range(self)#
Returns → Tuple[float, float]:

no description available

property Field.size#

Size in bytes

property Field.type#

Type identifier

class Flags#

Members:

Normalized#

Specifies whether an integer field encodes a normalized value in the range [0, 1]. The flag is ignored if specified for floating point valued fields.

Gamma#

Specifies whether the field encodes a sRGB gamma-corrected value. Assumes Normalized is also specified.

Weight#

In FieldConverter::convert, when an input structure contains a weight field, the value of all entries are considered to be expressed relative to its value. Converting to an un-weighted structure entails a division by the weight.

Assert#

In FieldConverter::convert, check that the field value matches the specified default value. Otherwise, return a failure

Alpha#

Specifies whether the field encodes an alpha value

PremultipliedAlpha#

Specifies whether the field encodes an alpha premultiplied value

Default#

In FieldConverter::convert, when the field is missing in the source record, replace it by the specified default value

__init__(self, value)#
Parameter value (int):

no description available

property Flags.name#
class Type#

Members:

Int8 :

UInt8 :

Int16 :

UInt16 :

Int32 :

UInt32 :

Int64 :

UInt64 :

Float16 :

Float32 :

Float64 :

Invalid :

__init__(self, value)#
Parameter value (int):

no description available

__init__(self, dtype)#
Parameter dtype (dtype):

no description available

property Type.name#
alignment(self)#

Return the alignment (in bytes) of the data structure

Returns → int:

no description available

append(self, name, type, flags=<Flags.???: 0>, default=0.0)#

Append a new field to the Struct; determines size and offset automatically

Parameter name (str):

no description available

Parameter type (mitsuba.Struct.Type):

no description available

Parameter flags (int):

no description available

Parameter default (float):

no description available

Returns → mitsuba.Struct:

no description available

byte_order(self)#

Return the byte order of the Struct

Returns → mitsuba.Struct.ByteOrder:

no description available

dtype(self)#

Return a NumPy dtype corresponding to this data structure

Returns → dtype:

no description available

field(self, arg0)#

Look up a field by name (throws an exception if not found)

Parameter arg0 (str):

no description available

Returns → mitsuba.Struct.Field:

no description available

field_count(self)#

Return the number of fields

Returns → int:

no description available

has_field(self, arg0)#

Check if the Struct has a field of the specified name

Parameter arg0 (str):

no description available

Returns → bool:

no description available

is_float(arg0)#

Check whether the given type is a floating point type

Parameter arg0 (mitsuba.Struct.Type):

no description available

Returns → bool:

no description available

is_integer(arg0)#

Check whether the given type is an integer type

Parameter arg0 (mitsuba.Struct.Type):

no description available

Returns → bool:

no description available

is_signed(arg0)#

Check whether the given type is a signed type

Parameter arg0 (mitsuba.Struct.Type):

no description available

Returns → bool:

no description available

is_unsigned(arg0)#

Check whether the given type is an unsigned type

Parameter arg0 (mitsuba.Struct.Type):

no description available

Returns → bool:

no description available

range(arg0)#

Return the representable range of the given type

Parameter arg0 (mitsuba.Struct.Type):

no description available

Returns → Tuple[float, float]:

no description available

size(self)#

Return the size (in bytes) of the data structure, including padding

Returns → int:

no description available


class mitsuba.StructConverter#

Base class: mitsuba.Object

This class solves the any-to-any problem: efficiently converting from one kind of structured data representation to another

Graphics applications often need to convert from one kind of structured representation to another, for instance when loading/saving image or mesh data. Consider the following data records which both describe positions tagged with color data.

struct Source { // <-- Big endian! :(
   uint8_t r, g, b; // in sRGB
   half x, y, z;
};

struct Target { // <-- Little endian!
   float x, y, z;
   float r, g, b, a; // in linear space
};

The record Source may represent what is stored in a file on disk, while Target represents the expected input of the implementation. Not only are the formats (e.g. float vs half or uint8_t, incompatible endianness) and encodings different (e.g. gamma correction vs linear space), but the second record even has a different order and extra fields that don’t exist in the first one.

This class provides a routine convert() which <ol>

  • reorders entries

  • converts between many different formats (u[int]8-64, float16-64)

  • performs endianness conversion

  • applies or removes gamma correction

  • optionally checks that certain entries have expected default values

  • substitutes missing values with specified defaults

  • performs linear transformations of groups of fields (e.g. between

different RGB color spaces)

  • applies dithering to avoid banding artifacts when converting 2D

images

</ol>

The above operations can be arranged in countless ways, which makes it hard to provide an efficient generic implementation of this functionality. For this reason, the implementation of this class relies on a JIT compiler that generates fast conversion code on demand for each specific conversion. The function is cached and reused in case the same conversion is needed later on. Note that JIT compilation only works on x86_64 processors; other platforms use a slow generic fallback implementation.

__init__(self, source, target, dither=False)#
Parameter source (mitsuba.Struct):

no description available

Parameter target (mitsuba.Struct):

no description available

Parameter dither (bool):

no description available

convert(self, arg0)#
Parameter arg0 (bytes):

no description available

Returns → bytes:

no description available

source(self)#

Return the source Struct descriptor

Returns → mitsuba.Struct:

no description available

target(self)#

Return the target Struct descriptor

Returns → mitsuba.Struct:

no description available


class mitsuba.Thread#

Base class: mitsuba.Object

Cross-platform thread implementation

Mitsuba threads are internally implemented via the std::thread class defined in C++11. This wrapper class is needed to attach additional state (Loggers, Path resolvers, etc.) that is inherited when a thread launches another thread.

__init__(self, name)#
Parameter name (str):

no description available

class EPriority#

Possible priority values for Thread::set_priority()

Members:

EIdlePriority#
ELowestPriority#
ELowPriority#
ENormalPriority#
EHighPriority#
EHighestPriority#
ERealtimePriority#
__init__(self, value)#
Parameter value (int):

no description available

property EPriority.name#
core_affinity(self)#

Return the core affinity

Returns → int:

no description available

detach(self)#

Detach the thread and release resources

After a call to this function, join() cannot be used anymore. This releases resources, which would otherwise be held until a call to join().

Returns → None:

no description available

file_resolver(self)#

Return the file resolver associated with the current thread

Returns → mitsuba.FileResolver:

no description available

is_critical(self)#

Return the value of the critical flag

Returns → bool:

no description available

is_running(self)#

Is this thread still running?

Returns → bool:

no description available

join(self)#

Wait until the thread finishes

Returns → None:

no description available

logger(self)#

Return the thread’s logger instance

Returns → mitsuba.Logger:

no description available

name(self)#

Return the name of this thread

Returns → str:

no description available

parent(self)#

Return the parent thread

Returns → mitsuba.Thread:

no description available

priority(self)#

Return the thread priority

Returns → mitsuba.Thread.EPriority:

no description available

register_external_thread(arg0)#

Register a new thread (e.g. Dr.Jit, Python) with Mitsuba thread system. Returns true upon success.

Parameter arg0 (str):

no description available

Returns → bool:

no description available

set_core_affinity(self, arg0)#

Set the core affinity

This function provides a hint to the operating system scheduler that the thread should preferably run on the specified processor core. By default, the parameter is set to -1, which means that there is no affinity.

Parameter arg0 (int):

no description available

Returns → None:

no description available

set_critical(self, arg0)#

Specify whether or not this thread is critical

When an thread marked critical crashes from an uncaught exception, the whole process is brought down. The default is False.

Parameter arg0 (bool):

no description available

Returns → None:

no description available

set_file_resolver(self, arg0)#

Set the file resolver associated with the current thread

Parameter arg0 (mitsuba.FileResolver):

no description available

Returns → None:

no description available

set_logger(self, arg0)#

Set the logger instance used to process log messages from this thread

Parameter arg0 (mitsuba.Logger):

no description available

Returns → None:

no description available

set_name(self, arg0)#

Set the name of this thread

Parameter arg0 (str):

no description available

Returns → None:

no description available

set_priority(self, arg0)#

Set the thread priority

This does not always work – for instance, Linux requires root privileges for this operation.

Parameter arg0 (mitsuba.Thread.EPriority):

no description available

Returns → bool:

True upon success.

sleep(arg0)#

Sleep for a certain amount of time (in milliseconds)

Parameter arg0 (int):

no description available

Returns → None:

no description available

start(self)#

Start the thread

Returns → None:

no description available

thread()#

Return the current thread

Returns → mitsuba.Thread:

no description available

thread_id()#

Return a unique ID that is associated with this thread

Returns → int:

no description available

wait_for_tasks()#

Wait for previously registered nanothread tasks to complete

Returns → None:

no description available


class mitsuba.ThreadEnvironment#

Captures a thread environment (logger and file resolver). Used with ScopedSetThreadEnvironment

__init__(self)#

class mitsuba.Timer#
begin_stage(self, arg0)#
Parameter arg0 (str):

no description available

Returns → None:

no description available

end_stage(self, arg0)#
Parameter arg0 (str):

no description available

Returns → None:

no description available

reset(self)#
Returns → int:

no description available

value(self)#
Returns → int:

no description available


mitsuba.filesystem.absolute(arg0)#

Returns an absolute path to the same location pointed by p, relative to base.

See also:

http ://en.cppreference.com/w/cpp/experimental/fs/absolute)

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → mitsuba.filesystem.path:

no description available


mitsuba.filesystem.create_directory(arg0)#

Creates a directory at p as if mkdir was used. Returns true if directory creation was successful, false otherwise. If p already exists and is already a directory, the function does nothing (this condition is not treated as an error).

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → bool:

no description available


mitsuba.filesystem.current_path()#

Returns the current working directory (equivalent to getcwd)

Returns → mitsuba.filesystem.path:

no description available


mitsuba.filesystem.equivalent(arg0, arg1)#

Checks whether two paths refer to the same file system object. Both must refer to an existing file or directory. Symlinks are followed to determine equivalence.

Parameter arg0 (mitsuba.filesystem.path):

no description available

Parameter arg1 (mitsuba.filesystem.path):

no description available

Returns → bool:

no description available


mitsuba.filesystem.exists(arg0)#

Checks if p points to an existing filesystem object.

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → bool:

no description available


mitsuba.filesystem.file_size(arg0)#

Returns the size (in bytes) of a regular file at p. Attempting to determine the size of a directory (as well as any other file that is not a regular file or a symlink) is treated as an error.

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → int:

no description available


mitsuba.filesystem.is_directory(arg0)#

Checks if p points to a directory.

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → bool:

no description available


mitsuba.filesystem.is_regular_file(arg0)#

Checks if p points to a regular file, as opposed to a directory or symlink.

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → bool:

no description available


class mitsuba.filesystem.path#

Represents a path to a filesystem resource. On construction, the path is parsed and stored in a system-agnostic representation. The path can be converted back to the system-specific string using native() or string().

__init__(self)#

Default constructor. Constructs an empty path. An empty path is considered relative.

__init__(self, arg0)#

Copy constructor.

Parameter arg0 (mitsuba.filesystem.path):

no description available

__init__(self, arg0)#

Construct a path from a string with native type. On Windows, the path can use both ‘/’ or ‘\’ as a delimiter.

Parameter arg0 (str):

no description available

clear(self)#

Makes the path an empty path. An empty path is considered relative.

Returns → None:

no description available

empty(self)#

Checks if the path is empty

Returns → bool:

no description available

extension(self)#

Returns the extension of the filename component of the path (the substring starting at the rightmost period, including the period). Special paths ‘.’ and ‘..’ have an empty extension.

Returns → mitsuba.filesystem.path:

no description available

filename(self)#

Returns the filename component of the path, including the extension.

Returns → mitsuba.filesystem.path:

no description available

is_absolute(self)#

Checks if the path is absolute.

Returns → bool:

no description available

is_relative(self)#

Checks if the path is relative.

Returns → bool:

no description available

native(self)#

Returns the path in the form of a native string, so that it can be passed directly to system APIs. The path is constructed using the system’s preferred separator and the native string type.

Returns → str:

no description available

parent_path(self)#

Returns the path to the parent directory. Returns an empty path if it is already empty or if it has only one element.

Returns → mitsuba.filesystem.path:

no description available

replace_extension(self, arg0)#

Replaces the substring starting at the rightmost ‘.’ symbol by the provided string.

A ‘.’ symbol is automatically inserted if the replacement does not start with a dot. Removes the extension altogether if the empty path is passed. If there is no extension, appends a ‘.’ followed by the replacement. If the path is empty, ‘.’ or ‘..’, the method does nothing.

Returns *this.

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → mitsuba.filesystem.path:

no description available


mitsuba.filesystem.preferred_separator: str = /#

mitsuba.filesystem.remove(arg0)#

Removes a file or empty directory. Returns true if removal was successful, false if there was an error (e.g. the file did not exist).

Parameter arg0 (mitsuba.filesystem.path):

no description available

Returns → bool:

no description available


mitsuba.filesystem.resize_file(arg0, arg1)#

Changes the size of the regular file named by p as if truncate was called. If the file was larger than target_length, the remainder is discarded. The file must exist.

Parameter arg0 (mitsuba.filesystem.path):

no description available

Parameter arg1 (int):

no description available

Returns → bool:

no description available


mitsuba.has_flag(overloaded)#
has_flag(arg0, arg1)#
Parameter arg0 (int):

no description available

Parameter arg1 (mitsuba.EmitterFlags):

no description available

Returns → bool:

no description available

has_flag(arg0, arg1)#
Parameter arg0 (drjit.llvm.ad.UInt):

no description available

Parameter arg1 (mitsuba.EmitterFlags):

no description available

Returns → drjit.llvm.ad.Bool:

no description available

has_flag(arg0, arg1)#
Parameter arg0 (int):

no description available

Parameter arg1 (mitsuba.RayFlags):

no description available

Returns → bool:

no description available

has_flag(arg0, arg1)#
Parameter arg0 (drjit.llvm.ad.UInt):

no description available

Parameter arg1 (mitsuba.RayFlags):

no description available

Returns → drjit.llvm.ad.Bool:

no description available

has_flag(arg0, arg1)#
Parameter arg0 (int):

no description available

Parameter arg1 (mitsuba.BSDFFlags):

no description available

Returns → bool:

no description available

has_flag(arg0, arg1)#
Parameter arg0 (drjit.llvm.ad.UInt):

no description available

Parameter arg1 (mitsuba.BSDFFlags):

no description available

Returns → drjit.llvm.ad.Bool:

no description available

has_flag(arg0, arg1)#
Parameter arg0 (int):

no description available

Parameter arg1 (mitsuba.FilmFlags):

no description available

Returns → bool:

no description available

has_flag(arg0, arg1)#
Parameter arg0 (drjit.llvm.ad.UInt):

no description available

Parameter arg1 (mitsuba.FilmFlags):

no description available

Returns → drjit.llvm.ad.Bool:

no description available

has_flag(arg0, arg1)#
  1. has_flag(arg0: drjit.llvm.ad.UInt, arg1: mitsuba.PhaseFunctionFlags) -> bool

Parameter arg0 (int):

no description available

Parameter arg1 (mitsuba.PhaseFunctionFlags):

no description available

Returns → bool:

no description available


mitsuba.register_bsdf(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_emitter(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_film(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_integrator(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_medium(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_mesh(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_phasefunction(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_sampler(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_sensor(overloaded)#
register_sensor(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

register_sensor(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available


mitsuba.register_texture(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


mitsuba.register_volume(arg0, arg1)#
Parameter arg0 (str):

no description available

Parameter arg1 (Callable[[mitsuba.Properties], object]):

no description available

Returns → None:

no description available


class mitsuba.TraversalCallback#

Abstract class providing an interface for traversing scene graphs

This interface can be implemented either in C++ or in Python, to be used in conjunction with Object::traverse() to traverse a scene graph. Mitsuba currently uses this mechanism to determine a scene’s differentiable parameters.

__init__(self)#
put_object(self, name, obj, flags)#

Inform the traversal callback that the instance references another Mitsuba object

Parameter name (str):

no description available

Parameter obj (mitsuba::Object):

no description available

Parameter flags (int):

no description available

Returns → None:

no description available

put_parameter(self, name, value, flags)#

Inform the traversal callback about an attribute of an instance

Parameter name (str):

no description available

Parameter value (object):

no description available

Parameter flags (mitsuba.ParamFlags):

no description available

Returns → None:

no description available


Parsing#

mitsuba.load_dict(dict)#

Load a Mitsuba scene or object from an Python dictionary

Parameter dict (dict):

Python dictionary containing the object description

Returns → object:

no description available


mitsuba.load_file(path, update_scene=False, parallel=False, **kwargs)#

Load a Mitsuba scene from an XML file

Parameter path (str):

Filename of the scene XML file

Parameter parameters:

Optional list of parameters that can be referenced as $varname in the scene.

Parameter variant:

Specifies the variant of plugins to instantiate (e.g. “scalar_rgb”)

Parameter update_scene (bool):

When Mitsuba updates scene to a newer version, should the updated XML file be written back to disk?

Parameter parallel (bool):

no description available

Returns → object:

no description available


mitsuba.load_string(string, parallel=False, **kwargs)#

Load a Mitsuba scene from an XML string

Parameter string (str):

no description available

Parameter parallel (bool):

no description available

Returns → object:

no description available


mitsuba.xml.dict_to_xml()#

Converts a Mitsuba dictionary into its XML representation.

Parameter scene_dict:

Mitsuba dictionary

Parameter filename:

Output filename

Parameter split_files:

Whether to split the scene into multiple files (default: False)


mitsuba.xml_to_props(path)#

Get the names and properties of the objects described in a Mitsuba XML file

Parameter path (str):

no description available

Returns → List[Tuple[str, mitsuba.Properties]]:

no description available


Object#

class mitsuba.Object#

Object base class with builtin reference counting

This class (in conjunction with the ref reference counter) constitutes the foundation of an efficient reference-counted object hierarchy. The implementation here is an alternative to standard mechanisms for reference counting such as std::shared_ptr from the STL.

Why not simply use std::shared_ptr? To be spec-compliant, such shared pointers must associate a special record with every instance, which stores at least two counters plus a deletion function. Allocating this record naturally incurs further overheads to maintain data structures within the memory allocator. In addition to this, the size of an individual shared_ptr references is at least two data words. All of this quickly adds up and leads to significant overheads for large collections of instances, hence the need for an alternative in Mitsuba.

In contrast, the Object class allows for a highly efficient implementation that only adds 32 bits to the base object (for the counter) and has no overhead for references.

__init__(self)#

Default constructor

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.Object):

no description available

class_(self)#

Return a Class instance containing run-time type information about this Object

See also:

Class

Returns → mitsuba.Class:

no description available

dec_ref(self, dealloc=True)#

Decrease the reference count of the object and possibly deallocate it.

The object will automatically be deallocated once the reference count reaches zero.

Parameter dealloc (bool):

no description available

Returns → None:

no description available

expand(self)#

Expand the object into a list of sub-objects and return them

In some cases, an Object instance is merely a container for a number of sub-objects. In the context of Mitsuba, an example would be a combined sun & sky emitter instantiated via XML, which recursively expands into a separate sun & sky instance. This functionality is supported by any Mitsuba object, hence it is located this level.

Returns → list:

no description available

id(self)#

Return an identifier of the current instance (if available)

Returns → str:

no description available

inc_ref(self)#

Increase the object’s reference count by one

Returns → None:

no description available

parameters_changed(self, keys=[])#

Update internal state after applying changes to parameters

This function should be invoked when attributes (obtained via traverse) are modified in some way. The object can then update its internal state so that derived quantities are consistent with the change.

Parameter keys (List[str]):

Optional list of names (obtained via traverse) corresponding to the attributes that have been modified. Can also be used to notify when this function is called from a parent object by adding a “parent” key to the list. When empty, the object should assume that any attribute might have changed.

Remark:

The default implementation does nothing.

See also:

TraversalCallback

Returns → None:

no description available

ref_count(self)#

Return the current reference count

Returns → int:

no description available

set_id(self, id)#

Set an identifier to the current instance (if applicable)

Parameter id (str):

no description available

Returns → None:

no description available

traverse(self, cb)#

Traverse the attributes and object graph of this instance

Implementing this function enables recursive traversal of C++ scene graphs. It is e.g. used to determine the set of differentiable parameters when using Mitsuba for optimization.

Remark:

The default implementation does nothing.

See also:

TraversalCallback

Parameter cb (mitsuba.TraversalCallback):

no description available

Returns → None:

no description available


class mitsuba.ObjectPtr#
__init__(self)#
__init__(self, arg0)#
Parameter arg0 (mitsuba.Object):

no description available

assign(self, arg0)#
Parameter arg0 (mitsuba.ObjectPtr):

no description available

Returns → None:

no description available

entry_(self, arg0)#
Parameter arg0 (int):

no description available

Returns → mitsuba.Object:

no description available

eq_(self, arg0)#
Parameter arg0 (mitsuba.ObjectPtr):

no description available

Returns → drjit.llvm.ad.Bool:

no description available

gather_(source, index, mask, permute=False)#
Parameter source (mitsuba.ObjectPtr):

no description available

Parameter index (drjit.llvm.ad.UInt):

no description available

Parameter mask (drjit.llvm.ad.Bool):

no description available

Parameter permute (bool):

no description available

Returns → mitsuba.ObjectPtr:

no description available

label_(self)#
Returns → str:

no description available

neq_(self, arg0)#
Parameter arg0 (mitsuba.ObjectPtr):

no description available

Returns → drjit.llvm.ad.Bool:

no description available

reinterpret_array_(arg0)#
Parameter arg0 (drjit.llvm.ad.UInt):

no description available

Returns → mitsuba.ObjectPtr:

no description available

select_(arg0, arg1, arg2)#
Parameter arg0 (drjit.llvm.ad.Bool):

no description available

Parameter arg1 (mitsuba.ObjectPtr):

no description available

Parameter arg2 (mitsuba.ObjectPtr):

no description available

Returns → mitsuba.ObjectPtr:

no description available

set_index_(self, arg0)#
Parameter arg0 (int):

no description available

Returns → None:

no description available

set_label_(self, arg0)#
Parameter arg0 (str):

no description available

Returns → None:

no description available

zero_()#

(arg0: int) -> mitsuba.llvm_ad_rgb.ObjectPtr


class mitsuba.Class#

Stores meta-information about Object instances.

This class provides a thin layer of RTTI (run-time type information), which is useful for doing things like:

  • Checking if an object derives from a certain class

  • Determining the parent of a class at runtime

  • Instantiating a class by name

  • Unserializing a class from a binary data stream

See also:

ref, Object

alias(self)#

Return the scene description-specific alias, if applicable

Returns → str:

no description available

name(self)#

Return the name of the class

Returns → str:

no description available

parent(self)#

Return the Class object associated with the parent class of nullptr if it does not have one.

Returns → mitsuba.Class:

no description available

variant(self)#

Return the variant of the class

Returns → str:

no description available


Properties#

class mitsuba.Properties#

Associative parameter map for constructing subclasses of Object.

Note that the Python bindings for this class do not implement the various type-dependent getters and setters. Instead, they are accessed just like a normal Python map, e.g:

myProps = mitsuba.core.Properties("plugin_name")
myProps["stringProperty"] = "hello"
myProps["spectrumProperty"] = mitsuba.core.Spectrum(1.0)

or using the get(key, default) method.

__init__(self)#

Construct an empty property container

__init__(self, arg0)#

Construct an empty property container with a specific plugin name

Parameter arg0 (str):

no description available

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.Properties):

no description available

class Type#

Members:

Bool

Long

Float

Array3f

Transform

AnimatedTransform

Color

String

NamedReference

Object

Pointer

__init__(self, value)#
Parameter value (int):

no description available

property Type.name#
animated_transform(self, arg0, arg1)#

Retrieve an animated transformation (use default value if no entry exists)

Parameter arg0 (str):

no description available

Parameter arg1 (mitsuba::AnimatedTransform):

no description available

Returns → object:

no description available

copy_attribute(self, arg0, arg1, arg2)#

Copy a single attribute from another Properties object and potentially rename it

Parameter arg0 (mitsuba.Properties):

no description available

Parameter arg1 (str):

no description available

Parameter arg2 (str):

no description available

Returns → None:

no description available

get(self, key, def_value=None)#

Return the value for the specified key it exists, otherwise return default value

Parameter key (str):

no description available

Parameter def_value (object):

no description available

Returns → object:

no description available

has_property(self, arg0)#

Verify if a value with the specified name exists

Parameter arg0 (str):

no description available

Returns → bool:

no description available

id(self)#

Returns a unique identifier associated with this instance (or an empty string)

Returns → str:

no description available

mark_queried(self, arg0)#

Manually mark a certain property as queried

Parameter arg0 (str):

no description available

Returns → bool:

True upon success

merge(self, arg0)#

Merge another properties record into the current one.

Existing properties will be overwritten with the values from props if they have the same name.

Parameter arg0 (mitsuba.Properties):

no description available

Returns → None:

no description available

named_references(self)#
Returns → List[Tuple[str, str]]:

no description available

plugin_name(self)#

Get the associated plugin name

Returns → str:

no description available

property_names(self)#

Return an array containing the names of all stored properties

Returns → List[str]:

no description available

remove_property(self, arg0)#

Remove a property with the specified name

Parameter arg0 (str):

no description available

Returns → bool:

True upon success

set_id(self, arg0)#

Set the unique identifier associated with this instance

Parameter arg0 (str):

no description available

Returns → None:

no description available

set_plugin_name(self, arg0)#

Set the associated plugin name

Parameter arg0 (str):

no description available

Returns → None:

no description available

string(self, arg0, arg1)#

Retrieve a string value (use default value if no entry exists)

Parameter arg0 (str):

no description available

Parameter arg1 (str):

no description available

Returns → object:

no description available

type(self, arg0)#

Returns the type of an existing property. If no property exists under that name, an error is logged and type void is returned.

Parameter arg0 (str):

no description available

Returns → mitsuba::Properties::Type:

no description available

unqueried(self)#

Return the list of un-queried attributed

Returns → List[str]:

no description available

was_queried(self, arg0)#

Check if a certain property was queried

Parameter arg0 (str):

no description available

Returns → bool:

no description available


Bitmap#

class mitsuba.Bitmap#

Base class: mitsuba.Object

General-purpose bitmap class with read and write support for several common file formats.

This class handles loading of PNG, JPEG, BMP, TGA, as well as OpenEXR files, and it supports writing of PNG, JPEG and OpenEXR files.

PNG and OpenEXR files are optionally annotated with string-valued metadata, and the gamma setting can be stored as well. Please see the class methods and enumerations for further detail.

__init__(self, pixel_format, component_format, size, channel_count=0, channel_names=[])#

Create a bitmap of the specified type and allocate the necessary amount of memory

Parameter pixel_format (mitsuba.Bitmap.PixelFormat):

Specifies the pixel format (e.g. RGBA or Luminance-only)

Parameter component_format (mitsuba.Struct.Type):

Specifies how the per-pixel components are encoded (e.g. unsigned 8 bit integers or 32-bit floating point values). The component format struct_type_v<Float> will be translated to the corresponding compile-time precision type (Float32 or Float64).

Parameter size (mitsuba.Vector):

Specifies the horizontal and vertical bitmap size in pixels

Parameter channel_count (int):

Channel count of the image. This parameter is only required when pixel_format = PixelFormat::MultiChannel

Parameter channel_names (List[str]):

Channel names of the image. This parameter is optional, and only used when pixel_format = PixelFormat::MultiChannel

Parameter data:

External pointer to the image data. If set to nullptr, the implementation will allocate memory itself.

__init__(self, arg0)#
Parameter arg0 (mitsuba.Bitmap):

no description available

__init__(self, path, format=<FileFormat., Auto)#
Parameter path (mitsuba.filesystem.path):

no description available

Parameter format (mitsuba.Bitmap.FileFormat):

no description available

Parameter Auto (9>):

no description available

__init__(self, stream, format=<FileFormat., Auto)#
Parameter stream (mitsuba.Stream):

no description available

Parameter format (mitsuba.Bitmap.FileFormat):

no description available

Parameter Auto (9>):

no description available

__init__(self, array, pixel_format=None, channel_names=[])#

Initialize a Bitmap from any array that implements __array_interface__

Parameter array (mitsuba.PyObjectWrapper):

no description available

Parameter pixel_format (object):

no description available

Parameter channel_names (List[str]):

no description available

class AlphaTransform#

Type of alpha transformation

Members:

None#

No transformation (default)

Premultiply#

No transformation (default)

Unpremultiply#

No transformation (default)

__init__(self, value)#
Parameter value (int):

no description available

property AlphaTransform.name#
class FileFormat#

Supported image file formats

Members:

PNG#

Portable network graphics

The following is supported:

  • Loading and saving of 8/16-bit per component bitmaps for all pixel formats (Y, YA, RGB, RGBA)

  • Loading and saving of 1-bit per component mask bitmaps

  • Loading and saving of string-valued metadata fields

OpenEXR#

OpenEXR high dynamic range file format developed by Industrial Light & Magic (ILM)

The following is supported:

  • Loading and saving of Float16 / Float32/ UInt32 bitmaps with all supported RGB/Luminance/Alpha combinations

  • Loading and saving of spectral bitmaps

  • Loading and saving of XYZ tristimulus bitmaps

  • Loading and saving of string-valued metadata fields

The following is not supported:

  • Saving of tiled images, tile-based read access

  • Display windows that are different than the data window

  • Loading of spectrum-valued bitmaps

RGBE#

RGBE image format by Greg Ward

The following is supported

  • Loading and saving of Float32 - based RGB bitmaps

PFM#

PFM (Portable Float Map) image format

The following is supported

  • Loading and saving of Float32 - based Luminance or RGB bitmaps

PPM#

PPM (Portable Pixel Map) image format

The following is supported

  • Loading and saving of UInt8 and UInt16 - based RGB bitmaps

JPEG#

Joint Photographic Experts Group file format

The following is supported:

  • Loading and saving of 8 bit per component RGB and luminance bitmaps

TGA#

Truevision Advanced Raster Graphics Array file format

The following is supported:

  • Loading of uncompressed 8-bit RGB/RGBA files

BMP#

Windows Bitmap file format

The following is supported:

  • Loading of uncompressed 8-bit luminance and RGBA bitmaps

Unknown#

Unknown file format

Auto#

Automatically detect the file format

Note: this flag only applies when loading a file. In this case, the source stream must support the seek() operation.

__init__(self, value)#
Parameter value (int):

no description available

property FileFormat.name#
class PixelFormat#

This enumeration lists all pixel format types supported by the Bitmap class. This both determines the number of channels, and how they should be interpreted

Members:

Y#

Single-channel luminance bitmap

YA#

Two-channel luminance + alpha bitmap

RGB#

RGB bitmap

RGBA#

RGB bitmap + alpha channel

RGBW#

RGB bitmap + weight (used by ImageBlock)

RGBAW#

RGB bitmap + alpha channel + weight (used by ImageBlock)

XYZ#

XYZ tristimulus bitmap

XYZA#

XYZ tristimulus + alpha channel

MultiChannel#

Arbitrary multi-channel bitmap without a fixed interpretation

__init__(self, value)#
Parameter value (int):

no description available

property PixelFormat.name#
accumulate(overloaded)#
accumulate(self, bitmap, source_offset)#

Accumulate the contents of another bitmap into the region with the specified offset

Out-of-bounds regions are safely ignored. It is assumed that bitmap != this.

Remark:

This function throws an exception when the bitmaps use different component formats or channels.

Parameter bitmap (mitsuba.Bitmap):

no description available

Parameter source_offset (mitsuba.Point):

no description available

accumulate(self, bitmap, target_offset)#

Accumulate the contents of another bitmap into the region with the specified offset

This convenience function calls the main accumulate() implementation with size set to bitmap->size() and source_offset set to zero. Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remark:

This function throws an exception when the bitmaps use different component formats or channels.

Parameter bitmap (mitsuba.Bitmap):

no description available

Parameter target_offset (mitsuba.Point):

no description available

accumulate(self, bitmap)#

Accumulate the contents of another bitmap into the region with the specified offset

This convenience function calls the main accumulate() implementation with size set to bitmap->size() and source_offset and target_offset set to zero. Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remark:

This function throws an exception when the bitmaps use different component formats or channels.

Parameter bitmap (mitsuba.Bitmap):

no description available

buffer_size(self)#

Return the bitmap size in bytes (excluding metadata)

Returns → int:

no description available

bytes_per_pixel(self)#

Return the number bytes of storage used per pixel

Returns → int:

no description available

channel_count(self)#

Return the number of channels used by this bitmap

Returns → int:

no description available

clear(self)#

Clear the bitmap to zero

Returns → None:

no description available

component_format(self)#

Return the component format of this bitmap

Returns → mitsuba.Struct.Type:

no description available

convert(overloaded)#
convert(self, pixel_format=None, component_format=None, srgb_gamma=None, alpha_transform=<AlphaTransform., None)#

Convert the bitmap into another pixel and/or component format

This helper function can be used to efficiently convert a bitmap between different underlying representations. For instance, it can translate a uint8 sRGB bitmap to a linear float32 XYZ bitmap based on half-, single- or double-precision floating point-backed storage.

This function roughly does the following:

  • For each pixel and channel, it converts the associated value into a normalized linear-space form (any gamma of the source bitmap is removed)

  • gamma correction (sRGB ramp) is applied if srgb_gamma is True

  • The corrected value is clamped against the representable range of the desired component format.

  • The clamped gamma-corrected value is then written to the new bitmap

If the pixel formats differ, this function will also perform basic conversions (e.g. spectrum to rgb, luminance to uniform spectrum values, etc.)

Note that the alpha channel is assumed to be linear in both the source and target bitmap, hence it won’t be affected by any gamma-related transformations.

Remark:

This convert() variant usually returns a new bitmap instance. When the conversion would just involve copying the original bitmap, the function becomes a no-op and returns the current instance.

pixel_format Specifies the desired pixel format

component_format Specifies the desired component format

srgb_gamma Specifies whether a sRGB gamma ramp should be applied to the output values.

Parameter pixel_format (object):

no description available

Parameter component_format (object):

no description available

Parameter srgb_gamma (object):

no description available

Parameter alpha_transform (mitsuba.Bitmap.AlphaTransform):

no description available

Parameter None (0>):

no description available

Returns → mitsuba.Bitmap:

no description available

convert(self, target)#
Parameter target (mitsuba.Bitmap):

no description available

detect_file_format(arg0)#

Attempt to detect the bitmap file format in a given stream

Parameter arg0 (mitsuba.Stream):

no description available

Returns → mitsuba.Bitmap.FileFormat:

no description available

has_alpha(self)#

Return whether this image has an alpha channel

Returns → bool:

no description available

height(self)#

Return the bitmap’s height in pixels

Returns → int:

no description available

metadata(self)#

Return a Properties object containing the image metadata

Returns → mitsuba::Properties:

no description available

pixel_count(self)#

Return the total number of pixels

Returns → int:

no description available

pixel_format(self)#

Return the pixel format of this bitmap

Returns → mitsuba.Bitmap.PixelFormat:

no description available

premultiplied_alpha(self)#

Return whether the bitmap uses premultiplied alpha

Returns → bool:

no description available

resample(overloaded)#
resample(self, target, rfilter=None, bc=(<FilterBoundaryCondition., Clamp, Clamp, clamp=(-inf, inf), temp=None)#

Up- or down-sample this image to a different resolution

Uses the provided reconstruction filter and accounts for the requested horizontal and vertical boundary conditions when looking up data outside of the input domain.

A minimum and maximum image value can be specified to prevent to prevent out-of-range values that are created by the resampling process.

The optional temp parameter can be used to pass an image of resolution Vector2u(target->width(), this->height()) to avoid intermediate memory allocations.

Parameter target (mitsuba.Bitmap):

Pre-allocated bitmap of the desired target resolution

Parameter rfilter (mitsuba.ReconstructionFilter):

A separable image reconstruction filter (default: 2-lobe Lanczos filter)

Parameter bch:

Horizontal and vertical boundary conditions (default: clamp)

Parameter clamp (Tuple[float, float]):

Filtered image pixels will be clamped to the following range. Default: -infinity..infinity (i.e. no clamping is used)

Parameter temp (mitsuba.Bitmap):

Optional: image for intermediate computations

Parameter bc (Tuple[mitsuba.FilterBoundaryCondition, mitsuba.FilterBoundaryCondition]):

no description available

Parameter Clamp (0>, <FilterBoundaryCondition.):

no description available

Parameter Clamp (0>)):

no description available

resample(self, res=None, bc=(<FilterBoundaryCondition., Clamp, Clamp, clamp=(-inf, inf))#

Up- or down-sample this image to a different resolution

This version is similar to the above resample() function – the main difference is that it does not work with preallocated bitmaps and takes the desired output resolution as first argument.

Uses the provided reconstruction filter and accounts for the requested horizontal and vertical boundary conditions when looking up data outside of the input domain.

A minimum and maximum image value can be specified to prevent to prevent out-of-range values that are created by the resampling process.

Parameter res (mitsuba.Vector):

Desired output resolution

Parameter rfilter:

A separable image reconstruction filter (default: 2-lobe Lanczos filter)

Parameter bch:

Horizontal and vertical boundary conditions (default: clamp)

Parameter clamp (Tuple[float, float]):

Filtered image pixels will be clamped to the following range. Default: -infinity..infinity (i.e. no clamping is used)

Parameter bc (Tuple[mitsuba.FilterBoundaryCondition, mitsuba.FilterBoundaryCondition]):

no description available

Parameter Clamp (0>, <FilterBoundaryCondition.):

no description available

Parameter Clamp (0>)):

no description available

Returns → mitsuba.Bitmap:

no description available

set_premultiplied_alpha(self, arg0)#

Specify whether the bitmap uses premultiplied alpha

Parameter arg0 (bool):

no description available

Returns → None:

no description available

set_srgb_gamma(self, arg0)#

Specify whether the bitmap uses an sRGB gamma encoding

Parameter arg0 (bool):

no description available

Returns → None:

no description available

size(self)#

Return the bitmap dimensions in pixels

Returns → mitsuba.Vector:

no description available

split(self)#

Split an multi-channel image buffer (e.g. from an OpenEXR image with lots of AOVs) into its constituent layers

Returns → List[Tuple[str, mitsuba.Bitmap]]:

no description available

srgb_gamma(self)#

Return whether the bitmap uses an sRGB gamma encoding

Returns → bool:

no description available

struct_(self)#

Return a Struct instance describing the contents of the bitmap (const version)

Returns → mitsuba.Struct:

no description available

vflip(self)#

Vertically flip the bitmap

Returns → None:

no description available

width(self)#

Return the bitmap’s width in pixels

Returns → int:

no description available

write(overloaded)#
write(self, stream, format=<FileFormat., Auto, quality=-1)#

Write an encoded form of the bitmap to a stream using the specified file format

Parameter stream (mitsuba.Stream):

Target stream that will receive the encoded output

Parameter format (mitsuba.Bitmap.FileFormat):

Target file format (OpenEXR, PNG, etc.) Detected from the filename by default.

Parameter quality (int):

Depending on the file format, this parameter takes on a slightly different meaning:

  • PNG images: Controls how much libpng will attempt to compress the output (with 1 being the lowest and 9 denoting the highest compression). The default argument uses the compression level 5.

  • JPEG images: denotes the desired quality (between 0 and 100). The default argument (-1) uses the highest quality (100).

  • OpenEXR images: denotes the quality level of the DWAB compressor, with higher values corresponding to a lower quality. A value of 45 is recommended as the default for lossy compression. The default argument (-1) causes the implementation to switch to the lossless PIZ compressor.

Parameter Auto (9>):

no description available

write(self, path, format=<FileFormat., Auto, quality=-1)#

Write an encoded form of the bitmap to a file using the specified file format

Parameter path (mitsuba.filesystem.path):

Target file path on disk

Parameter format (mitsuba.Bitmap.FileFormat):

Target file format (FileFormat::OpenEXR, FileFormat::PNG, etc.) Detected from the filename by default.

Parameter quality (int):

Depending on the file format, this parameter takes on a slightly different meaning:

  • PNG images: Controls how much libpng will attempt to compress the output (with 1 being the lowest and 9 denoting the highest compression). The default argument uses the compression level 5.

  • JPEG images: denotes the desired quality (between 0 and 100). The default argument (-1) uses the highest quality (100).

  • OpenEXR images: denotes the quality level of the DWAB compressor, with higher values corresponding to a lower quality. A value of 45 is recommended as the default for lossy compression. The default argument (-1) causes the implementation to switch to the lossless PIZ compressor.

Parameter Auto (9>):

no description available

write_async(self, path, format=<FileFormat., Auto, quality=-1)#

Equivalent to write(), but executes asynchronously on a different thread

Parameter path (mitsuba.filesystem.path):

no description available

Parameter format (mitsuba.Bitmap.FileFormat):

no description available

Parameter Auto (9>):

no description available

Parameter quality (int):

no description available

Returns → None:

no description available


class mitsuba.BitmapReconstructionFilter#

Base class: mitsuba.Object

Generic interface to separable image reconstruction filters

When resampling bitmaps or adding samples to a rendering in progress, Mitsuba first convolves them with a image reconstruction filter. Various kinds are implemented as subclasses of this interface.

Because image filters are generally too expensive to evaluate for each sample, the implementation of this class internally precomputes an discrete representation, whose resolution given by MI_FILTER_RESOLUTION.

border_size(self)#

Return the block border size required when rendering with this filter

Returns → int:

no description available

eval(self, x, active=True)#

Evaluate the filter function

Parameter x (float):

no description available

Parameter active (bool):

Mask to specify active lanes.

Returns → float:

no description available

eval_discretized(self, x, active=True)#

Evaluate a discretized version of the filter (generally faster than ‘eval’)

Parameter x (float):

no description available

Parameter active (bool):

Mask to specify active lanes.

Returns → float:

no description available

is_box_filter(self)#

Check whether this is a box filter?

Returns → bool:

no description available

radius(self)#

Return the filter’s width

Returns → float:

no description available


class mitsuba.Resampler#

Utility class for efficiently resampling discrete datasets to different resolutions

Template parameter Scalar:

Denotes the underlying floating point data type (i.e. half, float, or double)

__init__(self, rfilter, source_res, target_res)#

Create a new Resampler object that transforms between the specified resolutions

This constructor precomputes all information needed to efficiently perform the desired resampling operation. For that reason, it is most efficient if it can be used over and over again (e.g. to resample the equal-sized rows of a bitmap)

Parameter source_res (int):

Source resolution

Parameter target_res (int):

Desired target resolution

Parameter rfilter (mitsuba.ReconstructionFilter):

no description available

boundary_condition(self)#

Return the boundary condition that should be used when looking up samples outside of the defined input domain

Returns → mitsuba.FilterBoundaryCondition:

no description available

clamp(self)#

Returns the range to which resampled values will be clamped

The default is -infinity to infinity (i.e. no clamping is used)

Returns → Tuple[float, float]:

no description available

mitsuba.Resampler.resample(self, self, source, source_stride, target_stride, channels)

Resample a multi-channel array and clamp the results to a specified valid range

Parameter source (int):

Source array of samples

Parameter target:

Target array of samples

Parameter source_stride (numpy.ndarray[numpy.float32]):

Stride of samples in the source array. A value of ‘1’ implies that they are densely packed.

Parameter target_stride (int):

Stride of samples in the source array. A value of ‘1’ implies that they are densely packed.

Parameter channels (int):

Number of channels to be resampled

Returns → None:

no description available

set_boundary_condition(self, arg0)#

Set the boundary condition that should be used when looking up samples outside of the defined input domain

The default is FilterBoundaryCondition::Clamp

Parameter arg0 (mitsuba.FilterBoundaryCondition):

no description available

Returns → None:

no description available

set_clamp(self, arg0)#

If specified, resampled values will be clamped to the given range

Parameter arg0 (Tuple[float, float]):

no description available

Returns → None:

no description available

source_resolution(self)#

Return the reconstruction filter’s source resolution

Returns → int:

no description available

taps(self)#

Return the number of taps used by the reconstruction filter

Returns → int:

no description available

target_resolution(self)#

Return the reconstruction filter’s target resolution

Returns → int:

no description available


Warp#

mitsuba.warp.beckmann_to_square(v, alpha)#

Inverse of the mapping square_to_uniform_cone

Parameter v (mitsuba.Vector3f):

no description available

Parameter alpha (drjit.llvm.ad.Float):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.bilinear_to_square(v00, v10, v01, v11, sample)#

Inverse of square_to_bilinear

Parameter v00 (drjit.llvm.ad.Float):

no description available

Parameter v10 (drjit.llvm.ad.Float):

no description available

Parameter v01 (drjit.llvm.ad.Float):

no description available

Parameter v11 (drjit.llvm.ad.Float):

no description available

Parameter sample (mitsuba.Point2f):

no description available

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


mitsuba.warp.cosine_hemisphere_to_square(v)#

Inverse of the mapping square_to_cosine_hemisphere

Parameter v (mitsuba.Vector3f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.interval_to_linear(v0, v1, sample)#

Importance sample a linear interpolant

Given a linear interpolant on the unit interval with boundary values v0, v1 (where v1 is the value at x=1), warp a uniformly distributed input sample sample so that the resulting probability distribution matches the linear interpolant.

Parameter v0 (drjit.llvm.ad.Float):

no description available

Parameter v1 (drjit.llvm.ad.Float):

no description available

Parameter sample (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.interval_to_nonuniform_tent(a, b, c, d)#

Warp a uniformly distributed sample on [0, 1] to a nonuniform tent distribution with nodes {a, b, c}

Parameter a (drjit.llvm.ad.Float):

no description available

Parameter b (drjit.llvm.ad.Float):

no description available

Parameter c (drjit.llvm.ad.Float):

no description available

Parameter d (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.interval_to_tent(sample)#

Warp a uniformly distributed sample on [0, 1] to a tent distribution

Parameter sample (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.linear_to_interval(v0, v1, sample)#

Inverse of interval_to_linear

Parameter v0 (drjit.llvm.ad.Float):

no description available

Parameter v1 (drjit.llvm.ad.Float):

no description available

Parameter sample (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_beckmann(sample, alpha)#

Warp a uniformly distributed square sample to a Beckmann distribution

Parameter sample (mitsuba.Point2f):

no description available

Parameter alpha (drjit.llvm.ad.Float):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.warp.square_to_beckmann_pdf(v, alpha)#

Probability density of square_to_beckmann()

Parameter v (mitsuba.Vector3f):

no description available

Parameter alpha (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_bilinear(v00, v10, v01, v11, sample)#

Importance sample a bilinear interpolant

Given a bilinear interpolant on the unit square with corner values v00, v10, v01, v11 (where v10 is the value at (x,y) == (0, 0)), warp a uniformly distributed input sample sample so that the resulting probability distribution matches the linear interpolant.

The implementation first samples the marginal distribution to obtain y, followed by sampling the conditional distribution to obtain x.

Returns the sampled point and PDF for convenience.

Parameter v00 (drjit.llvm.ad.Float):

no description available

Parameter v10 (drjit.llvm.ad.Float):

no description available

Parameter v01 (drjit.llvm.ad.Float):

no description available

Parameter v11 (drjit.llvm.ad.Float):

no description available

Parameter sample (mitsuba.Point2f):

no description available

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


mitsuba.warp.square_to_bilinear_pdf(v00, v10, v01, v11, sample)#
Parameter v00 (drjit.llvm.ad.Float):

no description available

Parameter v10 (drjit.llvm.ad.Float):

no description available

Parameter v01 (drjit.llvm.ad.Float):

no description available

Parameter v11 (drjit.llvm.ad.Float):

no description available

Parameter sample (mitsuba.Point2f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_cosine_hemisphere(sample)#

Sample a cosine-weighted vector on the unit hemisphere with respect to solid angles

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.warp.square_to_cosine_hemisphere_pdf(v)#

Density of square_to_cosine_hemisphere() with respect to solid angles

Parameter v (mitsuba.Vector3f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_rough_fiber(sample, wi, tangent, kappa)#

Warp a uniformly distributed square sample to a rough fiber distribution

Parameter sample (mitsuba.Point3f):

no description available

Parameter wi (mitsuba.Vector3f):

no description available

Parameter tangent (mitsuba.Vector3f):

no description available

Parameter kappa (float):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.warp.square_to_rough_fiber_pdf(v, wi, tangent, kappa)#

Probability density of square_to_rough_fiber()

Parameter v (mitsuba.Vector3f):

no description available

Parameter wi (mitsuba.Vector3f):

no description available

Parameter tangent (mitsuba.Vector3f):

no description available

Parameter kappa (float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_std_normal(v)#

Sample a point on a 2D standard normal distribution. Internally uses the Box-Muller transformation

Parameter v (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.square_to_std_normal_pdf(v)#
Parameter v (mitsuba.Point2f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_tent(sample)#

Warp a uniformly distributed square sample to a 2D tent distribution

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.square_to_tent_pdf(v)#

Density of square_to_tent per unit area.

Parameter v (mitsuba.Point2f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_uniform_cone(v, cos_cutoff)#

Uniformly sample a vector that lies within a given cone of angles around the Z axis

Parameter cos_cutoff (drjit.llvm.ad.Float):

Cosine of the cutoff angle

Parameter sample:

A uniformly distributed sample on \([0,1]^2\)

Parameter v (mitsuba.Point2f):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.warp.square_to_uniform_cone_pdf(v, cos_cutoff)#

Density of square_to_uniform_cone per unit area.

Parameter cos_cutoff (drjit.llvm.ad.Float):

Cosine of the cutoff angle

Parameter v (mitsuba.Vector3f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_uniform_disk(sample)#

Uniformly sample a vector on a 2D disk

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.square_to_uniform_disk_concentric(sample)#

Low-distortion concentric square to disk mapping by Peter Shirley

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.square_to_uniform_disk_concentric_pdf(p)#

Density of square_to_uniform_disk per unit area

Parameter p (mitsuba.Point2f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_uniform_disk_pdf(p)#

Density of square_to_uniform_disk per unit area

Parameter p (mitsuba.Point2f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_uniform_hemisphere(sample)#

Uniformly sample a vector on the unit hemisphere with respect to solid angles

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.warp.square_to_uniform_hemisphere_pdf(v)#

Density of square_to_uniform_hemisphere() with respect to solid angles

Parameter v (mitsuba.Vector3f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_uniform_sphere(sample)#

Uniformly sample a vector on the unit sphere with respect to solid angles

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.warp.square_to_uniform_sphere_pdf(v)#

Density of square_to_uniform_sphere() with respect to solid angles

Parameter v (mitsuba.Vector3f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_uniform_square_concentric(sample)#

Low-distortion concentric square to square mapping (meant to be used in conjunction with another warping method that maps to the sphere)

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.square_to_uniform_triangle(sample)#

Convert an uniformly distributed square sample into barycentric coordinates

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.square_to_uniform_triangle_pdf(p)#

Density of square_to_uniform_triangle per unit area.

Parameter p (mitsuba.Point2f):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.square_to_von_mises_fisher(sample, kappa)#

Warp a uniformly distributed square sample to a von Mises Fisher distribution

Parameter sample (mitsuba.Point2f):

no description available

Parameter kappa (drjit.llvm.ad.Float):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.warp.square_to_von_mises_fisher_pdf(v, kappa)#

Probability density of square_to_von_mises_fisher()

Parameter v (mitsuba.Vector3f):

no description available

Parameter kappa (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.tent_to_interval(value)#

Warp a uniformly distributed sample on [0, 1] to a tent distribution

Parameter value (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.warp.tent_to_square(value)#

Warp a uniformly distributed square sample to a 2D tent distribution

Parameter value (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.uniform_cone_to_square(v, cos_cutoff)#

Inverse of the mapping square_to_uniform_cone

Parameter v (mitsuba.Vector3f):

no description available

Parameter cos_cutoff (drjit.llvm.ad.Float):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.uniform_disk_to_square(p)#

Inverse of the mapping square_to_uniform_disk

Parameter p (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.uniform_disk_to_square_concentric(p)#

Inverse of the mapping square_to_uniform_disk_concentric

Parameter p (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.uniform_hemisphere_to_square(v)#

Inverse of the mapping square_to_uniform_hemisphere

Parameter v (mitsuba.Vector3f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.uniform_sphere_to_square(sample)#

Inverse of the mapping square_to_uniform_sphere

Parameter sample (mitsuba.Vector3f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.uniform_triangle_to_square(p)#

Inverse of the mapping square_to_uniform_triangle

Parameter p (mitsuba.Point2f):

no description available

Returns → mitsuba.Point2f:

no description available


mitsuba.warp.von_mises_fisher_to_square(v, kappa)#

Inverse of the mapping von_mises_fisher_to_square

Parameter v (mitsuba.Vector3f):

no description available

Parameter kappa (drjit.llvm.ad.Float):

no description available

Returns → mitsuba.Point2f:

no description available


Distributions#

class mitsuba.ContinuousDistribution#

Continuous 1D probability distribution defined in terms of a regularly sampled linear interpolant

This data structure represents a continuous 1D probability distribution that is defined as a linear interpolant of a regularly discretized signal. The class provides various routines for transforming uniformly distributed samples so that they follow the stored distribution. Note that unnormalized probability density functions (PDFs) will automatically be normalized during initialization. The associated scale factor can be retrieved using the function normalization().

__init__(self)#

Continuous 1D probability distribution defined in terms of a regularly sampled linear interpolant

This data structure represents a continuous 1D probability distribution that is defined as a linear interpolant of a regularly discretized signal. The class provides various routines for transforming uniformly distributed samples so that they follow the stored distribution. Note that unnormalized probability density functions (PDFs) will automatically be normalized during initialization. The associated scale factor can be retrieved using the function normalization().

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.ContinuousDistribution):

no description available

__init__(self, range, pdf)#

Initialize from a given density function on the interval range

Parameter range (mitsuba.ScalarVector2f):

no description available

Parameter pdf (drjit.llvm.ad.Float):

no description available

cdf(self)#

Return the unnormalized discrete cumulative distribution function over intervals

Returns → drjit.llvm.ad.Float:

no description available

empty(self)#

Is the distribution object empty/uninitialized?

Returns → bool:

no description available

eval_cdf(self, x, active=True)#

Evaluate the unnormalized cumulative distribution function (CDF) at position p

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_cdf_normalized(self, x, active=True)#

Evaluate the unnormalized cumulative distribution function (CDF) at position p

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_pdf(self, x, active=True)#

Evaluate the unnormalized probability mass function (PDF) at position x

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_pdf_normalized(self, x, active=True)#

Evaluate the normalized probability mass function (PDF) at position x

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

integral(self)#

Return the original integral of PDF entries before normalization

Returns → drjit.llvm.ad.Float:

no description available

interval_resolution(self)#

Return the minimum resolution of the discretization

Returns → float:

no description available

normalization(self)#

Return the normalization factor (i.e. the inverse of sum())

Returns → drjit.llvm.ad.Float:

no description available

pdf(self)#

Return the unnormalized discretized probability density function

Returns → drjit.llvm.ad.Float:

no description available

range(self)#

Return the range of the distribution

Returns → mitsuba.ScalarVector2f:

no description available

sample(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

The sampled position.

sample_pdf(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple consisting of

1. the sampled position. 2. the normalized probability density of the sample.

size(self)#

Return the number of discretizations

Returns → int:

no description available

update(self)#

Update the internal state. Must be invoked when changing the pdf.

Returns → None:

no description available


class mitsuba.DiscreteDistribution#

Discrete 1D probability distribution

This data structure represents a discrete 1D probability distribution and provides various routines for transforming uniformly distributed samples so that they follow the stored distribution. Note that unnormalized probability mass functions (PMFs) will automatically be normalized during initialization. The associated scale factor can be retrieved using the function normalization().

__init__(self)#

Discrete 1D probability distribution

This data structure represents a discrete 1D probability distribution and provides various routines for transforming uniformly distributed samples so that they follow the stored distribution. Note that unnormalized probability mass functions (PMFs) will automatically be normalized during initialization. The associated scale factor can be retrieved using the function normalization().

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.DiscreteDistribution):

no description available

__init__(self, pmf)#

Initialize from a given probability mass function

Parameter pmf (drjit.llvm.ad.Float):

no description available

cdf(self)#

Return the unnormalized cumulative distribution function

Returns → drjit.llvm.ad.Float:

no description available

empty(self)#

Is the distribution object empty/uninitialized?

Returns → bool:

no description available

eval_cdf(self, index, active=True)#

Evaluate the unnormalized cumulative distribution function (CDF) at index index

Parameter index (drjit.llvm.ad.UInt):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_cdf_normalized(self, index, active=True)#

Evaluate the normalized cumulative distribution function (CDF) at index index

Parameter index (drjit.llvm.ad.UInt):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_pmf(self, index, active=True)#

Evaluate the unnormalized probability mass function (PMF) at index index

Parameter index (drjit.llvm.ad.UInt):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_pmf_normalized(self, index, active=True)#

Evaluate the normalized probability mass function (PMF) at index index

Parameter index (drjit.llvm.ad.UInt):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

normalization(self)#

Return the normalization factor (i.e. the inverse of sum())

Returns → drjit.llvm.ad.Float:

no description available

pmf(self)#

Return the unnormalized probability mass function

Returns → drjit.llvm.ad.Float:

no description available

sample(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.UInt:

The discrete index associated with the sample

sample_pmf(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[drjit.llvm.ad.UInt, drjit.llvm.ad.Float]:

A tuple consisting of

1. the discrete index associated with the sample, and 2. the normalized probability value of the sample.

sample_reuse(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution

The original sample is value adjusted so that it can be reused as a uniform variate.

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[drjit.llvm.ad.UInt, drjit.llvm.ad.Float]:

A tuple consisting of

1. the discrete index associated with the sample, and 2. the re-scaled sample value.

sample_reuse_pmf(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution.

The original sample is value adjusted so that it can be reused as a uniform variate.

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[drjit.llvm.ad.UInt, drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple consisting of

1. the discrete index associated with the sample 2. the re-scaled sample value 3. the normalized probability value of the sample

size(self)#

Return the number of entries

Returns → int:

no description available

sum(self)#

Return the original sum of PMF entries before normalization

Returns → drjit.llvm.ad.Float:

no description available

update(self)#

Update the internal state. Must be invoked when changing the pmf.

Returns → None:

no description available


class mitsuba.DiscreteDistribution2D#
eval(self, pos, active=True)#
Parameter pos (mitsuba.Point2u):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

pdf(self, pos, active=True)#
Parameter pos (mitsuba.Point2u):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

sample(self, sample, active=True)#
Parameter sample (mitsuba.Point2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2u, drjit.llvm.ad.Float, mitsuba.Point2f]:

no description available


class mitsuba.IrregularContinuousDistribution#

Continuous 1D probability distribution defined in terms of an irregularly sampled linear interpolant

This data structure represents a continuous 1D probability distribution that is defined as a linear interpolant of an irregularly discretized signal. The class provides various routines for transforming uniformly distributed samples so that they follow the stored distribution. Note that unnormalized probability density functions (PDFs) will automatically be normalized during initialization. The associated scale factor can be retrieved using the function normalization().

__init__(self)#

Continuous 1D probability distribution defined in terms of an irregularly sampled linear interpolant

This data structure represents a continuous 1D probability distribution that is defined as a linear interpolant of an irregularly discretized signal. The class provides various routines for transforming uniformly distributed samples so that they follow the stored distribution. Note that unnormalized probability density functions (PDFs) will automatically be normalized during initialization. The associated scale factor can be retrieved using the function normalization().

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.IrregularContinuousDistribution):

no description available

__init__(self, nodes, pdf)#

Initialize from a given density function discretized on nodes nodes

Parameter nodes (drjit.llvm.ad.Float):

no description available

Parameter pdf (drjit.llvm.ad.Float):

no description available

cdf(self)#

Return the unnormalized discrete cumulative distribution function over intervals

Returns → drjit.llvm.ad.Float:

no description available

empty(self)#

Is the distribution object empty/uninitialized?

Returns → bool:

no description available

eval_cdf(self, x, active=True)#

Evaluate the unnormalized cumulative distribution function (CDF) at position p

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_cdf_normalized(self, x, active=True)#

Evaluate the unnormalized cumulative distribution function (CDF) at position p

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_pdf(self, x, active=True)#

Evaluate the unnormalized probability mass function (PDF) at position x

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

eval_pdf_normalized(self, x, active=True)#

Evaluate the normalized probability mass function (PDF) at position x

Parameter x (drjit.llvm.ad.Float):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

integral(self)#

Return the original integral of PDF entries before normalization

Returns → drjit.llvm.ad.Float:

no description available

interval_resolution(self)#

Return the minimum resolution of the discretization

Returns → float:

no description available

nodes(self)#

Return the nodes of the underlying discretization

Returns → drjit.llvm.ad.Float:

no description available

normalization(self)#

Return the normalization factor (i.e. the inverse of sum())

Returns → drjit.llvm.ad.Float:

no description available

pdf(self)#

Return the unnormalized discretized probability density function

Returns → drjit.llvm.ad.Float:

no description available

range(self)#

Return the range of the distribution

Returns → drjit.scalar.Array2f:

no description available

sample(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

The sampled position.

sample_pdf(self, value, active=True)#

%Transform a uniformly distributed sample to the stored distribution

Parameter value (drjit.llvm.ad.Float):

A uniformly distributed sample on the interval [0, 1].

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple consisting of

1. the sampled position. 2. the normalized probability density of the sample.

size(self)#

Return the number of discretizations

Returns → int:

no description available

update(self)#

Update the internal state. Must be invoked when changing the pdf or range.

Returns → None:

no description available


class mitsuba.MicrofacetDistribution#

Implementation of the Beckman and GGX / Trowbridge-Reitz microfacet distributions and various useful sampling routines

Based on the papers

“Microfacet Models for Refraction through Rough Surfaces” by Bruce Walter, Stephen R. Marschner, Hongsong Li, and Kenneth E. Torrance

and

“Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals” by Eric Heitz and Eugene D’Eon

The visible normal sampling code was provided by Eric Heitz and Eugene D’Eon. An improvement of the Beckmann model sampling routine is discussed in

“An Improved Visible Normal Sampling Routine for the Beckmann Distribution” by Wenzel Jakob

An improvement of the GGX model sampling routine is discussed in “A Simpler and Exact Sampling Routine for the GGX Distribution of Visible Normals” by Eric Heitz

__init__(self, type, alpha, sample_visible=True)#
Parameter type (mitsuba.MicrofacetType):

no description available

Parameter alpha (float):

no description available

Parameter sample_visible (bool):

no description available

__init__(self, type, alpha_u, alpha_v, sample_visible=True)#
Parameter type (mitsuba.MicrofacetType):

no description available

Parameter alpha_u (float):

no description available

Parameter alpha_v (float):

no description available

Parameter sample_visible (bool):

no description available

__init__(self, type, alpha, sample_visible=True)#
Parameter type (mitsuba.MicrofacetType):

no description available

Parameter alpha (drjit.llvm.ad.Float):

no description available

Parameter sample_visible (bool):

no description available

__init__(self, type, alpha_u, alpha_v, sample_visible=True)#
Parameter type (mitsuba.MicrofacetType):

no description available

Parameter alpha_u (drjit.llvm.ad.Float):

no description available

Parameter alpha_v (drjit.llvm.ad.Float):

no description available

Parameter sample_visible (bool):

no description available

__init__(self, arg0)#
Parameter arg0 (mitsuba.Properties):

no description available

G(self, wi, wo, m)#

Smith’s separable shadowing-masking approximation

Parameter wi (mitsuba.Vector3f):

no description available

Parameter wo (mitsuba.Vector3f):

no description available

Parameter m (mitsuba.Vector3f):

no description available

Returns → drjit.llvm.ad.Float:

no description available

alpha(self)#

Return the roughness (isotropic case)

Returns → drjit.llvm.ad.Float:

no description available

alpha_u(self)#

Return the roughness along the tangent direction

Returns → drjit.llvm.ad.Float:

no description available

alpha_v(self)#

Return the roughness along the bitangent direction

Returns → drjit.llvm.ad.Float:

no description available

eval(self, m)#

Evaluate the microfacet distribution function

Parameter m (mitsuba.Vector3f):

The microfacet normal

Returns → drjit.llvm.ad.Float:

no description available

is_anisotropic(self)#

Is this an anisotropic microfacet distribution?

Returns → bool:

no description available

is_isotropic(self)#

Is this an isotropic microfacet distribution?

Returns → bool:

no description available

pdf(self, wi, m)#

Returns the density function associated with the sample() function.

Parameter wi (mitsuba.Vector3f):

The incident direction (only relevant if visible normal sampling is used)

Parameter m (mitsuba.Vector3f):

The microfacet normal

Returns → drjit.llvm.ad.Float:

no description available

sample(self, wi, sample)#

Draw a sample from the microfacet normal distribution and return the associated probability density

Parameter wi (mitsuba.Vector3f):

The incident direction. Only used if visible normal sampling is enabled.

Parameter sample (mitsuba.Point2f):

A uniformly distributed 2D sample

Returns → Tuple[mitsuba.Normal3f, drjit.llvm.ad.Float]:

A tuple consisting of the sampled microfacet normal and the associated solid angle density

sample_visible(self)#

Return whether or not only visible normals are sampled?

Returns → bool:

no description available

sample_visible_11(self, cos_theta_i, sample)#

Visible normal sampling code for the alpha=1 case

Parameter cos_theta_i (drjit.llvm.ad.Float):

no description available

Parameter sample (mitsuba.Point2f):

no description available

Returns → mitsuba.Vector2f:

no description available

scale_alpha(self, value)#

Scale the roughness values by some constant

Parameter value (drjit.llvm.ad.Float):

no description available

Returns → None:

no description available

smith_g1(self, v, m)#

Smith’s shadowing-masking function for a single direction

Parameter v (mitsuba.Vector3f):

An arbitrary direction

Parameter m (mitsuba.Vector3f):

The microfacet normal

Returns → drjit.llvm.ad.Float:

no description available

type(self)#

Return the distribution type

Returns → mitsuba.MicrofacetType:

no description available


class mitsuba.Hierarchical2D0#

Implements a hierarchical sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed from a sequence of log2(max(res)) hierarchical sample warping steps, where res is the input array resolution. It is bijective and generally very well-behaved (i.e. low distortion), which makes it a good choice for structured point sets such as the Halton or Sobol sequence.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

Remark:

The Python API exposes explicitly instantiated versions of this class named Hierarchical2D0, Hierarchical2D1, and Hierarchical2D2 for data that depends on 0, 1, and 2 parameters, respectively.

__init__(self, data, param_values=[], normalize=True, enable_sampling=True)#

Construct a hierarchical sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Hierarchical2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the hierarchy needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used). In this case, sample() and invert() can still be called without triggering undefined behavior, but they will not return meaningful results.

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][0]]):

no description available

Parameter normalize (bool):

no description available

Parameter enable_sampling (bool):

no description available

eval(self, pos, param=[], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.Hierarchical2D1#

Implements a hierarchical sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed from a sequence of log2(max(res)) hierarchical sample warping steps, where res is the input array resolution. It is bijective and generally very well-behaved (i.e. low distortion), which makes it a good choice for structured point sets such as the Halton or Sobol sequence.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

Remark:

The Python API exposes explicitly instantiated versions of this class named Hierarchical2D0, Hierarchical2D1, and Hierarchical2D2 for data that depends on 0, 1, and 2 parameters, respectively.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a hierarchical sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Hierarchical2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the hierarchy needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used). In this case, sample() and invert() can still be called without triggering undefined behavior, but they will not return meaningful results.

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][1]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.Hierarchical2D2#

Implements a hierarchical sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed from a sequence of log2(max(res)) hierarchical sample warping steps, where res is the input array resolution. It is bijective and generally very well-behaved (i.e. low distortion), which makes it a good choice for structured point sets such as the Halton or Sobol sequence.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

Remark:

The Python API exposes explicitly instantiated versions of this class named Hierarchical2D0, Hierarchical2D1, and Hierarchical2D2 for data that depends on 0, 1, and 2 parameters, respectively.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a hierarchical sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Hierarchical2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the hierarchy needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used). In this case, sample() and invert() can still be called without triggering undefined behavior, but they will not return meaningful results.

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][2]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0, 0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0, 0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0, 0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.Hierarchical2D3#

Implements a hierarchical sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed from a sequence of log2(max(res)) hierarchical sample warping steps, where res is the input array resolution. It is bijective and generally very well-behaved (i.e. low distortion), which makes it a good choice for structured point sets such as the Halton or Sobol sequence.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

Remark:

The Python API exposes explicitly instantiated versions of this class named Hierarchical2D0, Hierarchical2D1, and Hierarchical2D2 for data that depends on 0, 1, and 2 parameters, respectively.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a hierarchical sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Hierarchical2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the hierarchy needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used). In this case, sample() and invert() can still be called without triggering undefined behavior, but they will not return meaningful results.

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][3]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0, 0.0, 0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0, 0.0, 0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0, 0.0, 0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalContinuous2D0#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values=[], normalize=True, enable_sampling=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][0]]):

no description available

Parameter normalize (bool):

no description available

Parameter enable_sampling (bool):

no description available

eval(self, pos, param=[], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalContinuous2D1#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][1]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalContinuous2D2#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][2]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0, 0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0, 0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0, 0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalContinuous2D3#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][3]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0, 0.0, 0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0, 0.0, 0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0, 0.0, 0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalDiscrete2D0#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values=[], normalize=True, enable_sampling=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][0]]):

no description available

Parameter normalize (bool):

no description available

Parameter enable_sampling (bool):

no description available

eval(self, pos, param=[], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array0f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalDiscrete2D1#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][1]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array1f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalDiscrete2D2#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][2]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0, 0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0, 0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0, 0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array2f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


class mitsuba.MarginalDiscrete2D3#

Implements a marginal sample warping scheme for 2D distributions with linear interpolation and an optional dependence on additional parameters

This class takes a rectangular floating point array as input and constructs internal data structures to efficiently map uniform variates from the unit square [0, 1]^2 to a function on [0, 1]^2 that linearly interpolates the input array.

The mapping is constructed via the inversion method, which is applied to a marginal distribution over rows, followed by a conditional distribution over columns.

The implementation also supports conditional distributions, i.e. 2D distributions that depend on an arbitrary number of parameters (indicated via the Dimension template parameter).

In this case, the input array should have dimensions N0 x N1 x ... x Nn x res.y() x res.x() (where the last dimension is contiguous in memory), and the param_res should be set to { N0, N1, ..., Nn }, and param_values should contain the parameter values where the distribution is discretized. Linear interpolation is used when sampling or evaluating the distribution for in-between parameter values.

There are two variants of Marginal2D: when Continuous=false, discrete marginal/conditional distributions are used to select a bilinear bilinear patch, followed by a continuous sampling step that chooses a specific position inside the patch. When Continuous=true, continuous marginal/conditional distributions are used instead, and the second step is no longer needed. The latter scheme requires more computation and memory accesses but produces an overall smoother mapping.

Remark:

The Python API exposes explicitly instantiated versions of this class named MarginalDiscrete2D0 to MarginalDiscrete2D3 and MarginalContinuous2D0 to MarginalContinuous2D3 for data that depends on 0 to 3 parameters.

__init__(self, data, param_values, normalize=True, build_hierarchy=True)#

Construct a marginal sample warping scheme for floating point data of resolution size.

param_res and param_values are only needed for conditional distributions (see the text describing the Marginal2D class).

If normalize is set to False, the implementation will not re- scale the distribution so that it integrates to 1. It can still be sampled (proportionally), but returned density values will reflect the unnormalized values.

If enable_sampling is set to False, the implementation will not construct the cdf needed for sample warping, which saves memory in case this functionality is not needed (e.g. if only the interpolation in eval() is used).

Parameter data (numpy.ndarray[numpy.float32]):

no description available

Parameter param_values (List[List[float][3]]):

no description available

Parameter normalize (bool):

no description available

Parameter build_hierarchy (bool):

no description available

eval(self, pos, param=[0.0, 0.0, 0.0], active=True)#

Evaluate the density at position pos. The distribution is parameterized by param if applicable.

Parameter pos (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.Float:

no description available

invert(self, sample, param=[0.0, 0.0, 0.0], active=True)#

Inverse of the mapping implemented in sample()

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available

sample(self, sample, param=[0.0, 0.0, 0.0], active=True)#

Given a uniformly distributed 2D sample, draw a sample from the distribution (parameterized by param if applicable)

Returns the warped sample and associated probability density.

Parameter sample (drjit.llvm.ad.Array2f):

no description available

Parameter param (drjit.llvm.ad.Array3f):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → Tuple[mitsuba.Point2f, drjit.llvm.ad.Float]:

no description available


Math#

mitsuba.math.RayEpsilon: float = 8.940696716308594e-05#

mitsuba.math.ShadowEpsilon: float = 0.0008940696716308594#

mitsuba.math.chi2(arg0, arg1, arg2)#

Compute the Chi^2 statistic and degrees of freedom of the given arrays while pooling low-valued entries together

Given a list of observations counts (obs[i]) and expected observation counts (exp[i]), this function accumulates the Chi^2 statistic, that is, (obs-exp)^2 / exp for each element 0, ..., n-1.

Minimum expected cell frequency. The Chi^2 test statistic is not useful when when the expected frequency in a cell is low (e.g. less than 5), because normality assumptions break down in this case. Therefore, the implementation will merge such low-frequency cells when they fall below the threshold specified here. Specifically, low-valued cells with exp[i] < pool_threshold are pooled into larger groups that are above the threshold before their contents are added to the Chi^2 statistic.

The function returns the statistic value, degrees of freedom, below- threshold entries and resulting number of pooled regions.

Parameter arg0 (drjit.scalar.ArrayXf64):

no description available

Parameter arg1 (drjit.scalar.ArrayXf64):

no description available

Parameter arg2 (float):

no description available

Returns → Tuple[float, int, int, int]:

no description available


mitsuba.math.find_interval(size, pred)#

Find an interval in an ordered set

This function performs a binary search to find an index i such that pred(i) is True and pred(i+1) is False, where pred is a user-specified predicate that monotonically decreases over this range (i.e. max one True -> False transition).

The predicate will be evaluated exactly <tt>floor(log2(size)) + 1<tt> times. Note that the template parameter Index is automatically inferred from the supplied predicate, which takes an index or an index vector of type Index as input argument and can (optionally) take a mask argument as well. In the vectorized case, each vector lane can use different predicate. When pred is False for all entries, the function returns 0, and when it is True for all cases, it returns <tt>size-2<tt>.

The main use case of this function is to locate an interval (i, i+1) in an ordered list.

float my_list[] = { 1, 1.5f, 4.f, ... };

UInt32 index = find_interval(
    sizeof(my_list) / sizeof(float),
    [](UInt32 index, dr::mask_t<UInt32> active) {
        return dr::gather<Float>(my_list, index, active) < x;
    }
);
Parameter size (int):

no description available

Parameter pred (Callable[[drjit.llvm.ad.UInt], drjit.llvm.ad.Bool]):

no description available

Returns → drjit.llvm.ad.UInt:

no description available


mitsuba.math.is_power_of_two(arg0)#

Check whether the provided integer is a power of two

Parameter arg0 (int):

no description available

Returns → bool:

no description available


mitsuba.math.legendre_p(overloaded)#
legendre_p(l, x)#

Evaluate the l-th Legendre polynomial using recurrence

Parameter l (int):

no description available

Parameter x (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available

legendre_p(l, m, x)#

Evaluate the l-th Legendre polynomial using recurrence

Parameter l (int):

no description available

Parameter m (int):

no description available

Parameter x (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.math.legendre_pd(l, x)#

Evaluate the l-th Legendre polynomial and its derivative using recurrence

Parameter l (int):

no description available

Parameter x (drjit.llvm.ad.Float):

no description available

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

no description available


mitsuba.math.legendre_pd_diff(l, x)#

Evaluate the function legendre_pd(l+1, x) - legendre_pd(l-1, x)

Parameter l (int):

no description available

Parameter x (drjit.llvm.ad.Float):

no description available

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

no description available


mitsuba.math.linear_to_srgb(arg0)#

Applies the sRGB gamma curve to the given argument.

Parameter arg0 (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.math.morton_decode2(m)#
Parameter m (drjit.llvm.ad.UInt):

no description available

Returns → drjit.llvm.ad.Array2u:

no description available


mitsuba.math.morton_decode3(m)#
Parameter m (drjit.llvm.ad.UInt):

no description available

Returns → drjit.llvm.ad.Array3u:

no description available


mitsuba.math.morton_encode2(v)#
Parameter v (drjit.llvm.ad.Array2u):

no description available

Returns → drjit.llvm.ad.UInt:

no description available


mitsuba.math.morton_encode3(v)#
Parameter v (drjit.llvm.ad.Array3u):

no description available

Returns → drjit.llvm.ad.UInt:

no description available


mitsuba.math.rlgamma()#

Regularized lower incomplete gamma function based on CEPHES


mitsuba.math.round_to_power_of_two(arg0)#

Round an unsigned integer to the next integer power of two

Parameter arg0 (int):

no description available

Returns → int:

no description available


mitsuba.math.solve_quadratic(a, b, c)#

Solve a quadratic equation of the form a*x^2 + b*x + c = 0.

Parameter a (drjit.llvm.ad.Float):

no description available

Parameter b (drjit.llvm.ad.Float):

no description available

Parameter c (drjit.llvm.ad.Float):

no description available

Returns → Tuple[drjit.llvm.ad.Bool, drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

True if a solution could be found


mitsuba.math.srgb_to_linear(arg0)#

Applies the inverse sRGB gamma curve to the given argument.

Parameter arg0 (drjit.llvm.ad.Float):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.math.ulpdiff(arg0, arg1)#

Compare the difference in ULPs between a reference value and another given floating point number

Parameter arg0 (float):

no description available

Parameter arg1 (float):

no description available

Returns → float:

no description available


mitsuba.spline.eval_1d(overloaded)#
eval_1d(min, max, values, x)#

Evaluate a cubic spline interpolant of a uniformly sampled 1D function

The implementation relies on Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline segment.

Template parameter Extrapolate:

Extrapolate values when x is out of range? (default: False)

Parameter min (float):

Position of the first node

Parameter max (float):

Position of the last node

Parameter values (numpy.ndarray[numpy.float32]):

Array containing size regularly spaced evaluations in the range [min, max] of the approximated function.

Parameter size:

Denotes the size of the values array

Parameter x (drjit.llvm.ad.Float):

Evaluation point

Remark:

The Python API lacks the size parameter, which is inferred automatically from the size of the input array.

Remark:

The Python API provides a vectorized version which evaluates the function for many arguments x.

Returns → drjit.llvm.ad.Float:

The interpolated value or zero when Extrapolate=false and x lies outside of [min, max]

eval_1d(nodes, values, x)#

Evaluate a cubic spline interpolant of a non-uniformly sampled 1D function

The implementation relies on Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline segment.

Template parameter Extrapolate:

Extrapolate values when x is out of range? (default: False)

Parameter nodes (numpy.ndarray[numpy.float32]):

Array containing size non-uniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.

Parameter values (numpy.ndarray[numpy.float32]):

Array containing function evaluations matched to the entries of nodes.

Parameter size:

Denotes the size of the nodes and values array

Parameter x (drjit.llvm.ad.Float):

Evaluation point

Remark:

The Python API lacks the size parameter, which is inferred automatically from the size of the input array

Remark:

The Python API provides a vectorized version which evaluates the function for many arguments x.

Returns → drjit.llvm.ad.Float:

The interpolated value or zero when Extrapolate=false and x lies outside of a [min, max]


mitsuba.spline.eval_2d(nodes1, nodes2, values, x, y)#

Evaluate a cubic spline interpolant of a uniformly sampled 2D function

This implementation relies on a tensor product of Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives for each dimension at the endpoints of spline patches.

Template parameter Extrapolate:

Extrapolate values when p is out of range? (default: False)

Parameter nodes1 (numpy.ndarray[numpy.float32]):

Arrays containing size1 non-uniformly spaced values denoting positions the where the function to be interpolated was evaluated on the X axis (in increasing order)

Parameter size1:

Denotes the size of the nodes1 array

Parameter nodes:

Arrays containing size2 non-uniformly spaced values denoting positions the where the function to be interpolated was evaluated on the Y axis (in increasing order)

Parameter size2:

Denotes the size of the nodes2 array

Parameter values (numpy.ndarray[numpy.float32]):

A 2D floating point array of size1*size2 cells containing irregularly spaced evaluations of the function to be interpolated. Consecutive entries of this array correspond to increments in the X coordinate.

Parameter x (drjit.llvm.ad.Float):

X coordinate of the evaluation point

Parameter y (drjit.llvm.ad.Float):

Y coordinate of the evaluation point

Remark:

The Python API lacks the size1 and size2 parameters, which are inferred automatically from the size of the input arrays.

Parameter nodes2 (numpy.ndarray[numpy.float32]):

no description available

Returns → drjit.llvm.ad.Float:

The interpolated value or zero when Extrapolate=false``tt> and ``(x,y) lies outside of the node range


mitsuba.spline.eval_spline(f0, f1, d0, d1, t)#

Compute the definite integral and derivative of a cubic spline that is parameterized by the function values and derivatives at the endpoints of the interval [0, 1].

Parameter f0 (float):

The function value at the left position

Parameter f1 (float):

The function value at the right position

Parameter d0 (float):

The function derivative at the left position

Parameter d1 (float):

The function derivative at the right position

Parameter t (float):

The parameter variable

Returns → float:

The interpolated function value at t


mitsuba.spline.eval_spline_d(f0, f1, d0, d1, t)#

Compute the value and derivative of a cubic spline that is parameterized by the function values and derivatives of the interval [0, 1].

Parameter f0 (float):

The function value at the left position

Parameter f1 (float):

The function value at the right position

Parameter d0 (float):

The function derivative at the left position

Parameter d1 (float):

The function derivative at the right position

Parameter t (float):

The parameter variable

Returns → Tuple[float, float]:

The interpolated function value and its derivative at t


mitsuba.spline.eval_spline_i(f0, f1, d0, d1, t)#

Compute the definite integral and value of a cubic spline that is parameterized by the function values and derivatives of the interval [0, 1].

Parameter f0 (float):

The function value at the left position

Parameter f1 (float):

The function value at the right position

Parameter d0 (float):

The function derivative at the left position

Parameter d1 (float):

The function derivative at the right position

Parameter t (float):

no description available

Returns → Tuple[float, float]:

The definite integral and the interpolated function value at t


mitsuba.spline.eval_spline_weights(overloaded)#
eval_spline_weights(min, max, size, x)#

Compute weights to perform a spline-interpolated lookup on a uniformly sampled 1D function.

The implementation relies on Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline segment. The resulting weights are identical those internally used by sample_1d().

Template parameter Extrapolate:

Extrapolate values when x is out of range? (default: False)

Parameter min (float):

Position of the first node

Parameter max (float):

Position of the last node

Parameter size (int):

Denotes the number of function samples

Parameter x (drjit.llvm.ad.Float):

Evaluation point

Parameter weights:

Pointer to a weight array of size 4 that will be populated

Remark:

In the Python API, the offset and weights parameters are returned as the second and third elements of a triple.

Returns → Tuple[drjit.llvm.ad.Bool, drjit.llvm.ad.Int, List[drjit.llvm.ad.Float]]:

A boolean set to True on success and False when Extrapolate=false and x lies outside of [min, max] and an offset into the function samples associated with weights[0]

eval_spline_weights(nodes, x)#

Compute weights to perform a spline-interpolated lookup on a non-uniformly sampled 1D function.

The implementation relies on Catmull-Rom splines, i.e. it uses finite differences to approximate the derivatives at the endpoints of each spline segment. The resulting weights are identical those internally used by sample_1d().

Template parameter Extrapolate:

Extrapolate values when x is out of range? (default: False)

Parameter nodes (numpy.ndarray[numpy.float32]):

Array containing size non-uniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.

Parameter size:

Denotes the size of the nodes array

Parameter x (drjit.llvm.ad.Float):

Evaluation point

Parameter weights:

Pointer to a weight array of size 4 that will be populated

Remark:

The Python API lacks the size parameter, which is inferred automatically from the size of the input array. The offset and weights parameters are returned as the second and third elements of a triple.

Returns → Tuple[drjit.llvm.ad.Bool, drjit.llvm.ad.Int, List[drjit.llvm.ad.Float]]:

A boolean set to True on success and False when Extrapolate=false and x lies outside of [min, max] and an offset into the function samples associated with weights[0]


mitsuba.spline.integrate_1d(overloaded)#
integrate_1d(min, max, values)#

Computes a prefix sum of integrals over segments of a uniformly sampled 1D Catmull-Rom spline interpolant

This is useful for sampling spline segments as part of an importance sampling scheme (in conjunction with sample_1d)

Parameter min (float):

Position of the first node

Parameter max (float):

Position of the last node

Parameter values (numpy.ndarray[numpy.float32]):

Array containing size regularly spaced evaluations in the range [min, max] of the approximated function.

Parameter size:

Denotes the size of the values array

Parameter out:

An array with size entries, which will be used to store the prefix sum

Remark:

The Python API lacks the size and out parameters. The former is inferred automatically from the size of the input array, and out is returned as a list.

Returns → drjit.scalar.ArrayXf:

no description available

integrate_1d(nodes, values)#

Computes a prefix sum of integrals over segments of a non-uniformly sampled 1D Catmull-Rom spline interpolant

This is useful for sampling spline segments as part of an importance sampling scheme (in conjunction with sample_1d)

Parameter nodes (numpy.ndarray[numpy.float32]):

Array containing size non-uniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.

Parameter values (numpy.ndarray[numpy.float32]):

Array containing function evaluations matched to the entries of nodes.

Parameter size:

Denotes the size of the values array

Parameter out:

An array with size entries, which will be used to store the prefix sum

Remark:

The Python API lacks the size and out parameters. The former is inferred automatically from the size of the input array, and out is returned as a list.

Returns → drjit.scalar.ArrayXf:

no description available


mitsuba.spline.invert_1d(overloaded)#
invert_1d(min, max_, values, y, eps=9.999999974752427e-07)#

Invert a cubic spline interpolant of a uniformly sampled 1D function. The spline interpolant must be monotonically increasing.

Parameter min (float):

Position of the first node

Parameter max:

Position of the last node

Parameter values (numpy.ndarray[numpy.float32]):

Array containing size regularly spaced evaluations in the range [min, max] of the approximated function.

Parameter size:

Denotes the size of the values array

Parameter y (drjit.llvm.ad.Float):

Input parameter for the inversion

Parameter eps (float):

Error tolerance (default: 1e-6f)

Returns → drjit.llvm.ad.Float:

The spline parameter t such that eval_1d(..., t)=y

Parameter max_ (float):

no description available

invert_1d(nodes, values, y, eps=9.999999974752427e-07)#

Invert a cubic spline interpolant of a non-uniformly sampled 1D function. The spline interpolant must be monotonically increasing.

Parameter nodes (numpy.ndarray[numpy.float32]):

Array containing size non-uniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.

Parameter values (numpy.ndarray[numpy.float32]):

Array containing function evaluations matched to the entries of nodes.

Parameter size:

Denotes the size of the values array

Parameter y (drjit.llvm.ad.Float):

Input parameter for the inversion

Parameter eps (float):

Error tolerance (default: 1e-6f)

Returns → drjit.llvm.ad.Float:

The spline parameter t such that eval_1d(..., t)=y


mitsuba.spline.sample_1d(overloaded)#
sample_1d(min, max, values, cdf, sample, eps=9.999999974752427e-07)#

Importance sample a segment of a uniformly sampled 1D Catmull-Rom spline interpolant

Parameter min (float):

Position of the first node

Parameter max (float):

Position of the last node

Parameter values (numpy.ndarray[numpy.float32]):

Array containing size regularly spaced evaluations in the range [min, max] of the approximated function.

Parameter cdf (numpy.ndarray[numpy.float32]):

Array containing a cumulative distribution function computed by integrate_1d().

Parameter size:

Denotes the size of the values array

Parameter sample (drjit.llvm.ad.Float):

A uniformly distributed random sample in the interval [0,1]

Parameter eps (float):

Error tolerance (default: 1e-6f)

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

1. The sampled position 2. The value of the spline evaluated at the sampled position 3. The probability density at the sampled position (which only differs from item 2. when the function does not integrate to one)

sample_1d(nodes, values, cdf, sample, eps=9.999999974752427e-07)#

Importance sample a segment of a non-uniformly sampled 1D Catmull- Rom spline interpolant

Parameter nodes (numpy.ndarray[numpy.float32]):

Array containing size non-uniformly spaced values denoting positions the where the function to be interpolated was evaluated. They must be provided in increasing order.

Parameter values (numpy.ndarray[numpy.float32]):

Array containing function evaluations matched to the entries of nodes.

Parameter cdf (numpy.ndarray[numpy.float32]):

Array containing a cumulative distribution function computed by integrate_1d().

Parameter size:

Denotes the size of the values array

Parameter sample (drjit.llvm.ad.Float):

A uniformly distributed random sample in the interval [0,1]

Parameter eps (float):

Error tolerance (default: 1e-6f)

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

1. The sampled position 2. The value of the spline evaluated at the sampled position 3. The probability density at the sampled position (which only differs from item 2. when the function does not integrate to one)


mitsuba.quad.chebyshev(n)#

Computes the Chebyshev nodes, i.e. the roots of the Chebyshev polynomials of the first kind

The output array contains positions on the interval \([-1, 1]\).

Parameter n (int):

Desired number of points

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.quad.composite_simpson(n)#

Computes the nodes and weights of a composite Simpson quadrature rule with the given number of evaluations.

Integration is over the interval \([-1, 1]\), which will be split into \((n-1) / 2\) sub-intervals with overlapping endpoints. A 3-point Simpson rule is applied per interval, which is exact for polynomials of degree three or less.

Parameter n (int):

Desired number of evaluation points. Must be an odd number bigger than 3.

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple (nodes, weights) storing the nodes and weights of the quadrature rule.


mitsuba.quad.composite_simpson_38(n)#

Computes the nodes and weights of a composite Simpson 3/8 quadrature rule with the given number of evaluations.

Integration is over the interval \([-1, 1]\), which will be split into \((n-1) / 3\) sub-intervals with overlapping endpoints. A 4-point Simpson rule is applied per interval, which is exact for polynomials of degree four or less.

Parameter n (int):

Desired number of evaluation points. Must be an odd number bigger than 3.

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple (nodes, weights) storing the nodes and weights of the quadrature rule.


mitsuba.quad.gauss_legendre(n)#

Computes the nodes and weights of a Gauss-Legendre quadrature (aka “Gaussian quadrature”) rule with the given number of evaluations.

Integration is over the interval \([-1, 1]\). Gauss-Legendre quadrature maximizes the order of exactly integrable polynomials achieves this up to degree \(2n-1\) (where \(n\) is the number of function evaluations).

This method is numerically well-behaved until about \(n=200\) and then becomes progressively less accurate. It is generally not a good idea to go much higher—in any case, a composite or adaptive integration scheme will be superior for large \(n\).

Parameter n (int):

Desired number of evaluation points

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple (nodes, weights) storing the nodes and weights of the quadrature rule.


mitsuba.quad.gauss_lobatto(n)#

Computes the nodes and weights of a Gauss-Lobatto quadrature rule with the given number of evaluations.

Integration is over the interval \([-1, 1]\). Gauss-Lobatto quadrature is preferable to Gauss-Legendre quadrature whenever the endpoints of the integration domain should explicitly be included. It maximizes the order of exactly integrable polynomials subject to this constraint and achieves this up to degree \(2n-3\) (where \(n\) is the number of function evaluations).

This method is numerically well-behaved until about \(n=200\) and then becomes progressively less accurate. It is generally not a good idea to go much higher—in any case, a composite or adaptive integration scheme will be superior for large \(n\).

Parameter n (int):

Desired number of evaluation points

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple (nodes, weights) storing the nodes and weights of the quadrature rule.


class mitsuba.RadicalInverse#

Base class: mitsuba.Object

Efficient implementation of a radical inverse function with prime bases including scrambled versions.

This class is used to implement Halton and Hammersley sequences for QMC integration in Mitsuba.

__init__(self, max_base=8161, scramble=-1)#
Parameter max_base (int):

no description available

Parameter scramble (int):

no description available

base(self, arg0)#

Returns the n-th prime base used by the sequence

These prime numbers are used as bases in the radical inverse function implementation.

Parameter arg0 (int):

no description available

Returns → int:

no description available

bases(self)#

Return the number of prime bases for which precomputed tables are available

Returns → int:

no description available

eval(self, base_index, index)#

Calculate the radical inverse function

This function is used as a building block to construct Halton and Hammersley sequences. Roughly, it computes a b-ary representation of the input value index, mirrors it along the decimal point, and returns the resulting fractional value. The implementation here uses prime numbers for b.

Parameter base_index (int):

Selects the n-th prime that is used as a base when computing the radical inverse function (0 corresponds to 2, 1->3, 2->5, etc.). The value specified here must be between 0 and 1023.

Parameter index (drjit.llvm.ad.UInt64):

Denotes the index that should be mapped through the radical inverse function

Returns → drjit.llvm.ad.Float:

no description available

inverse_permutation(self, arg0)#

Return the inverse permutation corresponding to the given prime number basis

Parameter arg0 (int):

no description available

Returns → int:

no description available

permutation(self, arg0)#

Return the permutation corresponding to the given prime number basis

Parameter arg0 (int):

no description available

Returns → numpy.ndarray[numpy.uint16]:

no description available

scramble(self)#

Return the original scramble value

Returns → int:

no description available


mitsuba.radical_inverse_2(index, scramble)#

Van der Corput radical inverse in base 2

Parameter index (drjit.llvm.ad.UInt):

no description available

Parameter scramble (drjit.llvm.ad.UInt):

no description available

Returns → drjit.llvm.ad.Float:

no description available


mitsuba.coordinate_system(n)#

Complete the set {a} to an orthonormal basis {a, b, c}

Parameter n (mitsuba.Vector3f):

no description available

Returns → Tuple[mitsuba.Vector3f, mitsuba.Vector3f]:

no description available


mitsuba.reflect(overloaded)#
reflect(wi)#

Reflection in local coordinates

Parameter wi (mitsuba.Vector3f):

no description available

Returns → mitsuba.Vector3f:

no description available

reflect(wi, m)#

Reflect wi with respect to a given surface normal

Parameter wi (mitsuba.Vector3f):

no description available

Parameter m (mitsuba.Normal3f):

no description available

Returns → mitsuba.Vector3f:

no description available


mitsuba.refract(overloaded)#
refract(wi, cos_theta_t, eta_ti)#

Refraction in local coordinates

The ‘cos_theta_t’ and ‘eta_ti’ parameters are given by the last two tuple entries returned by the fresnel and fresnel_polarized functions.

Parameter wi (mitsuba.Vector3f):

no description available

Parameter cos_theta_t (drjit.llvm.ad.Float):

no description available

Parameter eta_ti (drjit.llvm.ad.Float):

no description available

Returns → mitsuba.Vector3f:

no description available

refract(wi, m, cos_theta_t, eta_ti)#

Refract wi with respect to a given surface normal

Parameter wi (mitsuba.Vector3f):

Direction to refract

Parameter m (mitsuba.Normal3f):

Surface normal

Parameter cos_theta_t (drjit.llvm.ad.Float):

Cosine of the angle between the normal the transmitted ray, as computed e.g. by fresnel.

Parameter eta_ti (drjit.llvm.ad.Float):

Relative index of refraction (transmitted / incident)

Returns → mitsuba.Vector3f:

no description available


mitsuba.fresnel(cos_theta_i, eta)#

Calculates the unpolarized Fresnel reflection coefficient at a planar interface between two dielectrics

Parameter cos_theta_i (drjit.llvm.ad.Float):

Cosine of the angle between the surface normal and the incident ray

Parameter eta (drjit.llvm.ad.Float):

Relative refractive index of the interface. A value greater than 1.0 means that the surface normal is pointing into the region of lower density.

Returns → Tuple[drjit.llvm.ad.Float, drjit.llvm.ad.Float, drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

A tuple (F, cos_theta_t, eta_it, eta_ti) consisting of

F Fresnel reflection coefficient.

cos_theta_t Cosine of the angle between the surface normal and the transmitted ray

eta_it Relative index of refraction in the direction of travel.

eta_ti Reciprocal of the relative index of refraction in the direction of travel. This also happens to be equal to the scale factor that must be applied to the X and Y component of the refracted direction.


mitsuba.fresnel_conductor(cos_theta_i, eta)#

Calculates the unpolarized Fresnel reflection coefficient at a planar interface of a conductor, i.e. a surface with a complex-valued relative index of refraction

Remark:

The implementation assumes that cos_theta_i > 0, i.e. light enters from outside of the conducting layer (generally a reasonable assumption unless very thin layers are being simulated)

Parameter cos_theta_i (drjit.llvm.ad.Float):

Cosine of the angle between the surface normal and the incident ray

Parameter eta (drjit.llvm.ad.Complex2f):

Relative refractive index (complex-valued)

Returns → drjit.llvm.ad.Float:

The unpolarized Fresnel reflection coefficient.


mitsuba.fresnel_diffuse_reflectance(eta)#

Computes the diffuse unpolarized Fresnel reflectance of a dielectric material (sometimes referred to as “Fdr”).

This value quantifies what fraction of diffuse incident illumination will, on average, be reflected at a dielectric material boundary

Parameter eta (drjit.llvm.ad.Float):

Relative refraction coefficient

Returns → drjit.llvm.ad.Float:

F, the unpolarized Fresnel coefficient.


mitsuba.fresnel_polarized(cos_theta_i, eta)#

Calculates the polarized Fresnel reflection coefficient at a planar interface between two dielectrics or conductors. Returns complex values encoding the amplitude and phase shift of the s- and p-polarized waves.

This is the most general version, which subsumes all others (at the cost of transcendental function evaluations in the complex-valued arithmetic)

Parameter cos_theta_i (drjit.llvm.ad.Float):

Cosine of the angle between the surface normal and the incident ray

Parameter eta (drjit.llvm.ad.Complex2f):

Complex-valued relative refractive index of the interface. In the real case, a value greater than 1.0 case means that the surface normal points into the region of lower density.

Returns → Tuple[drjit.llvm.ad.Complex2f, drjit.llvm.ad.Complex2f, drjit.llvm.ad.Float, drjit.llvm.ad.Complex2f, drjit.llvm.ad.Complex2f]:

A tuple (a_s, a_p, cos_theta_t, eta_it, eta_ti) consisting of

a_s Perpendicularly polarized wave amplitude and phase shift.

a_p Parallel polarized wave amplitude and phase shift.

cos_theta_t Cosine of the angle between the surface normal and the transmitted ray. Zero in the case of total internal reflection.

eta_it Relative index of refraction in the direction of travel

eta_ti Reciprocal of the relative index of refraction in the direction of travel. In the real-valued case, this also happens to be equal to the scale factor that must be applied to the X and Y component of the refracted direction.


mitsuba.perspective_projection(film_size, crop_size, crop_offset, fov_x, near_clip, far_clip)#

Helper function to create a perspective projection transformation matrix

Parameter film_size (mitsuba.ScalarVector2i):

no description available

Parameter crop_size (mitsuba.ScalarVector2i):

no description available

Parameter crop_offset (mitsuba.ScalarVector2i):

no description available

Parameter fov_x (drjit.llvm.ad.Float):

no description available

Parameter near_clip (drjit.llvm.ad.Float):

no description available

Parameter far_clip (drjit.llvm.ad.Float):

no description available

Returns → mitsuba.Transform4f:

no description available


Random#

mitsuba.sample_tea_32(overloaded)#
sample_tea_32(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

For details, refer to “GPU Random Numbers via the Tiny Encryption Algorithm” by Fahad Zafar, Marc Olano, and Aaron Curtis.

Parameter v0 (int):

First input value to be encrypted (could be the sample index)

Parameter v1 (int):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → Tuple[int, int]:

Two uniformly distributed 32-bit integers

sample_tea_32(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

For details, refer to “GPU Random Numbers via the Tiny Encryption Algorithm” by Fahad Zafar, Marc Olano, and Aaron Curtis.

Parameter v0 (drjit.llvm.ad.UInt):

First input value to be encrypted (could be the sample index)

Parameter v1 (drjit.llvm.ad.UInt):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → Tuple[drjit.llvm.ad.UInt, drjit.llvm.ad.UInt]:

Two uniformly distributed 32-bit integers


mitsuba.sample_tea_64(overloaded)#
sample_tea_64(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

For details, refer to “GPU Random Numbers via the Tiny Encryption Algorithm” by Fahad Zafar, Marc Olano, and Aaron Curtis.

Parameter v0 (int):

First input value to be encrypted (could be the sample index)

Parameter v1 (int):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → int:

A uniformly distributed 64-bit integer

sample_tea_64(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

For details, refer to “GPU Random Numbers via the Tiny Encryption Algorithm” by Fahad Zafar, Marc Olano, and Aaron Curtis.

Parameter v0 (drjit.llvm.ad.UInt):

First input value to be encrypted (could be the sample index)

Parameter v1 (drjit.llvm.ad.UInt):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → drjit.llvm.ad.UInt64:

A uniformly distributed 64-bit integer


mitsuba.sample_tea_float()#

sample_tea_float64(*args, **kwargs) Overloaded function.

  1. sample_tea_float64(v0: int, v1: int, rounds: int = 4) -> float

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

This function uses sample_tea to return double precision floating point numbers on the interval [0, 1)

Parameter v0:

First input value to be encrypted (could be the sample index)

Parameter v1:

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds:

How many rounds should be executed? The default for random number generation is 4.

Returns:

A uniformly distributed floating point number on the interval [0, 1)

  1. sample_tea_float64(v0: drjit.llvm.ad.UInt, v1: drjit.llvm.ad.UInt, rounds: int = 4) -> drjit.llvm.ad.Float64

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

This function uses sample_tea to return double precision floating point numbers on the interval [0, 1)

Parameter v0:

First input value to be encrypted (could be the sample index)

Parameter v1:

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds:

How many rounds should be executed? The default for random number generation is 4.

Returns:

A uniformly distributed floating point number on the interval [0, 1)


mitsuba.sample_tea_float32(overloaded)#
sample_tea_float32(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

This function uses sample_tea to return single precision floating point numbers on the interval [0, 1)

Parameter v0 (int):

First input value to be encrypted (could be the sample index)

Parameter v1 (int):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → float:

A uniformly distributed floating point number on the interval [0, 1)

sample_tea_float32(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

This function uses sample_tea to return single precision floating point numbers on the interval [0, 1)

Parameter v0 (drjit.llvm.ad.UInt):

First input value to be encrypted (could be the sample index)

Parameter v1 (drjit.llvm.ad.UInt):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → drjit.llvm.ad.Float:

A uniformly distributed floating point number on the interval [0, 1)


mitsuba.sample_tea_float64(overloaded)#
sample_tea_float64(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

This function uses sample_tea to return double precision floating point numbers on the interval [0, 1)

Parameter v0 (int):

First input value to be encrypted (could be the sample index)

Parameter v1 (int):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → float:

A uniformly distributed floating point number on the interval [0, 1)

sample_tea_float64(v0, v1, rounds=4)#

Generate fast and reasonably good pseudorandom numbers using the Tiny Encryption Algorithm (TEA) by David Wheeler and Roger Needham.

This function uses sample_tea to return double precision floating point numbers on the interval [0, 1)

Parameter v0 (drjit.llvm.ad.UInt):

First input value to be encrypted (could be the sample index)

Parameter v1 (drjit.llvm.ad.UInt):

Second input value to be encrypted (e.g. the requested random number dimension)

Parameter rounds (int):

How many rounds should be executed? The default for random number generation is 4.

Returns → drjit.llvm.ad.Float64:

A uniformly distributed floating point number on the interval [0, 1)


class mitsuba.PCG32#
__init__(self, size=1, initstate=9600629759793949339, initseq=15726070495360670683)#
Parameter size (int):

no description available

Parameter initstate (drjit.llvm.ad.UInt64):

no description available

Parameter initseq (drjit.llvm.ad.UInt64):

no description available

__init__(self, arg0)#
Parameter arg0 (drjit.llvm.ad.PCG32):

no description available

next_float32(overloaded)#
next_float32(self)#
Returns → drjit.llvm.ad.Float:

no description available

next_float32(self, arg0)#
Parameter arg0 (drjit.llvm.ad.Bool):

no description available

Returns → drjit.llvm.ad.Float:

no description available

next_float64(overloaded)#
next_float64(self)#
Returns → drjit.llvm.ad.Float64:

no description available

next_float64(self, arg0)#
Parameter arg0 (drjit.llvm.ad.Bool):

no description available

Returns → drjit.llvm.ad.Float64:

no description available

next_uint32(overloaded)#
next_uint32(self)#
Returns → drjit.llvm.ad.UInt:

no description available

next_uint32(self, arg0)#
Parameter arg0 (drjit.llvm.ad.Bool):

no description available

Returns → drjit.llvm.ad.UInt:

no description available

next_uint32_bounded(self, bound, mask=True)#
Parameter bound (int):

no description available

Parameter mask (drjit.llvm.ad.Bool):

no description available

Returns → drjit.llvm.ad.UInt:

no description available

next_uint64(overloaded)#
next_uint64(self)#
Returns → drjit.llvm.ad.UInt64:

no description available

next_uint64(self, arg0)#
Parameter arg0 (drjit.llvm.ad.Bool):

no description available

Returns → drjit.llvm.ad.UInt64:

no description available

next_uint64_bounded(self, bound, mask=True)#
Parameter bound (int):

no description available

Parameter mask (drjit.llvm.ad.Bool):

no description available

Returns → drjit.llvm.ad.UInt64:

no description available

seed(self, size=1, initstate=9600629759793949339, initseq=15726070495360670683)#
Parameter size (int):

no description available

Parameter initstate (drjit.llvm.ad.UInt64):

no description available

Parameter initseq (drjit.llvm.ad.UInt64):

no description available

Returns → None:

no description available


mitsuba.permute(value, size, seed, rounds=4)#

Generate pseudorandom permutation vector using a shuffling network

This algorithm repeatedly invokes sample_tea_32() internally and has O(log2(sample_count)) complexity. It only supports permutation vectors, whose lengths are a power of 2.

Parameter index:

Input index to be permuted

Parameter size (int):

Length of the permutation vector

Parameter seed (drjit.llvm.ad.UInt):

Seed value used as second input to the Tiny Encryption Algorithm. Can be used to generate different permutation vectors.

Parameter rounds (int):

How many rounds should be executed by the Tiny Encryption Algorithm? The default is 2.

Parameter value (drjit.llvm.ad.UInt):

no description available

Returns → drjit.llvm.ad.UInt:

The index corresponding to the input index in the pseudorandom permutation vector.


mitsuba.permute_kensler(i, l, p, active=True)#

Generate pseudorandom permutation vector using the algorithm described in Pixar’s technical memo “Correlated Multi-Jittered Sampling”:

https://graphics.pixar.com/library/MultiJitteredSampling/

Unlike permute, this function supports permutation vectors of any length.

Parameter index:

Input index to be mapped

Parameter sample_count:

Length of the permutation vector

Parameter seed:

Seed value used as second input to the Tiny Encryption Algorithm. Can be used to generate different permutation vectors.

Parameter i (drjit.llvm.ad.UInt):

no description available

Parameter l (int):

no description available

Parameter p (drjit.llvm.ad.UInt):

no description available

Parameter active (drjit.llvm.ad.Bool):

Mask to specify active lanes.

Returns → drjit.llvm.ad.UInt:

The index corresponding to the input index in the pseudorandom permutation vector.


mitsuba.sobol_2(index, scramble)#

Sobol’ radical inverse in base 2

Parameter index (drjit.llvm.ad.UInt):

no description available

Parameter scramble (drjit.llvm.ad.UInt):

no description available

Returns → drjit.llvm.ad.Float:

no description available


Log#

class mitsuba.LogLevel#

Available Log message types

Members:

Trace#
Debug#

Trace message, for extremely verbose debugging

Info#

Debug message, usually turned off

Warn#

More relevant debug / information message

Error#

Warning message

__init__(self, value)#
Parameter value (int):

no description available

property name#

class mitsuba.Logger#

Base class: mitsuba.Object

Responsible for processing log messages

Upon receiving a log message, the Logger class invokes a Formatter to convert it into a human-readable form. Following that, it sends this information to every registered Appender.

__init__(self, arg0)#

Construct a new logger with the given minimum log level

Parameter arg0 (mitsuba.LogLevel):

no description available

add_appender(self, arg0)#

Add an appender to this logger

Parameter arg0 (mitsuba.Appender):

no description available

Returns → None:

no description available

appender(self, arg0)#

Return one of the appenders

Parameter arg0 (int):

no description available

Returns → mitsuba.Appender:

no description available

appender_count(self)#

Return the number of registered appenders

Returns → int:

no description available

clear_appenders(self)#

Remove all appenders from this logger

Returns → None:

no description available

error_level(self)#

Return the current error level

Returns → mitsuba.LogLevel:

no description available

formatter(self)#

Return the logger’s formatter implementation

Returns → mitsuba.Formatter:

no description available

log_level(self)#

Return the current log level

Returns → mitsuba.LogLevel:

no description available

log_progress(self, progress, name, formatted, eta, ptr=None)#

Process a progress message

Parameter progress (float):

Percentage value in [0, 100]

Parameter name (str):

Title of the progress message

Parameter formatted (str):

Formatted string representation of the message

Parameter eta (str):

Estimated time until 100% is reached.

Parameter ptr (capsule):

Custom pointer payload. This is used to express the context of a progress message. When rendering a scene, it will usually contain a pointer to the associated RenderJob.

Returns → None:

no description available

read_log(self)#

Return the contents of the log file as a string

Throws a runtime exception upon failure

Returns → str:

no description available

remove_appender(self, arg0)#

Remove an appender from this logger

Parameter arg0 (mitsuba.Appender):

no description available

Returns → None:

no description available

set_error_level(self, arg0)#

Set the error log level (this level and anything above will throw exceptions).

The value provided here can be used for instance to turn warnings into errors. But level must always be less than Error, i.e. it isn’t possible to cause errors not to throw an exception.

Parameter arg0 (mitsuba.LogLevel):

no description available

Returns → None:

no description available

set_formatter(self, arg0)#

Set the logger’s formatter implementation

Parameter arg0 (mitsuba.Formatter):

no description available

Returns → None:

no description available

set_log_level(self, arg0)#

Set the log level (everything below will be ignored)

Parameter arg0 (mitsuba.LogLevel):

no description available

Returns → None:

no description available


class mitsuba.Appender#

Base class: mitsuba.Object

This class defines an abstract destination for logging-relevant information

__init__(self)#
append(self, level, text)#

Append a line of text with the given log level

Parameter level (mitsuba.LogLevel):

no description available

Parameter text (str):

no description available

Returns → None:

no description available

log_progress(self, progress, name, formatted, eta, ptr=None)#

Process a progress message

Parameter progress (float):

Percentage value in [0, 100]

Parameter name (str):

Title of the progress message

Parameter formatted (str):

Formatted string representation of the message

Parameter eta (str):

Estimated time until 100% is reached.

Parameter ptr (capsule):

Custom pointer payload. This is used to express the context of a progress message. When rendering a scene, it will usually contain a pointer to the associated RenderJob.

Returns → None:

no description available


Types#

class mitsuba.ScalarBoundingBox2f#

Generic n-dimensional bounding box data structure

Maintains a minimum and maximum position along each dimension and provides various convenience functions for querying and modifying them.

This class is parameterized by the underlying point data structure, which permits the use of different scalar types and dimensionalities, e.g.

BoundingBox<Point3i> integer_bbox(Point3i(0, 1, 3), Point3i(4, 5, 6));
BoundingBox<Point2d> double_bbox(Point2d(0.0, 1.0), Point2d(4.0, 5.0));
Template parameter T:

The underlying point data type (e.g. Point2d)

__init__(self)#

Create a new invalid bounding box

Initializes the components of the minimum and maximum position to \(\infty\) and \(-\infty\), respectively.

__init__(self, p)#

Create a collapsed bounding box from a single point

Parameter p (mitsuba.ScalarPoint2f):

no description available

__init__(self, min, max)#

Create a bounding box from two positions

Parameter min (mitsuba.ScalarPoint2f):

no description available

Parameter max (mitsuba.ScalarPoint2f):

no description available

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.ScalarBoundingBox2f):

no description available

center(self)#

Return the center point

Returns → mitsuba.ScalarPoint2f:

no description available

clip(self, arg0)#

Clip this bounding box to another bounding box

Parameter arg0 (mitsuba.ScalarBoundingBox2f):

no description available

Returns → None:

no description available

collapsed(self)#

Check whether this bounding box has collapsed to a point, line, or plane

Returns → bool:

no description available

contains(overloaded)#
contains(self, p, strict=False)#

Check whether a point lies on or inside the bounding box

Parameter p (mitsuba.ScalarPoint2f):

The point to be tested

Template parameter Strict:

Set this parameter to True if the bounding box boundary should be excluded in the test

Remark:

In the Python bindings, the ‘Strict’ argument is a normal function parameter with default value False.

Parameter strict (bool):

no description available

Returns → bool:

no description available

contains(self, bbox, strict=False)#

Check whether a specified bounding box lies on or within the current bounding box

Note that by definition, an ‘invalid’ bounding box (where min=:math:infty and max=:math:-infty) does not cover any space. Hence, this method will always return true when given such an argument.

Template parameter Strict:

Set this parameter to True if the bounding box boundary should be excluded in the test

Remark:

In the Python bindings, the ‘Strict’ argument is a normal function parameter with default value False.

Parameter bbox (mitsuba.ScalarBoundingBox2f):

no description available

Parameter strict (bool):

no description available

Returns → bool:

no description available

corner(self, arg0)#

Return the position of a bounding box corner

Parameter arg0 (int):

no description available

Returns → mitsuba.ScalarPoint2f:

no description available

distance(overloaded)#
distance(self, arg0)#

Calculate the shortest distance between the axis-aligned bounding box and the point p.

Parameter arg0 (mitsuba.ScalarPoint2f):

no description available

Returns → float:

no description available

distance(self, arg0)#

Calculate the shortest distance between the axis-aligned bounding box and bbox.

Parameter arg0 (mitsuba.ScalarBoundingBox2f):

no description available

Returns → float:

no description available

expand(overloaded)#
expand(self, arg0)#

Expand the bounding box to contain another point

Parameter arg0 (mitsuba.ScalarPoint2f):

no description available

expand(self, arg0)#

Expand the bounding box to contain another bounding box

Parameter arg0 (mitsuba.ScalarBoundingBox2f):

no description available

extents(self)#

Calculate the bounding box extents

Returns → mitsuba.ScalarVector2f:

max - min

major_axis(self)#

Return the dimension index with the index associated side length

Returns → int:

no description available

merge(arg0, arg1)#

Merge two bounding boxes

Parameter arg0 (mitsuba.ScalarBoundingBox2f):

no description available

Parameter arg1 (mitsuba.ScalarBoundingBox2f):

no description available

Returns → mitsuba.ScalarBoundingBox2f:

no description available

minor_axis(self)#

Return the dimension index with the shortest associated side length

Returns → int:

no description available

overlaps(self, bbox, strict=False)#

Check two axis-aligned bounding boxes for possible overlap.

Parameter Strict:

Set this parameter to True if the bounding box boundary should be excluded in the test

Remark:

In the Python bindings, the ‘Strict’ argument is a normal function parameter with default value False.

Parameter bbox (mitsuba.ScalarBoundingBox2f):

no description available

Parameter strict (bool):

no description available

Returns → bool:

True If overlap was detected.

reset(self)#

Mark the bounding box as invalid.

This operation sets the components of the minimum and maximum position to \(\infty\) and \(-\infty\), respectively.

Returns → None:

no description available

squared_distance(overloaded)#
squared_distance(self, arg0)#

Calculate the shortest squared distance between the axis-aligned bounding box and the point p.

Parameter arg0 (mitsuba.ScalarPoint2f):

no description available

Returns → float:

no description available

squared_distance(self, arg0)#

Calculate the shortest squared distance between the axis-aligned bounding box and bbox.

Parameter arg0 (mitsuba.ScalarBoundingBox2f):

no description available

Returns → float:

no description available

surface_area(self)#

Calculate the 2-dimensional surface area of a 3D bounding box

Returns → float:

no description available

valid(self)#

Check whether this is a valid bounding box

A bounding box bbox is considered to be valid when

bbox.min[i] <= bbox.max[i]

holds for each component i.

Returns → bool:

no description available

volume(self)#

Calculate the n-dimensional volume of the bounding box

Returns → float:

no description available


class mitsuba.ScalarBoundingBox3f#

Generic n-dimensional bounding box data structure

Maintains a minimum and maximum position along each dimension and provides various convenience functions for querying and modifying them.

This class is parameterized by the underlying point data structure, which permits the use of different scalar types and dimensionalities, e.g.

BoundingBox<Point3i> integer_bbox(Point3i(0, 1, 3), Point3i(4, 5, 6));
BoundingBox<Point2d> double_bbox(Point2d(0.0, 1.0), Point2d(4.0, 5.0));
Template parameter T:

The underlying point data type (e.g. Point2d)

__init__(self)#

Create a new invalid bounding box

Initializes the components of the minimum and maximum position to \(\infty\) and \(-\infty\), respectively.

__init__(self, p)#

Create a collapsed bounding box from a single point

Parameter p (mitsuba.ScalarPoint3f):

no description available

__init__(self, min, max)#

Create a bounding box from two positions

Parameter min (mitsuba.ScalarPoint3f):

no description available

Parameter max (mitsuba.ScalarPoint3f):

no description available

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.ScalarBoundingBox3f):

no description available

bounding_sphere(self)#

Create a bounding sphere, which contains the axis-aligned box

Returns → mitsuba.BoundingSphere:

no description available

center(self)#

Return the center point

Returns → mitsuba.ScalarPoint3f:

no description available

clip(self, arg0)#

Clip this bounding box to another bounding box

Parameter arg0 (mitsuba.ScalarBoundingBox3f):

no description available

Returns → None:

no description available

collapsed(self)#

Check whether this bounding box has collapsed to a point, line, or plane

Returns → bool:

no description available

contains(overloaded)#
contains(self, p, strict=False)#

Check whether a point lies on or inside the bounding box

Parameter p (mitsuba.ScalarPoint3f):

The point to be tested

Template parameter Strict:

Set this parameter to True if the bounding box boundary should be excluded in the test

Remark:

In the Python bindings, the ‘Strict’ argument is a normal function parameter with default value False.

Parameter strict (bool):

no description available

Returns → bool:

no description available

contains(self, bbox, strict=False)#

Check whether a specified bounding box lies on or within the current bounding box

Note that by definition, an ‘invalid’ bounding box (where min=:math:infty and max=:math:-infty) does not cover any space. Hence, this method will always return true when given such an argument.

Template parameter Strict:

Set this parameter to True if the bounding box boundary should be excluded in the test

Remark:

In the Python bindings, the ‘Strict’ argument is a normal function parameter with default value False.

Parameter bbox (mitsuba.ScalarBoundingBox3f):

no description available

Parameter strict (bool):

no description available

Returns → bool:

no description available

corner(self, arg0)#

Return the position of a bounding box corner

Parameter arg0 (int):

no description available

Returns → mitsuba.ScalarPoint3f:

no description available

distance(overloaded)#
distance(self, arg0)#

Calculate the shortest distance between the axis-aligned bounding box and the point p.

Parameter arg0 (mitsuba.ScalarPoint3f):

no description available

Returns → float:

no description available

distance(self, arg0)#

Calculate the shortest distance between the axis-aligned bounding box and bbox.

Parameter arg0 (mitsuba.ScalarBoundingBox3f):

no description available

Returns → float:

no description available

expand(overloaded)#
expand(self, arg0)#

Expand the bounding box to contain another point

Parameter arg0 (mitsuba.ScalarPoint3f):

no description available

expand(self, arg0)#

Expand the bounding box to contain another bounding box

Parameter arg0 (mitsuba.ScalarBoundingBox3f):

no description available

extents(self)#

Calculate the bounding box extents

Returns → mitsuba.ScalarVector3f:

max - min

major_axis(self)#

Return the dimension index with the index associated side length

Returns → int:

no description available

merge(arg0, arg1)#

Merge two bounding boxes

Parameter arg0 (mitsuba.ScalarBoundingBox3f):

no description available

Parameter arg1 (mitsuba.ScalarBoundingBox3f):

no description available

Returns → mitsuba.ScalarBoundingBox3f:

no description available

minor_axis(self)#

Return the dimension index with the shortest associated side length

Returns → int:

no description available

overlaps(self, bbox, strict=False)#

Check two axis-aligned bounding boxes for possible overlap.

Parameter Strict:

Set this parameter to True if the bounding box boundary should be excluded in the test

Remark:

In the Python bindings, the ‘Strict’ argument is a normal function parameter with default value False.

Parameter bbox (mitsuba.ScalarBoundingBox3f):

no description available

Parameter strict (bool):

no description available

Returns → bool:

True If overlap was detected.

ray_intersect(self, ray)#

Check if a ray intersects a bounding box

Note that this function ignores the maxt value associated with the ray.

Parameter ray (mitsuba.Ray3f):

no description available

Returns → Tuple[drjit.llvm.ad.Bool, drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

no description available

reset(self)#

Mark the bounding box as invalid.

This operation sets the components of the minimum and maximum position to \(\infty\) and \(-\infty\), respectively.

Returns → None:

no description available

squared_distance(overloaded)#
squared_distance(self, arg0)#

Calculate the shortest squared distance between the axis-aligned bounding box and the point p.

Parameter arg0 (mitsuba.ScalarPoint3f):

no description available

Returns → float:

no description available

squared_distance(self, arg0)#

Calculate the shortest squared distance between the axis-aligned bounding box and bbox.

Parameter arg0 (mitsuba.ScalarBoundingBox3f):

no description available

Returns → float:

no description available

surface_area(self)#

Calculate the 2-dimensional surface area of a 3D bounding box

Returns → float:

no description available

valid(self)#

Check whether this is a valid bounding box

A bounding box bbox is considered to be valid when

bbox.min[i] <= bbox.max[i]

holds for each component i.

Returns → bool:

no description available

volume(self)#

Calculate the n-dimensional volume of the bounding box

Returns → float:

no description available


class mitsuba.ScalarBoundingSphere3f#

Generic n-dimensional bounding sphere data structure

__init__(self)#

Construct bounding sphere(s) at the origin having radius zero

__init__(self, arg0, arg1)#

Create bounding sphere(s) from given center point(s) with given size(s)

Parameter arg0 (mitsuba.ScalarPoint3f):

no description available

Parameter arg1 (float):

no description available

__init__(self, arg0)#
Parameter arg0 (mitsuba.ScalarBoundingSphere3f):

no description available

contains(self, p, strict=False)#

Check whether a point lies on or inside the bounding sphere

Parameter p (mitsuba.ScalarPoint3f):

The point to be tested

Template parameter Strict:

Set this parameter to True if the bounding sphere boundary should be excluded in the test

Remark:

In the Python bindings, the ‘Strict’ argument is a normal function parameter with default value False.

Parameter strict (bool):

no description available

Returns → bool:

no description available

empty(self)#

Return whether this bounding sphere has a radius of zero or less.

Returns → bool:

no description available

expand(self, arg0)#

Expand the bounding sphere radius to contain another point.

Parameter arg0 (mitsuba.ScalarPoint3f):

no description available

Returns → None:

no description available

ray_intersect(self, ray)#

Check if a ray intersects a bounding box

Parameter ray (mitsuba.Ray3f):

no description available

Returns → Tuple[drjit.llvm.ad.Bool, drjit.llvm.ad.Float, drjit.llvm.ad.Float]:

no description available


class mitsuba.ScalarColor0d#

class mitsuba.ScalarColor0f#

class mitsuba.ScalarColor1d#

class mitsuba.ScalarColor1f#

class mitsuba.ScalarColor3d#

class mitsuba.ScalarColor3f#

class mitsuba.ScalarNormal3d#

class mitsuba.ScalarNormal3f#

class mitsuba.ScalarPoint0d#

class mitsuba.ScalarPoint0f#

class mitsuba.ScalarPoint0i#

class mitsuba.ScalarPoint0u#

class mitsuba.ScalarPoint1d#

class mitsuba.ScalarPoint1f#

class mitsuba.ScalarPoint1i#

class mitsuba.ScalarPoint1u#

class mitsuba.ScalarPoint2d#

class mitsuba.ScalarPoint2f#

class mitsuba.ScalarPoint2i#

class mitsuba.ScalarPoint2u#

class mitsuba.ScalarPoint3d#

class mitsuba.ScalarPoint3f#

class mitsuba.ScalarPoint3i#

class mitsuba.ScalarPoint3u#

class mitsuba.ScalarPoint4d#

class mitsuba.ScalarPoint4f#

class mitsuba.ScalarPoint4i#

class mitsuba.ScalarPoint4u#

class mitsuba.ScalarTransform3d#

Encapsulates a 4x4 homogeneous coordinate transformation along with its inverse transpose

The Transform class provides a set of overloaded matrix-vector multiplication operators for vectors, points, and normals (all of them behave differently under homogeneous coordinate transformations, hence the need to represent them using separate types)

__init__(self)#

Initialize with the identity matrix

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.ScalarTransform3d):

no description available

__init__(self, arg0)#
Parameter arg0 (numpy.ndarray):

no description available

__init__(self, arg0)#
Parameter arg0 (list):

no description available

__init__(self, arg0)#

Initialize the transformation from the given matrix (and compute its inverse transpose)

Parameter arg0 (drjit.scalar.Matrix3f64):

no description available

__init__(self, arg0, arg1)#

Initialize from a matrix and its inverse transpose

Parameter arg0 (drjit.scalar.Matrix3f64):

no description available

Parameter arg1 (drjit.scalar.Matrix3f64):

no description available

assign(self, arg0)#
Parameter arg0 (mitsuba.ScalarTransform3d):

no description available

Returns → None:

no description available

has_scale(overloaded)#
has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

inverse(self)#

Compute the inverse of this transformation (involves just shuffles, no arithmetic)

Returns → mitsuba.ScalarTransform3d:

no description available

rotate(angle)#

Create a rotation transformation in 2D. The angle is specified in degrees

Parameter angle (float):

no description available

Returns → ChainTransform<double, 3>:

no description available

scale(v)#

Create a scale transformation

Parameter v (mitsuba.ScalarPoint2d):

no description available

Returns → ChainTransform<double, 3>:

no description available

transform_affine(overloaded)#
transform_affine(self, p)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter p (mitsuba.ScalarPoint2d):

no description available

Returns → mitsuba.ScalarPoint2d:

no description available

transform_affine(self, v)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter v (mitsuba.ScalarVector2d):

no description available

Returns → mitsuba.ScalarVector2d:

no description available

translate(v)#

Create a translation transformation

Parameter v (mitsuba.ScalarPoint2d):

no description available

Returns → ChainTransform<double, 3>:

no description available

translation(self)#

Get the translation part of a matrix

Returns → mitsuba.ScalarVector2d:

no description available


class mitsuba.ScalarTransform3f#

Encapsulates a 4x4 homogeneous coordinate transformation along with its inverse transpose

The Transform class provides a set of overloaded matrix-vector multiplication operators for vectors, points, and normals (all of them behave differently under homogeneous coordinate transformations, hence the need to represent them using separate types)

__init__(self)#

Initialize with the identity matrix

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.ScalarTransform3f):

no description available

__init__(self, arg0)#
Parameter arg0 (numpy.ndarray):

no description available

__init__(self, arg0)#
Parameter arg0 (list):

no description available

__init__(self, arg0)#

Initialize the transformation from the given matrix (and compute its inverse transpose)

Parameter arg0 (drjit.scalar.Matrix3f):

no description available

__init__(self, arg0, arg1)#

Initialize from a matrix and its inverse transpose

Parameter arg0 (drjit.scalar.Matrix3f):

no description available

Parameter arg1 (drjit.scalar.Matrix3f):

no description available

assign(self, arg0)#
Parameter arg0 (mitsuba.ScalarTransform3f):

no description available

Returns → None:

no description available

has_scale(overloaded)#
has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

inverse(self)#

Compute the inverse of this transformation (involves just shuffles, no arithmetic)

Returns → mitsuba.ScalarTransform3f:

no description available

rotate(angle)#

Create a rotation transformation in 2D. The angle is specified in degrees

Parameter angle (float):

no description available

Returns → ChainTransform<float, 3>:

no description available

scale(v)#

Create a scale transformation

Parameter v (mitsuba.ScalarPoint2f):

no description available

Returns → ChainTransform<float, 3>:

no description available

transform_affine(overloaded)#
transform_affine(self, p)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter p (mitsuba.ScalarPoint2f):

no description available

Returns → mitsuba.ScalarPoint2f:

no description available

transform_affine(self, v)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter v (mitsuba.ScalarVector2f):

no description available

Returns → mitsuba.ScalarVector2f:

no description available

translate(v)#

Create a translation transformation

Parameter v (mitsuba.ScalarPoint2f):

no description available

Returns → ChainTransform<float, 3>:

no description available

translation(self)#

Get the translation part of a matrix

Returns → mitsuba.ScalarVector2f:

no description available


class mitsuba.ScalarTransform4d#

Encapsulates a 4x4 homogeneous coordinate transformation along with its inverse transpose

The Transform class provides a set of overloaded matrix-vector multiplication operators for vectors, points, and normals (all of them behave differently under homogeneous coordinate transformations, hence the need to represent them using separate types)

__init__(self)#

Initialize with the identity matrix

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.ScalarTransform4d):

no description available

__init__(self, arg0)#
Parameter arg0 (numpy.ndarray):

no description available

__init__(self, arg0)#
Parameter arg0 (list):

no description available

__init__(self, arg0)#

Initialize the transformation from the given matrix (and compute its inverse transpose)

Parameter arg0 (drjit.scalar.Matrix4f64):

no description available

__init__(self, arg0, arg1)#

Initialize from a matrix and its inverse transpose

Parameter arg0 (drjit.scalar.Matrix4f64):

no description available

Parameter arg1 (drjit.scalar.Matrix4f64):

no description available

assign(self, arg0)#
Parameter arg0 (mitsuba.ScalarTransform4d):

no description available

Returns → None:

no description available

extract(self)#

Extract a lower-dimensional submatrix

Returns → mitsuba.ScalarTransform3d:

no description available

from_frame(frame)#

Creates a transformation that converts from ‘frame’ to the standard basis

Parameter frame (mitsuba.Frame):

no description available

Returns → ChainTransform<double, 4>:

no description available

has_scale(overloaded)#
has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

inverse(self)#

Compute the inverse of this transformation (involves just shuffles, no arithmetic)

Returns → mitsuba.ScalarTransform4d:

no description available

look_at(origin, target, up)#

Create a look-at camera transformation

Parameter origin (mitsuba.ScalarPoint3d):

Camera position

Parameter target (mitsuba.ScalarPoint3d):

Target vector

Parameter up (mitsuba.ScalarPoint3d):

Up vector

Returns → ChainTransform<double, 4>:

no description available

orthographic(near, far)#

Create an orthographic transformation, which maps Z to [0,1] and leaves the X and Y coordinates untouched.

Parameter near (float):

Near clipping plane

Parameter far (float):

Far clipping plane

Returns → ChainTransform<double, 4>:

no description available

perspective(fov, near, far)#

Create a perspective transformation. (Maps [near, far] to [0, 1])

Projects vectors in camera space onto a plane at z=1:

x_proj = x / z y_proj = y / z z_proj = (far * (z - near)) / (z * (far- near))

Camera-space depths are not mapped linearly!

Parameter fov (float):

Field of view in degrees

Parameter near (float):

Near clipping plane

Parameter far (float):

Far clipping plane

Returns → ChainTransform<double, 4>:

no description available

rotate(axis, angle)#

Create a rotation transformation around an arbitrary axis in 3D. The angle is specified in degrees

Parameter axis (mitsuba.ScalarPoint3d):

no description available

Parameter angle (float):

no description available

Returns → ChainTransform<double, 4>:

no description available

scale(v)#

Create a scale transformation

Parameter v (mitsuba.ScalarPoint3d):

no description available

Returns → ChainTransform<double, 4>:

no description available

to_frame(frame)#

Creates a transformation that converts from the standard basis to ‘frame’

Parameter frame (mitsuba.Frame):

no description available

Returns → ChainTransform<double, 4>:

no description available

transform_affine(overloaded)#
transform_affine(self, p)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter p (mitsuba.ScalarPoint3d):

no description available

Returns → mitsuba.ScalarPoint3d:

no description available

transform_affine(self, ray)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter ray (mitsuba.Ray):

no description available

Returns → mitsuba.Ray:

no description available

transform_affine(self, v)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter v (mitsuba.ScalarVector3d):

no description available

Returns → mitsuba.ScalarVector3d:

no description available

transform_affine(self, n)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter n (mitsuba.ScalarNormal3d):

no description available

Returns → mitsuba.ScalarNormal3d:

no description available

translate(v)#

Create a translation transformation

Parameter v (mitsuba.ScalarPoint3d):

no description available

Returns → ChainTransform<double, 4>:

no description available

translation(self)#

Get the translation part of a matrix

Returns → mitsuba.ScalarVector3d:

no description available


class mitsuba.ScalarTransform4f#

Encapsulates a 4x4 homogeneous coordinate transformation along with its inverse transpose

The Transform class provides a set of overloaded matrix-vector multiplication operators for vectors, points, and normals (all of them behave differently under homogeneous coordinate transformations, hence the need to represent them using separate types)

__init__(self)#

Initialize with the identity matrix

__init__(self, arg0)#

Copy constructor

Parameter arg0 (mitsuba.ScalarTransform4f):

no description available

__init__(self, arg0)#
Parameter arg0 (numpy.ndarray):

no description available

__init__(self, arg0)#
Parameter arg0 (list):

no description available

__init__(self, arg0)#

Initialize the transformation from the given matrix (and compute its inverse transpose)

Parameter arg0 (drjit.scalar.Matrix4f):

no description available

__init__(self, arg0, arg1)#

Initialize from a matrix and its inverse transpose

Parameter arg0 (drjit.scalar.Matrix4f):

no description available

Parameter arg1 (drjit.scalar.Matrix4f):

no description available

assign(self, arg0)#
Parameter arg0 (mitsuba.ScalarTransform4f):

no description available

Returns → None:

no description available

extract(self)#

Extract a lower-dimensional submatrix

Returns → mitsuba.ScalarTransform3f:

no description available

from_frame(frame)#

Creates a transformation that converts from ‘frame’ to the standard basis

Parameter frame (mitsuba.Frame):

no description available

Returns → ChainTransform<float, 4>:

no description available

has_scale(overloaded)#
has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

has_scale(self)#

Test for a scale component in each transform matrix by checking whether M . M^T == I (where M is the matrix in question and I is the identity).

Returns → bool:

no description available

inverse(self)#

Compute the inverse of this transformation (involves just shuffles, no arithmetic)

Returns → mitsuba.ScalarTransform4f:

no description available

look_at(origin, target, up)#

Create a look-at camera transformation

Parameter origin (mitsuba.ScalarPoint3f):

Camera position

Parameter target (mitsuba.ScalarPoint3f):

Target vector

Parameter up (mitsuba.ScalarPoint3f):

Up vector

Returns → ChainTransform<float, 4>:

no description available

orthographic(near, far)#

Create an orthographic transformation, which maps Z to [0,1] and leaves the X and Y coordinates untouched.

Parameter near (float):

Near clipping plane

Parameter far (float):

Far clipping plane

Returns → ChainTransform<float, 4>:

no description available

perspective(fov, near, far)#

Create a perspective transformation. (Maps [near, far] to [0, 1])

Projects vectors in camera space onto a plane at z=1:

x_proj = x / z y_proj = y / z z_proj = (far * (z - near)) / (z * (far- near))

Camera-space depths are not mapped linearly!

Parameter fov (float):

Field of view in degrees

Parameter near (float):

Near clipping plane

Parameter far (float):

Far clipping plane

Returns → ChainTransform<float, 4>:

no description available

rotate(axis, angle)#

Create a rotation transformation around an arbitrary axis in 3D. The angle is specified in degrees

Parameter axis (mitsuba.ScalarPoint3f):

no description available

Parameter angle (float):

no description available

Returns → ChainTransform<float, 4>:

no description available

scale(v)#

Create a scale transformation

Parameter v (mitsuba.ScalarPoint3f):

no description available

Returns → ChainTransform<float, 4>:

no description available

to_frame(frame)#

Creates a transformation that converts from the standard basis to ‘frame’

Parameter frame (mitsuba.Frame):

no description available

Returns → ChainTransform<float, 4>:

no description available

transform_affine(overloaded)#
transform_affine(self, p)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter p (mitsuba.ScalarPoint3f):

no description available

Returns → mitsuba.ScalarPoint3f:

no description available

transform_affine(self, ray)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter ray (mitsuba.Ray):

no description available

Returns → mitsuba.Ray:

no description available

transform_affine(self, v)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter v (mitsuba.ScalarVector3f):

no description available

Returns → mitsuba.ScalarVector3f:

no description available

transform_affine(self, n)#

Transform a 3D vector/point/normal/ray by a transformation that is known to be an affine 3D transformation (i.e. no perspective)

Parameter n (mitsuba.ScalarNormal3f):

no description available

Returns → mitsuba.ScalarNormal3f:

no description available

translate(v)#

Create a translation transformation

Parameter v (mitsuba.ScalarPoint3f):

no description available

Returns → ChainTransform<float, 4>:

no description available

translation(self)#

Get the translation part of a matrix

Returns → mitsuba.ScalarVector3f:

no description available


class mitsuba.ScalarVector0d#

class mitsuba.ScalarVector0f#

class mitsuba.ScalarVector0i#

class mitsuba.ScalarVector0u#

class mitsuba.ScalarVector1d#

class mitsuba.ScalarVector1f#

class mitsuba.ScalarVector1i#

class mitsuba.ScalarVector1u#

class mitsuba.ScalarVector2d#

class mitsuba.ScalarVector2f#

class mitsuba.ScalarVector2i#

class mitsuba.ScalarVector2u#

class mitsuba.ScalarVector3d#

class mitsuba.ScalarVector3f#

class mitsuba.ScalarVector3i#

class mitsuba.ScalarVector3u#

class mitsuba.ScalarVector4d#

class mitsuba.ScalarVector4f#

class