CmaxwellMxi

Class to manage Maxwell Image files (MXIs).

Enumerations

LightType.

Methods

NameDescription
CmaxwellMxiClass constructor.
~CmaxwellMxiClass destructor.
setMxiInitializes the CmaxwellMxi object from a Cmxi (Maxwell Core).
getVersionGets MXI version supported by the SDK.
getFileVersionGets MXI version of the file.
getScenePathGets MXS file used to render the MXI.
setScenePathSets MXS file used to render the MXI.
getPreviewGets the scene preview image.
setPreviewSets the scene preview image.
isResumableChecks whether the MXI is resumable.
getSamplingLevelGets current MXI sampling level.
getRenderTimeInSecondsGets current render time in seconds.
xResImage width.
yResImage height.
filmWidthCamera film width.
filmHeightCamera film height.
getIsoGets ISO.
setIsoSets ISO.
getShutterGets shutter.
setShutterSets shutter.
getFstopGets f-Stop.
setFstopSets f-Stop.
getExposureGets exposute.
setExposureSets exposure.
getBurnGets burn.
setBurnSets burn.
getMonitorGammaGets monitor gamma.
setMonitorGammaSets monitor gamma.
getSharpnessGets image sharpness.
setSharpnessSets image sharpness.
isSharpnessEnabledGets sharpness state.
setSharpnessEnabledSets sharpness state.
setColorSpaceSets color space.
getColorSpaceGets color space.
Simulens
isDevignettingEnabledGets devignetting state.
setDevignettingEnabledSets devignetting state.
getDevignettingGets devignetting value.
setDevignettingSets devignetting value.
isDiffractionEnabledGets diffraction state.
setDiffractionEnabledSets diffraction state.
getDiffractionIntensityGets diffraction intensity.
setDiffractionIntensitySets diffraction intensity.
getDiffractionFrequencyGets diffraction frequency.
setDiffractionFrequencySets diffraction frequency.
getApertureMapGets aperture map file name.
setApertureMapSets aperture map file name.
getObstacleMapGets aperture map file name.
setObstacleMapSets aperture map file name.
isScatteringEnabledGets scattering state.
setScatteringEnabledSets scattering state.
getScatteringGets scattering value.
setScatteringSets scattering value.
Camera info (camera used to render the MXI)
getCameraNameGets the name of the camera used to generate the MXI.
getCameraCoordinatesGets camera coordinates (position, target and up vectors).
getCameraFocalLengthGets camera focal lenght.
getCameraFStopGets camera f-Stop.
getCameraShutterGets camera shutter.
getCameraIsoGets camera ISO.
getCameraDiaphragmGets camera diaphragm parameters.
getCameraFpsGets camera FPS.
Multilight
getMultilightTypeGets multilight type. 0 = No multilight, 1 = Intensity and 2 = Color + Intensity.
getLightsCountGets number of lights contained in the MXI.
getLightBuffersCountGets number of light buffers contained in the MXI (including environment).
getLightsNamesGets all light names.
getLightNameGets light name by index.
getLightIndexGet light index by name.
getLightTypeGets light type (LightType).
getLightIntensity

Gets light intensity by index. 

setLightIntensitySets light intensity by index.
getLightColorGets light color.
setLightColorSets light color.
getLightTemperatureColorGets light temperature color.
setLightTemperatureColorSets light temperature color.
getConstantSkyLuminanceGets constant sky luminance in cd/m2.
setConstantSkyLuminanceSets constant sky luminance in cd/m2.
getPhysicalSkyLuminanceGets physical sky luminance (sun power factor).
setPhysicalSkyLuminanceSets physical sky luminance (sun power factor).
getSunPowerFactorGets sun power factor when there is constant sky plus sun.
setSunPowerFactorSets sun power factor when there is constant sky plus sun.
getEnvironmentWeightGets environment weight factor.
setEnvironmentWeightSets environment weight factor.
loadEmixerLoads an emixer file and applies its settings to the MXI.
saveEmixerSave the multilight settings to an emixer file.
exportMultilightSettingsToSceneImports the current MXI settings back into the MXS scene.
File I/O
readReads a MXI from disk.
writeWrite a MXI to disk.
getFileSizeGets file size in bytes even it has not been saved yet.
readImageReads an image file (PNG, EXR, TIF...).
extractChannelsExtracts all the channels embedded in the MXI to other image format.
Buffers handling
getLightBufferGets a light RGB buffer by index.
getRenderBufferGets the render buffer.
getExtraBufferGets an extra buffer by name ("ALPHA", "Z", "MOTION", "ID_MATERIAL", "ID_OBJECT", "ROUGHNESS", "FRESNEL", "NORMALS" or "POSITION").
getExtraBufferGets an extra buffer by ID. See RENDER_CHANNELS.
getShadowBuffersGets all shadow buffers.
getShadowBufferGets a shadow buffer by light index.
getNumberOfShadowBuffersGets the number of shadow buffers available.
getExtraBuffersEnabledMaskGets the extra buffers mask. Useful to find out what extra buffers are available in the MXI.
createImagesCreates images in the MXI.
setBufferRGBFills the selected image buffer with the given RGB buffer.
Preview and update
updateDisplayUpdates the render image buffer and all the render channels.
updatePreviewUpdates the preview buffer.
updateLightInPreviewUpdates the given light in the preview buffer.
updateAllLightsInPreviewUpdates all the lights in the preview buffer.
getPreviewResolutionGiven a render resolution, returns the preview resolution.
getRenderPreviewBufferReturns the preview render buffer used for interactive purposes.
MXI merging
isMergedChecks whether the MXI was created merging various MXIs.
getUsedIdCpusCountGets the number of MXI used to generate this MXI.
getUsedIdCpusGets the CPU ids (seeds) used to generate the merged MXIs.
mergeMxisMergies the MXI files into a new one.

Static methods

NameDescription
getEmixerVersionGets the emixer version file used in this version of the SDK.

LightType

 

ValueC++Python
0CmaxwellMxi::TYPE_COLOR_AND_LUMINANCECmaxwellMxi.TYPE_COLOR_AND_LUMINANCE
1CmaxwellMxi::TYPE_TEMPERATURECmaxwellMxi.TYPE_TEMPERATURE
2CmaxwellMxi::TYPE_MXICmaxwellMxi.TYPE_MXI
3CmaxwellMxi::TYPE_MULTIPLE_EMITTERSCmaxwellMxi.TYPE_MULTIPLE_EMITTERS
4CmaxwellMxi::TYPE_IESCmaxwellMxi.TYPE_IES
5CmaxwellMxi::TYPE_SKY_CONSTANTCmaxwellMxi.TYPE_SKY_CONSTANT
6CmaxwellMxi::TYPE_SKY_PHYSICALCmaxwellMxi.TYPE_SKY_PHYSICAL
7CmaxwellMxi::TYPE_CONSTANT_SUNCmaxwellMxi.TYPE_CONSTANT_SUN
8CmaxwellMxi::TYPE_IBL_ENVIRONMENTCmaxwellMxi.TYPE_IBL_ENVIRONMENT

setMxi

Initializes the CmaxwellMxi object from a Cmxi (Maxwell Core).

LanguageSyntax
C++void setMxi( Cmxi* pMxi )
PythonNot available.

getVersion

Gets MXI version supported by the SDK.

LanguageSyntax
C++float getVersion()
Pythonfloat getVersion()

getFileVersion

Gets MXI version of the file.

LanguageSyntax
C++Cerror getFileVersion( const char* i_fileName, float& o_fileVersion )
Pythonfloat 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.

LanguageSyntax
C++const char* getScenePath()
Pythonstr getScenePath()

setScenePath

Sets the path to the MXS file used to render this MXI.

LanguageSyntax
C++void setScenePath( const char* path )
PythongetScenePath( 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.

LanguageSyntax
C++Crgb8* getPreview( dword& xRes, dword& yRes )
Pythonarray 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.

LanguageSyntax
C++void setPreview( const dword& xResPreview, const dword& yResPreview, Crgb8* previewRGB )
Pythonbool setPreview( array previewRGB )

Parameters

TypeNameIn/OutDescription
const dword&xResPreviewin(C++ only) Preview width.
const dword&yResPreviewin(C++ only) Preview height.
Crgb8*previewRGBin

(C++ only) Preview image data. xResPreview*yResPreview array of Crgb8 data. 

arraypreviewRGBin(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.

LanguageSyntax
C++bool isResumable()
Pythonbool isResumable()

getSamplingLevel

Gets current MXI sampling level.

LanguageSyntax
C++real getSamplingLevel()
Pythonfloat 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.

LanguageSyntax
C++real getRenderTimeInSeconds()
Pythonfloat getRenderTimeInSeconds()

xRes

Image width.

LanguageSyntax
C++real xRes()
Pythonfloat xRes()

yRes

Image height.

LanguageSyntax
C++real yRes()
Pythonfloat yRes()

filmWidth

Camera film width (mm).

LanguageSyntax
C++real filmWidth()
Pythonfloat filmWidth()

filmHeight

Camera film height (mm).

LanguageSyntax
C++real filmHeight()
Pythonfloat filmHeight()

getIso

Gets ISO.

LanguageSyntax
C++real getIso()
Pythonfloat getIso()

setIso

Sets ISO.

LanguageSyntax
C++real setIso( real iso )
Pythonfloat setIso( float iso )

getShutter

Gets shutter.

LanguageSyntax
C++real getShutter()
Pythonfloat getShutter()

setShutter

Sets shutter.

LanguageSyntax
C++real setShutter( real shutter )
Pythonfloat setIso( float shutter )

getFstop

Gets f-stop.

LanguageSyntax
C++real getFstop()
Pythonfloat getFstop()

setFstop

Sets f-stop.

LanguageSyntax
C++real setFstop( real fstop )
Pythonfloat setFstop( float fstop )

getExposure

Gets exposure.

LanguageSyntax
C++real getExposure()
Pythonfloat getExposure()

setExposure

Sets exposure.

LanguageSyntax
C++real setExposure( real exposure )
Pythonfloat setExposure( float exposure )

getBurn

Gets burn.

LanguageSyntax
C++real getBurn()
Pythonfloat getBurn()

setBurn

Sets burn.

LanguageSyntax
C++real setBurn( real burn )
Pythonfloat setBurn( float burn )

getMonitorGamma

Gets monitor gamma.

LanguageSyntax
C++real getMonitorGamma()
Pythonfloat getMonitorGamma()

setMonitorGamma

Sets monitor gamma.

LanguageSyntax
C++real setMonitorGamma( real monitorGamma )
Pythonfloat setMonitorGamma( float monitorGamma )

getSharpness

Gets sharpness.

LanguageSyntax
C++real getSharpness()
Pythonfloat getSharpness()

setSharpness

Sets sharpness.

LanguageSyntax
C++real setSharpness( real mxiSharpness )
Pythonfloat setSharpness( float mxiSharpness )

isSharpnessEnabled

Gets sharpness state.

LanguageSyntax
C++bool isSharpnessEnabled()
Pythonbool isSharpnessEnabled()

setSharpnessEnabled

Sets sharpness state.

LanguageSyntax
C++real setSharpnessEnabled( real mxiSharpness )
Pythonfloat setSharpnessEnabled( float mxiSharpness )

setColorSpace

Sets the color space for the MXI. Input parameter must be one of the COLOR_SPACES defined at sourcesenums.h.

LanguageSyntax
C++byte setColorSpace( dword type )
Pythonint 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.

LanguageSyntax
C++void getColorSpace( dword& type )
Pythonint getColorSpace()

Return value

Python

Color space.

Examples

Python
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.

LanguageSyntax
C++bool isDevignettingEnabled()
Pythonbool isDevignettingEnabled()

setDevignettingEnabled

Sets devignetting state.

LanguageSyntax
C++void setDevignettingEnabled( bool enabled )
PythonsetDevignettingEnabled( bool enabled )

getDevignetting

Gets devignetting value.

LanguageSyntax
C++real getDevignetting()
Pythonfloat getDevignetting()

setDevignetting

Sets devignetting value.

LanguageSyntax
C++void setDevignetting( real devignetting )
PythonsetDevignetting( float devignetting )

isDiffractionEnabled

Gets diffraction state.

LanguageSyntax
C++bool isDiffractionEnabled()
Pythonbool isDiffractionEnabled()

setDiffractionEnabled

Sets diffraction state.

LanguageSyntax
C++void setDiffractionEnabled( bool enabled )
PythonsetDiffractionEnabled( bool enabled )

getDiffractionIntensity

Gets diffraction intensity value.

LanguageSyntax
C++real getDiffractionIntensity()
Pythonfloat getDiffractionIntensity()

setDiffractionIntensity

Sets diffraction intensity value.

LanguageSyntax
C++void setDiffractionIntensity( real intensity )
PythonsetDiffractionIntensity( float intensity )

getDiffractionFrequency

Gets diffraction frequency value.

LanguageSyntax
C++real getDiffractionFrequency()
Pythonfloat getDiffractionFrequency()

setDiffractionFrequency

Sets diffraction frequency value.

LanguageSyntax
C++void setDiffractionFrequency( real frequency )
PythonsetDiffractionFrequency( float frequency )

getApertureMap

Gets diffraction aperture map file name.

LanguageSyntax
C++const char* getApertureMap()
Pythonstr getApertureMap()

setApertureMap

Sets diffraction aperture map file name.

LanguageSyntax
C++void setApertureMap( const char* path )
PythonsetApertureMap( str path )

getObstacleMap

Gets diffraction obstacle map file name.

LanguageSyntax
C++const char* getObstacleMap()
Pythonstr getObstacleMap()

setObstacleMap

Sets diffraction obstacle map file name.

LanguageSyntax
C++void setObstacleMap( const char* path )
PythonsetObstacleMap( str path )

isScatteringEnabled

Gets scattering state.

LanguageSyntax
C++bool isScatteringEnabled()
Pythonbool isScatteringEnabled()

setScatteringEnabled

Sets scattering state.

LanguageSyntax
C++void setScatteringEnabled( bool enabled )
PythonsetScatteringEnabled( bool enabled )

getScattering

Gets scattering value.

LanguageSyntax
C++real getScattering()
Pythonfloat getScattering()

setScattering

Sets scattering value.

LanguageSyntax
C++void setScattering( real scattering )
PythonsetScattering( float scattering )

getCameraName

Gets the name of the camera used to generate the MXI.

LanguageSyntax
C++const char* getCameraName()
Pythonstr getCameraName()

getCameraCoordinates

Gets camera coordinates (position, target and up vectors).

LanguageSyntax
C++bool getCameraCoordinates( dword iStep, Cpoint& position, Cpoint & target, Cpoint & up )
Python(Cvector position, Cvector target, Cvector up) getCameraCoordinates( dword iStep )

Parameters

TypeNameIn/OutDescription
dwordiStepinSub-frame index (motion blur). 0 if no motion blur.
Cpointpositionout(C++ only) Camera position.
Cpointtargetout(C++ only) Camera target coordinates.
Cpointupout(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.

LanguageSyntax
C++bool getCameraFocalLength( dword iStep, real& focalLength )
Pythonfloat getCameraFocalLength( dword iStep )

Parameters

TypeNameIn/OutDescription
dwordiStepinSub-frame index (motion blur). 0 if no motion blur.
real&focalLenghtoutCamera 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.

LanguageSyntax
C++bool getCameraFStop( dword iStep, real& fStop )
Pythonfloat getCameraFStop( dword iStep )

Parameters

TypeNameIn/OutDescription
dwordiStepinSub-frame index (motion blur). 0 if no motion blur.
real&focalLenghtoutCamera 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.

LanguageSyntax
C++real getCameraShutter()
Pythonfloat getCameraShutter()

getCameraIso

Gets camera ISO.

LanguageSyntax
C++real getCameraISO()
Pythonfloat getCameraISO()

getCameraDiaphragm

Gets camera diaphragm parameters.

LanguageSyntax
C++void getCameraDiaphragm( const char** pDiaphragmType, real& angle, dword& nBlades )
Python(str type, float angle, int nBlades) getCameraDiaphragm()

Parameters

TypeNameIn/OutDescription
const char**pDiaphragmTypeoutDiaphragm type ("CIRCULAR" or "POLIGONAL")
real&angleoutDiaphragm angle ("POLYGONAL" diaphragms).
dword&nBladesoutNumber of blades of the diaphragm ("POLYGONAL" diaphragms).

Return value

Python

Tuple containing the camera diaphragm parameters.

getCameraFps

Gets camera FPS.

LanguageSyntax
C++dword getCameraFps()
Pythonint getCameraFps()

getMultilightType

Returns the multilight type of the MXI.

  • 0: No multilight
  • 1: Intensity
  • 2: Color + Intensity
LanguageSyntax
C++byte getMultilightType()
Pythonint getMultilightType()

getLightsCount

Returns the number of lights contained in the MXI. Environment is not considered.

LanguageSyntax
C++dword getLightsCount()
Pythonint getLightsCount()

getLightBuffersCount

Returns the number of lights buffers contained in the MXI, including environment data (Sun, physical sky, etc.). 

LanguageSyntax
C++dword getLightBuffersCount()
Pythonint getLightBuffersCount()

getLightsNames

Gets all light names.

LanguageSyntax
C++bool getLightsNames( char**& lightNamesList )
Pythonstr[] 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.

LanguageSyntax
C++const char* getLightName( const dword& lightIndex )
Pythonstr getLightName()

getLightIndex

Returns the index of the light with the given name. Returns -1 if there are no lights with this name.

LanguageSyntax
C++dword getLightIndex( const char* lightName )
Pythonint getLightIndex( str lightName )

getLightType

Returns the type of the light with the given index.

LanguageSyntax
C++LightType getLightType( const dword& lightIndex )
PythonLightType 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.
LanguageSyntax
C++real getLightIntensity( const dword& lightIndex )
Pythonfloat getLightIntensity( int lightIndex )

setLightIntensity

Sets the intensity of the light with the given index.

LanguageSyntax
C++byte setLightIntensity( const dword& lightIndex, const real& intensity )
Pythonint 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.

LanguageSyntax
C++Crgb getLightColor( const dword& lightIndex )
PythonCrgb 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.

LanguageSyntax
C++byte setLightColor( const dword& lightIndex, const Crgb& color )
Pythonint 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.

LanguageSyntax
C++real getLightTemperatureColor( const dword& lightIndex )
Pythonfloat 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.

LanguageSyntax
C++byte setLightTemperatureColor( const dword& lightIndex, const real& temperature )
Pythonint setLightTemperatureColor( int lightIndex, float temperature )

Return value

0 = Error.

1 = Success.

getConstantSkyLuminance

Returns the constant sky luminance (in cd/m2).

LanguageSyntax
C++byte getConstantSkyLuminance( real& value )
Pythonfloat 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.

LanguageSyntax
C++byte setConstantSkyLuminance( const real& value )
Pythonint 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.

LanguageSyntax
C++byte getPhysicalSkyLuminance( real& value )
Pythonfloat 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.

LanguageSyntax
C++byte setPhysicalSkyLuminance( const real& value )
Pythonint 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.

LanguageSyntax
C++byte getSunPowerFactor( real& value )
Pythonfloat 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.

LanguageSyntax
C++byte setSunPowerFactor( const real& value )
Pythonint setSunPowerFactor( float value )

Return value

0 = Error setting sun power factor.

1 = Success.

getEnvironmentWeight

Gets the environment weight factor.

LanguageSyntax
C++byte getEnvironmentWeight( real& value )
Pythonfloat 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.

LanguageSyntax
C++byte setEnvironmentWeight( const real& value )
Pythonint 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.

LanguageSyntax
C++bool loadEmixer( const char* fileName, const dword& frame = 0 )
Pythonbool loadEmixer( str fileName, int frame = 0 )

Parameters

TypeNameIn/OutDescription
const char*fileNamein.emixer file name.
const dword&frameinFrame 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.

LanguageSyntax
C++bool saveEmixer( const char* fileName )
Pythonbool 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.

LanguageSyntax
C++bool exportMultilightSettingsToScene( Cmaxwell* pMaxwell )
Pythonbool exportMultilightSettingsToScene( Cmaxwell pMaxwell )

Return value

false = Error saving emixer file.

true = Success.

read

Reads a MXI file from disk.

LanguageSyntax
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 )

PythonCerror  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

TypeNameIn/OutDescription
const char*fileNameinMXI file name.
boolreadHeaderOnlyinIf true, reads only the MXI header. Default = false.
dwordselectedChannelsinBitwise 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

C++
CmaxwellMxi* mxi = new CmaxwellMxi();
Cerror err = mxi->read("c:\\scenes\\myrender.mxi");
if( !err.failed() )
{
  // MXI readed successfully. 
}    
Python
mxi = CmaxwellMxi();
err = mxi.read('c:/scenes/myrender.mxi');
if not err.failed():
  print("MXI readed successfully");   

write

Writes an MXI file to disk.

LanguageSyntax
C++Cerror write( const char* fileName )
PythonCerror write( const char* fileName )

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.

LanguageSyntax
C++qword getFileSize( void )
Pythonlong getFileSize( void )

readImage

Reads an image file and fills the Cmxi buffer with it.

LanguageSyntax
C++bool readImage( const char* fileName )
Pythonbool readImage( str fileName )

Return value

false = Error reading image.

true = Success.

extractChannels

Extracts all the channels embeded in the MXI to disk.

LanguageSyntax
C++bool extractChannels( const char* fileName, const char* destinationFolder, const char* extension, const byte& depth )
Pythonbool extractChannels( str fileName, str destinationFolder, str extension, int depth )

Parameters

TypeNameIn/OutDescription
const char*fileNameinFile name (not full path) of the destination files
const char*destinationFolderinFolder where the channels will be saved.
const char*extensioninFile extension of the saved channels.
const byte&depthinChannels bitDepth.

Return value

false = Error saving channels.

true = Success.

getLightBuffer

Returns a light buffer by index.

LanguageSyntax
C++bool getLightBuffer( dword i_iLight, byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, char*& o_lightName, bool rebuildAndExtract )
Pythonarray getLightBuffer( int index, int bitDepth )

Parameters

TypeNameIn/OutDescription
dwordi_iLightinLight index.
bytei_bitDepthinBit depth requested (8, 16 or 32).
void*&o_pRGBout(C++ only) Light buffer data. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ).
dword&o_xResout(C++ only) Buffer width (in pixels).
dword&o_yResout(C++ only) Buffer height (in pixels).
char*&o_lightNameout(C++ only) Light name.
boolrebuildAndExtractin(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

C++
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 ); 
  }
      
}  
Python
from numpy import *

image = mxi.getLightBuffer( 0, 32 ):

for i in range(0,image.size):
  print(image.flat[i]); 

getRenderBuffer

Returns the render buffer.

LanguageSyntax
C++bool getRenderBuffer( byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, bool rebuildAndExtract )
Pythonarray getRenderBuffer( int bitDepth )

Parameters

TypeNameIn/OutDescription
bytei_bitDepthinBit depth requested (8, 16 or 32).
void*&o_pRGBout(C++ only) Render buffer data. i_bitDepth = 8, 16, 32 ==> o_pRGB ( uchar, uchar, uchar ), ( ushort, ushort, ushort ), ( float, float, float ).
dword&o_xResout(C++ only) Buffer width (in pixels).
dword&o_yResout(C++ only) Buffer height (in pixels).
boolrebuildAndExtractin(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.

LanguageSyntax
C++bool getExtraBuffer( const char* i_bufferName, byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, byte& o_nChannels )
Pythonarray getExtraBuffer( str name, int bitDepth )

Parameters

TypeNameIn/OutDescription
const char*i_bufferNameinBuffer name ("ALPHA", "Z", "MOTION", "ID_MATERIAL", "ID_OBJECT", "ROUGHNESS", "FRESNEL", "NORMALS" or "POSITION").
bytei_bitDepthinBit depth requested (8, 16 or 32).
void*&o_pRGBout(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_xResout(C++ only) Buffer width (in pixels).
dword&o_yResout(C++ only) Buffer height (in pixels).
byte&o_nChannelsout(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.

LanguageSyntax
C++bool getExtraBuffer( dword i_bufferID, byte i_bitDepth, void*& o_pRGB, dword& o_xRes, dword& o_yRes, byte& o_nChannels )
Pythonarray getExtraBuffer( str name, int bitDepth )

Parameters

TypeNameIn/OutDescription
const char*i_bufferNameinBuffer ID. See RENDER_CHANNELS (maxwellenums.h).
bytei_bitDepthinBit depth requested (8, 16 or 32).
void*&o_pRGBout(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_xResout(C++ only) Buffer width (in pixels).
dword&o_yResout(C++ only) Buffer height (in pixels).
byte&o_nChannelsout(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.

LanguageSyntax
C++bool getShadowBuffers( byte i_bitDepth, void** & o_pRGB, dword& o_nBuffers, dword& o_xRes, dword& o_yRes )
Pythonarray[] getShadowBuffers( int bitDepth )

Parameters

TypeNameIn/OutDescription
bytei_bitDepthinBit depth requested (8, 16 or 32).
void**&o_pRGBout(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_nBuffersout(C++ only) Number of shadow buffers returned.
dword&o_xResout(C++ only) Buffer width (in pixels).
dword&o_yResout(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.

LanguageSyntax
C++bool getShadowBuffer( dword i_iLight, byte i_bitDepth, void** & o_pRGB, dword& o_xRes, dword& o_yRes, bool build = false )
Pythonarray getShadowBuffer( int i_iLight, int bitDepth )

Parameters

TypeNameIn/OutDescription
dwordi_iLightinShadow index (it is the same as its correspondent light).
bytei_bitDepthinBit depth requested (8, 16 or 32).
void**&o_pRGBout(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_xResout(C++ only) Buffer width (in pixels).
dword&o_yResout(C++ only) Buffer height (in pixels).
boolbuildin(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.
LanguageSyntax
C++dword getNumberOfShadowBuffers ( void )
Pythonlong 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.

LanguageSyntax
C++word getExtraBuffersEnabledMask( void )
Pythonint getExtraBuffersEnabledMask( void )

Examples

Python
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.

LanguageSyntax
C++void createImages( dword nImages, dword xRes, dword yRes )
PythoncreateImages( 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.

LanguageSyntax
C++void setBufferRGB( const float* pRgb, dword iImage )
PythonsetBufferRGB( const float* pRgb, dword iImage )

Parameters

TypeNameIn/OutDescription
const float*pRgbinRGB Image buffer.
dwordiImageinLight index of the buffer to overwrite.

updateDisplay

Updates the render image buffer and all the render channels.

LanguageSyntax
C++void updateDisplay()
PythonupdateDisplay()

updatePreview

Updates the preview buffer.

LanguageSyntax
C++void updatePreview()
PythonupdatePreview()

updateLightInPreview

Updates the given light in the preview buffer.

LanguageSyntax
C++void updateLightInPreview( dword lightIndex )
PythonupdateLightInPreview( int lightIndex )

updateAllLightsInPreview

Updates all the lights in the preview buffer.

LanguageSyntax
C++void updatePreview()
PythonupdatePreview()

getPreviewResolution

Given a render resolution (xRes & yRes) returns the preview resolution.

LanguageSyntax
C++void getPreviewResolution( dword xRes, dword yRes, dword& xResPreview, dword& yResPreview )
Pythontuple 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.

LanguageSyntax
C++Crgb8* getRenderPreviewBuffer()
Pythonarray 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.

LanguageSyntax
C++bool isMerged()
Pythonbool 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.

LanguageSyntax
C++dword getUsedIdCpusCount()
Pythonlong 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.

LanguageSyntax
C++byte getUsedIdCpus( dword*& idCpus )
Pythonint[] 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.

LanguageSyntax
C++byte mergeMxis( const char* targetMxi, char** sources, const dword nSources )
Pythonbyte 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.

LanguageSyntax
C++float getEmixerVersion()
Pythonfloat getEmixerVersion()