CmaxwellMxi
Class to manage Maxwell Image files (MXIs).
Enumerations
Methods
Name | Description |
---|---|
CmaxwellMxi | Class constructor. |
~CmaxwellMxi | Class destructor. |
setMxi | Initializes the CmaxwellMxi object from a Cmxi (Maxwell Core). |
getVersion | Gets MXI version supported by the SDK. |
getFileVersion | Gets MXI version of the file. |
getScenePath | Gets MXS file used to render the MXI. |
setScenePath | Sets MXS file used to render the MXI. |
getPreview | Gets the scene preview image. |
setPreview | Sets the scene preview image. |
isResumable | Checks whether the MXI is resumable. |
getSamplingLevel | Gets current MXI sampling level. |
getRenderTimeInSeconds | Gets current render time in seconds. |
xRes | Image width. |
yRes | Image height. |
filmWidth | Camera film width. |
filmHeight | Camera film height. |
getIso | Gets ISO. |
setIso | Sets ISO. |
getShutter | Gets shutter. |
setShutter | Sets shutter. |
getFstop | Gets f-Stop. |
setFstop | Sets f-Stop. |
getExposure | Gets exposute. |
setExposure | Sets exposure. |
getBurn | Gets burn. |
setBurn | Sets burn. |
getMonitorGamma | Gets monitor gamma. |
setMonitorGamma | Sets monitor gamma. |
getSharpness | Gets image sharpness. |
setSharpness | Sets image sharpness. |
isSharpnessEnabled | Gets sharpness state. |
setSharpnessEnabled | Sets sharpness state. |
setColorSpace | Sets color space. |
getColorSpace | Gets color space. |
Simulens | |
isDevignettingEnabled | Gets devignetting state. |
setDevignettingEnabled | Sets devignetting state. |
getDevignetting | Gets devignetting value. |
setDevignetting | Sets devignetting value. |
isDiffractionEnabled | Gets diffraction state. |
setDiffractionEnabled | Sets diffraction state. |
getDiffractionIntensity | Gets diffraction intensity. |
setDiffractionIntensity | Sets diffraction intensity. |
getDiffractionFrequency | Gets diffraction frequency. |
setDiffractionFrequency | Sets diffraction frequency. |
getApertureMap | Gets aperture map file name. |
setApertureMap | Sets aperture map file name. |
getObstacleMap | Gets aperture map file name. |
setObstacleMap | Sets aperture map file name. |
isScatteringEnabled | Gets scattering state. |
setScatteringEnabled | Sets scattering state. |
getScattering | Gets scattering value. |
setScattering | Sets scattering value. |
Camera info (camera used to render the MXI) | |
getCameraName | Gets the name of the camera used to generate the MXI. |
getCameraCoordinates | Gets camera coordinates (position, target and up vectors). |
getCameraFocalLength | Gets camera focal lenght. |
getCameraFStop | Gets camera f-Stop. |
getCameraShutter | Gets camera shutter. |
getCameraIso | Gets camera ISO. |
getCameraDiaphragm | Gets camera diaphragm parameters. |
getCameraFps | Gets camera FPS. |
Multilight | |
getMultilightType | Gets multilight type. 0 = No multilight, 1 = Intensity and 2 = Color + Intensity. |
getLightsCount | Gets number of lights contained in the MXI. |
getLightBuffersCount | Gets number of light buffers contained in the MXI (including environment). |
getLightsNames | Gets all light names. |
getLightName | Gets light name by index. |
getLightIndex | Get light index by name. |
getLightType | Gets light type (LightType). |
getLightIntensity | Gets light intensity by index. |
setLightIntensity | Sets light intensity by index. |
getLightColor | Gets light color. |
setLightColor | Sets light color. |
getLightTemperatureColor | Gets light temperature color. |
setLightTemperatureColor | Sets light temperature color. |
getConstantSkyLuminance | Gets constant sky luminance in cd/m2. |
setConstantSkyLuminance | Sets constant sky luminance in cd/m2. |
getPhysicalSkyLuminance | Gets physical sky luminance (sun power factor). |
setPhysicalSkyLuminance | Sets physical sky luminance (sun power factor). |
getSunPowerFactor | Gets sun power factor when there is constant sky plus sun. |
setSunPowerFactor | Sets sun power factor when there is constant sky plus sun. |
getEnvironmentWeight | Gets environment weight factor. |
setEnvironmentWeight | Sets environment weight factor. |
loadEmixer | Loads an emixer file and applies its settings to the MXI. |
saveEmixer | Save the multilight settings to an emixer file. |
exportMultilightSettingsToScene | Imports the current MXI settings back into the MXS scene. |
File I/O | |
read | Reads a MXI from disk. |
write | Write a MXI to disk. |
getFileSize | Gets file size in bytes even it has not been saved yet. |
readImage | Reads an image file (PNG, EXR, TIF...). |
extractChannels | Extracts all the channels embedded in the MXI to other image format. |
Buffers handling | |
getLightBuffer | Gets a light RGB buffer by index. |
getRenderBuffer | Gets the render buffer. |
getExtraBuffer | Gets an extra buffer by name ("ALPHA", "Z", "MOTION", "ID_MATERIAL", "ID_OBJECT", "ROUGHNESS", "FRESNEL", "NORMALS" or "POSITION"). |
getExtraBuffer | Gets an extra buffer by ID. See RENDER_CHANNELS. |
getShadowBuffers | Gets all shadow buffers. |
getShadowBuffer | Gets a shadow buffer by light index. |
getNumberOfShadowBuffers | Gets the number of shadow buffers available. |
getExtraBuffersEnabledMask | Gets the extra buffers mask. Useful to find out what extra buffers are available in the MXI. |
createImages | Creates images in the MXI. |
setBufferRGB | Fills the selected image buffer with the given RGB buffer. |
Preview and update | |
updateDisplay | Updates the render image buffer and all the render channels. |
updatePreview | Updates the preview buffer. |
updateLightInPreview | Updates the given light in the preview buffer. |
updateAllLightsInPreview | Updates all the lights in the preview buffer. |
getPreviewResolution | Given a render resolution, returns the preview resolution. |
getRenderPreviewBuffer | Returns the preview render buffer used for interactive purposes. |
MXI merging | |
isMerged | Checks whether the MXI was created merging various MXIs. |
getUsedIdCpusCount | Gets the number of MXI used to generate this MXI. |
getUsedIdCpus | Gets the CPU ids (seeds) used to generate the merged MXIs. |
mergeMxis | Mergies the MXI files into a new one. |
Static methods
Name | Description |
---|---|
getEmixerVersion | Gets the emixer version file used in this version of the SDK. |
LightType
Value | C++ | Python |
---|---|---|
0 | CmaxwellMxi::TYPE_COLOR_AND_LUMINANCE | CmaxwellMxi.TYPE_COLOR_AND_LUMINANCE |
1 | CmaxwellMxi::TYPE_TEMPERATURE | CmaxwellMxi.TYPE_TEMPERATURE |
2 | CmaxwellMxi::TYPE_MXI | CmaxwellMxi.TYPE_MXI |
3 | CmaxwellMxi::TYPE_MULTIPLE_EMITTERS | CmaxwellMxi.TYPE_MULTIPLE_EMITTERS |
4 | CmaxwellMxi::TYPE_IES | CmaxwellMxi.TYPE_IES |
5 | CmaxwellMxi::TYPE_SKY_CONSTANT | CmaxwellMxi.TYPE_SKY_CONSTANT |
6 | CmaxwellMxi::TYPE_SKY_PHYSICAL | CmaxwellMxi.TYPE_SKY_PHYSICAL |
7 | CmaxwellMxi::TYPE_CONSTANT_SUN | CmaxwellMxi.TYPE_CONSTANT_SUN |
8 | CmaxwellMxi::TYPE_IBL_ENVIRONMENT | CmaxwellMxi.TYPE_IBL_ENVIRONMENT |
setMxi
Initializes the CmaxwellMxi object from a Cmxi (Maxwell Core).
Language | Syntax |
---|---|
C++ | void setMxi( Cmxi* pMxi ) |
Python | Not available. |
getVersion
Gets MXI version supported by the SDK.
Language | Syntax |
---|---|
C++ | float getVersion() |
Python | float getVersion() |
getFileVersion
Gets MXI version of the file.
Language | Syntax |
---|---|
C++ | Cerror getFileVersion( const char* i_fileName, float& o_fileVersion ) |
Python | float getFileVersion( const char* i_fileName ) |
Return value
C++
Cerror::failed() = true: error getting file version.
Cerror::failed() = false: success.
Python
MXI file version.
getScenePath
Returns the path to the MXS file used to render this MXI if it exists.
Language | Syntax |
---|---|
C++ | const char* getScenePath() |
Python | str getScenePath() |
setScenePath
Sets the path to the MXS file used to render this MXI.
Language | Syntax |
---|---|
C++ | void setScenePath( const char* path ) |
Python | getScenePath( str path ) |
getPreview
Gets the scene preview image. Used to store a thumbnail inside the mxi file. The returned preview is deleted in CmaxwellMxi::~CmaxwellMxi, so the user does not have to delete it. If it does, the CmaxwellMxi destructur will crash.
Language | Syntax |
---|---|
C++ | Crgb8* getPreview( dword& xRes, dword& yRes ) |
Python | array getPreview() |
Return value
C++
Crgb8 array of size = (xRes * yRes) containing the RGB preview image.
Python
NumPy ubyte array containing the RGB preview image. Shape is (xRes,yXres,3).
setPreview
Sets the scene preview image.
Language | Syntax |
---|---|
C++ | void setPreview( const dword& xResPreview, const dword& yResPreview, Crgb8* previewRGB ) |
Python | bool setPreview( array previewRGB ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const dword& | xResPreview | in | (C++ only) Preview width. |
const dword& | yResPreview | in | (C++ only) Preview height. |
Crgb8* | previewRGB | in | (C++ only) Preview image data. xResPreview*yResPreview array of Crgb8 data. |
array | previewRGB | in | (Python only) Preview image data. NumPy ubyte array with shape = (xResPreview,yResPreview,3) |
Return value
Python
false = Error setting preview image.
true = Success.
isResumable
Check whether the MXI is resumable.
Language | Syntax |
---|---|
C++ | bool isResumable() |
Python | bool isResumable() |
getSamplingLevel
Gets current MXI sampling level.
Language | Syntax |
---|---|
C++ | real getSamplingLevel() |
Python | float getSamplingLevel() |
getRenderTimeInSeconds
Returns the total render time (including any resume render) in seconds. If the MXI was not generated through a render process but converting an image the method returns 0.
Language | Syntax |
---|---|
C++ | real getRenderTimeInSeconds() |
Python | float getRenderTimeInSeconds() |
xRes
Image width.
Language | Syntax |
---|---|
C++ | real xRes() |
Python | float xRes() |
yRes
Image height.
Language | Syntax |
---|---|
C++ | real yRes() |
Python | float yRes() |
filmWidth
Camera film width (mm).
Language | Syntax |
---|---|
C++ | real filmWidth() |
Python | float filmWidth() |
filmHeight
Camera film height (mm).
Language | Syntax |
---|---|
C++ | real filmHeight() |
Python | float filmHeight() |
getIso
Gets ISO.
Language | Syntax |
---|---|
C++ | real getIso() |
Python | float getIso() |
setIso
Sets ISO.
Language | Syntax |
---|---|
C++ | real setIso( real iso ) |
Python | float setIso( float iso ) |
getShutter
Gets shutter.
Language | Syntax |
---|---|
C++ | real getShutter() |
Python | float getShutter() |
setShutter
Sets shutter.
Language | Syntax |
---|---|
C++ | real setShutter( real shutter ) |
Python | float setIso( float shutter ) |
getFstop
Gets f-stop.
Language | Syntax |
---|---|
C++ | real getFstop() |
Python | float getFstop() |
setFstop
Sets f-stop.
Language | Syntax |
---|---|
C++ | real setFstop( real fstop ) |
Python | float setFstop( float fstop ) |
getExposure
Gets exposure.
Language | Syntax |
---|---|
C++ | real getExposure() |
Python | float getExposure() |
setExposure
Sets exposure.
Language | Syntax |
---|---|
C++ | real setExposure( real exposure ) |
Python | float setExposure( float exposure ) |
getBurn
Gets burn.
Language | Syntax |
---|---|
C++ | real getBurn() |
Python | float getBurn() |
setBurn
Sets burn.
Language | Syntax |
---|---|
C++ | real setBurn( real burn ) |
Python | float setBurn( float burn ) |
getMonitorGamma
Gets monitor gamma.
Language | Syntax |
---|---|
C++ | real getMonitorGamma() |
Python | float getMonitorGamma() |
setMonitorGamma
Sets monitor gamma.
Language | Syntax |
---|---|
C++ | real setMonitorGamma( real monitorGamma ) |
Python | float setMonitorGamma( float monitorGamma ) |
getSharpness
Gets sharpness.
Language | Syntax |
---|---|
C++ | real getSharpness() |
Python | float getSharpness() |
setSharpness
Sets sharpness.
Language | Syntax |
---|---|
C++ | real setSharpness( real mxiSharpness ) |
Python | float setSharpness( float mxiSharpness ) |
isSharpnessEnabled
Gets sharpness state.
Language | Syntax |
---|---|
C++ | bool isSharpnessEnabled() |
Python | bool isSharpnessEnabled() |
setSharpnessEnabled
Sets sharpness state.
Language | Syntax |
---|---|
C++ | real setSharpnessEnabled( real mxiSharpness ) |
Python | float setSharpnessEnabled( float mxiSharpness ) |
setColorSpace
Sets the color space for the MXI. Input parameter must be one of the COLOR_SPACES defined at sourcesenums.h.
Language | Syntax |
---|---|
C++ | byte setColorSpace( dword type ) |
Python | int setColorSpace( int type ) |
Return value
0 = Error setting color space.
1 = Success.
getColorSpace
Gets the color space of the MXI. It returns one of the COLOR_SPACES defined at sourcesenums.h.
Language | Syntax |
---|---|
C++ | void getColorSpace( dword& type ) |
Python | int getColorSpace() |
Return value
Python
Color space.
Examples
mxi = CmaxwellMxi(); if not mxi.read('c:/scenes/render.mxi').failed(): colorspace = mxi.getColorSpace(); if colorspace == COLOR_SPACE_SRGB: print("SRGB");
isDevignettingEnabled
Gets devignetting state.
Language | Syntax |
---|---|
C++ | bool isDevignettingEnabled() |
Python | bool isDevignettingEnabled() |
setDevignettingEnabled
Sets devignetting state.
Language | Syntax |
---|---|
C++ | void setDevignettingEnabled( bool enabled ) |
Python | setDevignettingEnabled( bool enabled ) |
getDevignetting
Gets devignetting value.
Language | Syntax |
---|---|
C++ | real getDevignetting() |
Python | float getDevignetting() |
setDevignetting
Sets devignetting value.
Language | Syntax |
---|---|
C++ | void setDevignetting( real devignetting ) |
Python | setDevignetting( float devignetting ) |
isDiffractionEnabled
Gets diffraction state.
Language | Syntax |
---|---|
C++ | bool isDiffractionEnabled() |
Python | bool isDiffractionEnabled() |
setDiffractionEnabled
Sets diffraction state.
Language | Syntax |
---|---|
C++ | void setDiffractionEnabled( bool enabled ) |
Python | setDiffractionEnabled( bool enabled ) |
getDiffractionIntensity
Gets diffraction intensity value.
Language | Syntax |
---|---|
C++ | real getDiffractionIntensity() |
Python | float getDiffractionIntensity() |
setDiffractionIntensity
Sets diffraction intensity value.
Language | Syntax |
---|---|
C++ | void setDiffractionIntensity( real intensity ) |
Python | setDiffractionIntensity( float intensity ) |
getDiffractionFrequency
Gets diffraction frequency value.
Language | Syntax |
---|---|
C++ | real getDiffractionFrequency() |
Python | float getDiffractionFrequency() |
setDiffractionFrequency
Sets diffraction frequency value.
Language | Syntax |
---|---|
C++ | void setDiffractionFrequency( real frequency ) |
Python | setDiffractionFrequency( float frequency ) |
getApertureMap
Gets diffraction aperture map file name.
Language | Syntax |
---|---|
C++ | const char* getApertureMap() |
Python | str getApertureMap() |
setApertureMap
Sets diffraction aperture map file name.
Language | Syntax |
---|---|
C++ | void setApertureMap( const char* path ) |
Python | setApertureMap( str path ) |
getObstacleMap
Gets diffraction obstacle map file name.
Language | Syntax |
---|---|
C++ | const char* getObstacleMap() |
Python | str getObstacleMap() |
setObstacleMap
Sets diffraction obstacle map file name.
Language | Syntax |
---|---|
C++ | void setObstacleMap( const char* path ) |
Python | setObstacleMap( str path ) |
isScatteringEnabled
Gets scattering state.
Language | Syntax |
---|---|
C++ | bool isScatteringEnabled() |
Python | bool isScatteringEnabled() |
setScatteringEnabled
Sets scattering state.
Language | Syntax |
---|---|
C++ | void setScatteringEnabled( bool enabled ) |
Python | setScatteringEnabled( bool enabled ) |
getScattering
Gets scattering value.
Language | Syntax |
---|---|
C++ | real getScattering() |
Python | float getScattering() |
setScattering
Sets scattering value.
Language | Syntax |
---|---|
C++ | void setScattering( real scattering ) |
Python | setScattering( float scattering ) |
getCameraName
Gets the name of the camera used to generate the MXI.
Language | Syntax |
---|---|
C++ | const char* getCameraName() |
Python | str getCameraName() |
getCameraCoordinates
Gets camera coordinates (position, target and up vectors).
Language | Syntax |
---|---|
C++ | bool getCameraCoordinates( dword iStep, Cpoint& position, Cpoint & target, Cpoint & up ) |
Python | (Cvector position, Cvector target, Cvector up) getCameraCoordinates( dword iStep ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
dword | iStep | in | Sub-frame index (motion blur). 0 if no motion blur. |
Cpoint | position | out | (C++ only) Camera position. |
Cpoint | target | out | (C++ only) Camera target coordinates. |
Cpoint | up | out | (C++ only) Camera up vector. |
Return value
C++
false = Error getting camera coordinates (i.e., bad iStep parameter).
true = Success.
Python
Tuple containing the three output vectors.
getCameraFocalLenght
Gets camera focal lenght.
Language | Syntax |
---|---|
C++ | bool getCameraFocalLength( dword iStep, real& focalLength ) |
Python | float getCameraFocalLength( dword iStep ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
dword | iStep | in | Sub-frame index (motion blur). 0 if no motion blur. |
real& | focalLenght | out | Camera focal lenght. |
Return value
C++
false = Error getting camera focal length (i.e., bad iStep parameter).
true = Success.
Python
Camera focal length.
getCameraFStop
Gets camera focal lenght.
Language | Syntax |
---|---|
C++ | bool getCameraFStop( dword iStep, real& fStop ) |
Python | float getCameraFStop( dword iStep ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
dword | iStep | in | Sub-frame index (motion blur). 0 if no motion blur. |
real& | focalLenght | out | Camera f-stop. |
Return value
C++
false = Error getting camera f-stop (i.e., bad iStep parameter).
true = Success.
Python
Camera f-stop.
getCameraShutter
Gets camera shutter.
Language | Syntax |
---|---|
C++ | real getCameraShutter() |
Python | float getCameraShutter() |
getCameraIso
Gets camera ISO.
Language | Syntax |
---|---|
C++ | real getCameraISO() |
Python | float getCameraISO() |
getCameraDiaphragm
Gets camera diaphragm parameters.
Language | Syntax |
---|---|
C++ | void getCameraDiaphragm( const char** pDiaphragmType, real& angle, dword& nBlades ) |
Python | (str type, float angle, int nBlades) getCameraDiaphragm() |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const char** | pDiaphragmType | out | Diaphragm type ("CIRCULAR" or "POLIGONAL") |
real& | angle | out | Diaphragm angle ("POLYGONAL" diaphragms). |
dword& | nBlades | out | Number of blades of the diaphragm ("POLYGONAL" diaphragms). |
Return value
Python
Tuple containing the camera diaphragm parameters.
getCameraFps
Gets camera FPS.
Language | Syntax |
---|---|
C++ | dword getCameraFps() |
Python | int getCameraFps() |
getMultilightType
Returns the multilight type of the MXI.
- 0: No multilight
- 1: Intensity
- 2: Color + Intensity
Language | Syntax |
---|---|
C++ | byte getMultilightType() |
Python | int getMultilightType() |
getLightsCount
Returns the number of lights contained in the MXI. Environment is not considered.
Language | Syntax |
---|---|
C++ | dword getLightsCount() |
Python | int getLightsCount() |
getLightBuffersCount
Returns the number of lights buffers contained in the MXI, including environment data (Sun, physical sky, etc.).
Language | Syntax |
---|---|
C++ | dword getLightBuffersCount() |
Python | int getLightBuffersCount() |
getLightsNames
Gets all light names.
Language | Syntax |
---|---|
C++ | bool getLightsNames( char**& lightNamesList ) |
Python | str[] getLightsNames() |
Return value
C++
false = Error getting lights names.
true = Success.
Python
String list with the names. Empty string if error.
getLightName
Returns the name of the light with the given index. If the index is invalid an empty string is returned.
Language | Syntax |
---|---|
C++ | const char* getLightName( const dword& lightIndex ) |
Python | str getLightName() |
getLightIndex
Returns the index of the light with the given name. Returns -1 if there are no lights with this name.
Language | Syntax |
---|---|
C++ | dword getLightIndex( const char* lightName ) |
Python | int getLightIndex( str lightName ) |
getLightType
Returns the type of the light with the given index.
Language | Syntax |
---|---|
C++ | LightType getLightType( const dword& lightIndex ) |
Python | LightType getLightType() |
getLightIntensity
Returns the intensity of the light with the given index. Depending on the type the returned intensity means different things:
- If type is TYPE_COLOR_AND_LUMINANCE the intensity is the absolute emission value in the units used (watts, lumens, etc).
- If type is TYPE_TEMPERATURE the intensity is in kelvin.
- If type is anything else the returned intensity is a multiplier that affects the original emission value.
- If the index is invalid getLightIntensity returns -1.
Language | Syntax |
---|---|
C++ | real getLightIntensity( const dword& lightIndex ) |
Python | float getLightIntensity( int lightIndex ) |
setLightIntensity
Sets the intensity of the light with the given index.
Language | Syntax |
---|---|
C++ | byte setLightIntensity( const dword& lightIndex, const real& intensity ) |
Python | int setLightIntensity( int lightIndex, int intensity ) |
Return value
0 = Invalid light index.
1 = Otherwise.
getLightColor
Returns the Crgb color of the light with the given index. This call makes sense only when LightType is TYPE_COLOR_AND_LUMINANCE and color type is set to rgb color. Otherwise getLightColor returns a white color.
Language | Syntax |
---|---|
C++ | Crgb getLightColor( const dword& lightIndex ) |
Python | Crgb getLightColor( int lightIndex ) |
setLightColor
Sets the Crgb color of the light with the given index. This call makes sense only when LightType is TYPE_COLOR_AND_LUMINANCE and color type is set to rgb color. Otherwise returns 0.
Language | Syntax |
---|---|
C++ | byte setLightColor( const dword& lightIndex, const Crgb& color ) |
Python | int setLightColor( int lightIndex, Crgb color ) |
Return value
0 = Error.
1 = Success.
getLightTemperatureColor
Returns the temperature color in kelvins of the light with the given index. This call makes sense only when LightType is TYPE_COLOR_AND_LUMINANCE and color type is set to temperature color, otherwise -1.0 is returned.
Language | Syntax |
---|---|
C++ | real getLightTemperatureColor( const dword& lightIndex ) |
Python | float getLightTemperatureColor( int lightIndex ) |
setLightColor
Sets the temperature color in kelvins of the light with the given index. This call makes sense only when LightType is TYPE_COLOR_AND_LUMINANCE and color type is set to temperature color, otherwise 0 is returned.
Language | Syntax |
---|---|
C++ | byte setLightTemperatureColor( const dword& lightIndex, const real& temperature ) |
Python | int setLightTemperatureColor( int lightIndex, float temperature ) |
Return value
0 = Error.
1 = Success.
getConstantSkyLuminance
Returns the constant sky luminance (in cd/m2).
Language | Syntax |
---|---|
C++ | byte getConstantSkyLuminance( real& value ) |
Python | float getConstantSkyLuminance() |
Return value
C++
0 = There is no sky or it is not constant.
1 = Success.
Python
-1 = There is no sky or it is not constant.
Otherwise, constant sky luminance value.
setConstantSkyLuminance
Sets the constant sky luminance value.
Language | Syntax |
---|---|
C++ | byte setConstantSkyLuminance( const real& value ) |
Python | int setConstantSkyLuminance( float value ) |
Return value
0 = Error setting constant sky luminance value.
1 = Success.
getPhysicalSkyLuminance
Gets the physical sky luminance which is represented by the sun power factor in the scene.
Language | Syntax |
---|---|
C++ | byte getPhysicalSkyLuminance( real& value ) |
Python | float getPhysicalSkyLuminance() |
Return value
C++
0 = There is no sky or it is not physical.
1 = Success.
Python
-1 = There is no sky or it is not physical.
Otherwise, physical sky luminance value.
setPhysicalSkyLuminance
Sets the physical sky luminance value.
Language | Syntax |
---|---|
C++ | byte setPhysicalSkyLuminance( const real& value ) |
Python | int setPhysicalSkyLuminance( float value ) |
Return value
0 = Error setting physical sky luminance value.
1 = Success.
getSunPowerFactor
Gets the sun power factor used when there is constant sky plus sun.
Language | Syntax |
---|---|
C++ | byte getSunPowerFactor( real& value ) |
Python | float getSunPowerFactor() |
Return value
C++
0 = There is no sun in the scene.
1 = Success.
Python
-1 = There is no sun in the scene.
Otherwise, sun power factor.
setSunPowerFactor
Sets the sun power factor used when there is constant sky plus sun.
Language | Syntax |
---|---|
C++ | byte setSunPowerFactor( const real& value ) |
Python | int setSunPowerFactor( float value ) |
Return value
0 = Error setting sun power factor.
1 = Success.
getEnvironmentWeight
Gets the environment weight factor.
Language | Syntax |
---|---|
C++ | byte getEnvironmentWeight( real& value ) |
Python | float getEnvironmentWeight() |
Return value
C++
0 = There is no environment in the scene.
1 = Success.
Python
-1 = There is no environment in the scene.
Otherwise, environment weight.
setEnvironmentWeight
Sets the environment weight.
Language | Syntax |
---|---|
C++ | byte setEnvironmentWeight( const real& value ) |
Python | int setEnvironmentWeight( float value ) |
Return value
0 = Error setting environment weight.
1 = Success.
loadEmixer
Reads the given emixer file and applies its settings to the MXI.
Language | Syntax |
---|---|
C++ | bool loadEmixer( const char* fileName, const dword& frame = 0 ) |
Python | bool loadEmixer( str fileName, int frame = 0 ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const char* | fileName | in | .emixer file name. |
const dword& | frame | in | Frame of the emixer file (if there is more than one). Default value: 0. |
Return value
false = Error loading emixer data.
true = Success.
saveEmixer
Saves the current MXI settings into an emixer file.
Language | Syntax |
---|---|
C++ | bool saveEmixer( const char* fileName ) |
Python | bool saveEmixer( str fileName ) |
Return value
false = Error saving emixer file.
true = Success.
exportMultilightSettingsToScene
Imports the current MXI settings back into the MXS scene. This method assumes pMaxwell is valid and contains a valid scene.
Language | Syntax |
---|---|
C++ | bool exportMultilightSettingsToScene( Cmaxwell* pMaxwell ) |
Python | bool exportMultilightSettingsToScene( Cmaxwell pMaxwell ) |
Return value
false = Error saving emixer file.
true = Success.
read
Reads a MXI file from disk.
Language | Syntax |
---|---|
C++ | Cerror read( const char* fileName, bool readHeaderOnly = false, dword selectedChannels = FLAG_ALPHA | FLAG_ID_OBJECT | FLAG_ID_MATERIAL | FLAG_SHADOW_PASS | FLAG_MOTION | FLAG_ROUGHNESS | FLAG_Z | FLAG_FRESNEL | FLAG_NORMALS | FLAG_POSITION ) |
Python | Cerror read( str fileName, bool readHeaderOnly = False, int selectedChannels = FLAG_ALPHA | FLAG_ID_OBJECT | FLAG_ID_MATERIAL | FLAG_SHADOW_PASS | FLAG_MOTION | FLAG_ROUGHNESS | FLAG_Z | FLAG_FRESNEL | FLAG_NORMALS | FLAG_POSITION ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const char* | fileName | in | MXI file name. |
bool | readHeaderOnly | in | If true, reads only the MXI header. Default = false. |
dword | selectedChannels | in | Bitwise mask that indicates what channels will be readed (readHeaderOnly = false). Default = all channels readed. See RENDER_CHANNELS from maxwellenums.h |
Return value
Cerror::failed() = true: error reading MXI.
Cerror::failed() = false: success.
Examples
CmaxwellMxi* mxi = new CmaxwellMxi(); Cerror err = mxi->read("c:\\scenes\\myrender.mxi"); if( !err.failed() ) { // MXI readed successfully. }
mxi = CmaxwellMxi(); err = mxi.read('c:/scenes/myrender.mxi'); if not err.failed(): print("MXI readed successfully");
write
Writes an MXI file to disk.
Return value
Cerror::failed() = true: error writting MXI.
Cerror::failed() = false: success.
getFileSize
Returns the number of bytes that this MXI will have, even if it has not been saved yet. It takes into account the buffers, channels and multilight options enabled.
Language | Syntax |
---|---|
C++ | qword getFileSize( void ) |
Python | long getFileSize( void ) |
readImage
Reads an image file and fills the Cmxi buffer with it.
Language | Syntax |
---|---|
C++ | bool readImage( const char* fileName ) |
Python | bool readImage( str fileName ) |
Return value
false = Error reading image.
true = Success.
extractChannels
Extracts all the channels embeded in the MXI to disk.
Language | Syntax |
---|---|
C++ | bool extractChannels( const char* fileName, const char* destinationFolder, const char* extension, const byte& depth ) |
Python | bool extractChannels( str fileName, str destinationFolder, str extension, int depth ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const char* | fileName | in | File name (not full path) of the destination files |
const char* | destinationFolder | in | Folder where the channels will be saved. |
const char* | extension | in | File extension of the saved channels. |
const byte& | depth | in | Channels bitDepth. |
Return value
false = Error saving channels.
true = Success.
getLightBuffer
Returns a light buffer by index.
Language | Syntax |
---|---|
C++ | bool getLightBuffer( dword i_iLight, byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, char*& o_lightName, bool rebuildAndExtract ) |
Python | array getLightBuffer( int index, int bitDepth ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
dword | i_iLight | in | Light index. |
byte | i_bitDepth | in | Bit depth requested (8, 16 or 32). |
void*& | o_pRGB | out | (C++ only) Light buffer data. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ). |
dword& | o_xRes | out | (C++ only) Buffer width (in pixels). |
dword& | o_yRes | out | (C++ only) Buffer height (in pixels). |
char*& | o_lightName | out | (C++ only) Light name. |
bool | rebuildAndExtract | in | (C++ only) If true, rebuilds the buffer and gives the responsibility of freeing it to the programmer. |
Return value
C++
true = Buffer readed successfully.
false = Error getting light buffer.
Python
NumPy array containing the RGB image. Array dimensions: (height, width, 3).
Examples
void* buffer = NULL; dword width, height; char* name = new char[512]; if( mxi->getLightBuffer( 0, 32, buffer, width, height, name, false ) ) { float* data = (float*) buffer; Crgb* rgb = (Crgb*) buffer; dword pixels = width * height; dword values = width * height * 3; for( dword i = 0; i < pixels; i++ ) { // Use the buffer. Crgb p = rgb[i]; printf( "red: %f\n", p.r ); printf( "green: %f\n", p.g ); printf( "blue: %f\n", p.b ); } for( dword i = 0; i < values; i++ ) { // Use the buffer. float v = data[i]; printf( "value: %f\n", v ); } }
from numpy import * image = mxi.getLightBuffer( 0, 32 ): for i in range(0,image.size): print(image.flat[i]);
getRenderBuffer
Returns the render buffer.
Language | Syntax |
---|---|
C++ | bool getRenderBuffer( byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, bool rebuildAndExtract ) |
Python | array getRenderBuffer( int bitDepth ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
byte | i_bitDepth | in | Bit depth requested (8, 16 or 32). |
void*& | o_pRGB | out | (C++ only) Render buffer data. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ). |
dword& | o_xRes | out | (C++ only) Buffer width (in pixels). |
dword& | o_yRes | out | (C++ only) Buffer height (in pixels). |
bool | rebuildAndExtract | in | (C++ only) If true, rebuilds the buffer and gives the responsibility of freeing it to the programmer. |
Return value
C++
true = Buffer readed successfully.
false = Error getting render buffer.
Python
NumPy array containing the RGB image. Array dimensions: (height, width, 3). The type depends on the bit-depth requested: 8 (ubyte), 16 (ushort) or 32 (float).
getExtraBuffer
Returns an extra buffer by name.
Language | Syntax |
---|---|
C++ | bool getExtraBuffer( const char* i_bufferName, byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, byte& o_nChannels ) |
Python | array getExtraBuffer( str name, int bitDepth ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const char* | i_bufferName | in | Buffer name ("ALPHA", "Z", "MOTION", "ID_MATERIAL", "ID_OBJECT", "ROUGHNESS", "FRESNEL", "NORMALS" or "POSITION"). |
byte | i_bitDepth | in | Bit depth requested (8, 16 or 32). |
void*& | o_pRGB | out | (C++ only) Extra buffer data. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ). The programmer is responsible of freeing that data. |
dword& | o_xRes | out | (C++ only) Buffer width (in pixels). |
dword& | o_yRes | out | (C++ only) Buffer height (in pixels). |
byte& | o_nChannels | out | (C++ only) Number of channels. Motion buffer has 4 channels. The rest have 3 channels. |
Return value
C++
true = Buffer readed successfully.
false = Error getting extra buffer.
Python
NumPy array containing the RGB image. Array dimensions: (height, width, 3 or 4).
getExtraBuffer
Returns an extra buffer by ID.
Language | Syntax |
---|---|
C++ | bool getExtraBuffer( dword i_bufferID, byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, byte& o_nChannels ) |
Python | array getExtraBuffer( str name, int bitDepth ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const char* | i_bufferName | in | Buffer ID. See RENDER_CHANNELS (maxwellenums.h). |
byte | i_bitDepth | in | Bit depth requested (8, 16 or 32). |
void*& | o_pRGB | out | (C++ only) Extra buffer data. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ). The programmer is responsible of freeing that data. |
dword& | o_xRes | out | (C++ only) Buffer width (in pixels). |
dword& | o_yRes | out | (C++ only) Buffer height (in pixels). |
byte& | o_nChannels | out | (C++ only) Number of channels. Motion buffer has 4 channels. The rest have 3 channels. |
Return value
C++
true = Buffer readed successfully.
false = Error getting extra buffer.
Python
NumPy array containing the RGB image. Array dimensions: (height, width, 3 or 4).
getShadowBuffers
Returns an array with all shadow buffers with the given bitDepth.
Language | Syntax |
---|---|
C++ | bool getShadowBuffers( byte i_bitDepth, void** & o_pRGB, dword& o_nBuffers, dword& o_xRes, dword& o_yRes ) |
Python | array[] getShadowBuffers( int bitDepth ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
byte | i_bitDepth | in | Bit depth requested (8, 16 or 32). |
void**& | o_pRGB | out | (C++ only) Sadow buffers array. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ). The programmer is responsible of freeing that data. |
dword& | o_nBuffers | out | (C++ only) Number of shadow buffers returned. |
dword& | o_xRes | out | (C++ only) Buffer width (in pixels). |
dword& | o_yRes | out | (C++ only) Buffer height (in pixels). |
Return value
C++
true = Buffers readed successfully.
false = Error getting shadow buffers.
Python
List containing all shadow buffers as NumPy arrays. Array dimensions: (height, width, 3).
getShadowBuffer
Returns a shadow buffer by index.
Language | Syntax |
---|---|
C++ | bool getShadowBuffer( dword i_iLight, byte i_bitDepth, void** & o_pRGB, dword& o_xRes, dword& o_yRes, bool build = false ) |
Python | array getShadowBuffer( int i_iLight, int bitDepth ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
dword | i_iLight | in | Shadow index (it is the same as its correspondent light). |
byte | i_bitDepth | in | Bit depth requested (8, 16 or 32). |
void**& | o_pRGB | out | (C++ only) Sadow buffers array. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ). The programmer is responsible of freeing that data. |
dword& | o_xRes | out | (C++ only) Buffer width (in pixels). |
dword& | o_yRes | out | (C++ only) Buffer height (in pixels). |
bool | build | in | (C++ only) Force build all the shadow buffers. Default: false. |
Return value
C++
true = Shadow buffer readed successfully.
false = Error getting shadow buffer.
Python
NumPy array containing the RGB image. Array dimensions: (height, width, 3).
getNumberOfShadowBuffers
Returns the number of shadow buffers available.
- 0: No shadow buffer.
- 1: Shadow buffer available (1 emitter or no multilight).
- N: As many shadow buffers as light emitters.
Language | Syntax |
---|---|
C++ | dword getNumberOfShadowBuffers ( void ) |
Python | long getNumberOfShadowBuffers ( void ) |
getExtraBuffersEnabledMask
Returns a bitwise mask with the extra buffers rendered. See RENDER_CHANNELS (maxwellenums.h). Useful to check what extra channels are available in the MXI.
Language | Syntax |
---|---|
C++ | word getExtraBuffersEnabledMask( void ) |
Python | int getExtraBuffersEnabledMask( void ) |
Examples
mxi = CmaxwellMxi(); mxi.read('sample.mxi'); mask = mxi.getExtraBuffersEnabledMask(); haveZ = mask & FLAG_Z; if haveZ: print('Z channel is present');"
createImages
Create N buffers of the given resolution.
Language | Syntax |
---|---|
C++ | void createImages( dword nImages, dword xRes, dword yRes ) |
Python | createImages( dword nImages, dword xRes, dword yRes ) |
setBufferRGB
Fills the selected image buffer with the given floating RGB buffer. This function recalculates the image buffer taking into account all the parameters as Iso, Shutter, etc.. so it assumes all of them are initialized to the proper values.
Language | Syntax |
---|---|
C++ | void setBufferRGB( const float* pRgb, dword iImage ) |
Python | setBufferRGB( const float* pRgb, dword iImage ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const float* | pRgb | in | RGB Image buffer. |
dword | iImage | in | Light index of the buffer to overwrite. |
updateDisplay
Updates the render image buffer and all the render channels.
Language | Syntax |
---|---|
C++ | void updateDisplay() |
Python | updateDisplay() |
updatePreview
Updates the preview buffer.
Language | Syntax |
---|---|
C++ | void updatePreview() |
Python | updatePreview() |
updateLightInPreview
Updates the given light in the preview buffer.
Language | Syntax |
---|---|
C++ | void updateLightInPreview( dword lightIndex ) |
Python | updateLightInPreview( int lightIndex ) |
updateAllLightsInPreview
Updates all the lights in the preview buffer.
Language | Syntax |
---|---|
C++ | void updatePreview() |
Python | updatePreview() |
getPreviewResolution
Given a render resolution (xRes & yRes) returns the preview resolution.
Language | Syntax |
---|---|
C++ | void getPreviewResolution( dword xRes, dword yRes, dword& xResPreview, dword& yResPreview ) |
Python | tuple updateLightInPreview( dword xRes, dword yRes ) |
Return value
Python
Tuple containing preview resolution (xResPreview,yResPreview).
getRenderPreviewBuffer
Returns the preview render buffer used for interactive purposes. The size of the buffer can be asked using getPreviewResolution.
Language | Syntax |
---|---|
C++ | Crgb8* getRenderPreviewBuffer() |
Python | array getRenderPreviewBuffer() |
Return value
C++
Crgb8 array containing the preview render image.
Python
NumPy array containing the preview render image. Shape is (width,height,3).
isMerged
Returns true if the MXI file is the result of a merge process and false if not.
Language | Syntax |
---|---|
C++ | bool isMerged() |
Python | bool isMerged() |
getUsedIdCpusCount
Returns the number of MXIs used to generate this MXI if it is the result of a merge process. Returns 0 if the MXI was not generated through a merge process.
Language | Syntax |
---|---|
C++ | dword getUsedIdCpusCount() |
Python | long getUsedIdCpusCount() |
getUsedIdCpus
Fills an array with the cpu IDs (seeds) used to generate this MXI file. In C++, the caller is responsible of allocating and freeing the array after using it.
Language | Syntax |
---|---|
C++ | byte getUsedIdCpus( dword*& idCpus ) |
Python | int[] getUsedIdCpus() |
Return value
C++
0 = Error. The MXI was not generated through a merge process.
1 = Success.
Python
0 = Error. The MXI was not generated through a merge process.
Otherwise = int list containing the cpu IDs.
mergeMxis
Merges all the MXI files given in the sources array that contains all the paths to the mxis to merge.
Language | Syntax |
---|---|
C++ | byte mergeMxis( const char* targetMxi, char** sources, const dword nSources ) |
Python | byte mergeMxis( str targetMxi, str[] sources ) |
Return value
0 = Error merging the MXIs.
1 = Success.
getEmixerVersion
Returns the emixer version file used in this version of the SDK.
Language | Syntax |
---|---|
C++ | float getEmixerVersion() |
Python | float getEmixerVersion() |