Creating MXS files
The Maxwell Render SDK provides methods to translate any 3D description and convert it to the MXS format that can be rendered by Maxwell. Typically a plug-in that should provide a UI with all the parameters that Maxwell Render needs for rendering.
It is strongly recommended to take a look at Maxwell Studio (the standalone scene composer provided with Maxwell Render) or any existent plug-ins to see how these parameters are integrated in an application.
The first step is to create an instance of the Cmaxwell class, an entity which encapsulates the Maxwell data and functionality. The constructor of Cmaxwell requires the definition of a callback function that receives and processes errors, warnings, and info messages during the MXS generation.
Cmaxwell* pMaxwell = new Cmaxwell( callback ); byte error_callback( byte isError, // 0 = warning; 1 = error const char *pmethod, // failing method const char *string, // error string const void *data); // not used in plug-ins
Most of the functions in the SDK also return a status byte. Return 0 means FAILURE; otherwise the call has been successful. It is a good idea to check the value that the functions return. If this is 0, add a breakpoint in the callback and it will show useful info to know what the problem is.
The following function defines the data conversion model between a 3D application and Maxwell’s internal representation. In fact, this type represents the axis orientation of the host system.
byte setInputDataType( const char* pInput );
Types available:
Types are separated in three groups. Every group has the same axis orientation system. If your 3D application is not listed here, just choose one that matches the same axis orientation. The string means: first is the up vector, then the second and third vectors found in the inner 90º angle quarter, going clockwise.
“YXZ” : Lightwave, Cinema4D, etc
“ZXY” : 3dsMAX, Maya, FormZ, etc
“YZX” : XSI, Maya, SolidWorks, Houdini, Rhino
The different steps involved in defining a scene are as follows:
a) environment (sky)
b) cameras
c) materials
d) geometry
f) rendering parameters
g) extra parameters
h) export MXS
order of execution of these steps is arbitrary; the only requisite is that materials are created before geometry.
Default units in Maxwell Render are: meters, seconds, radians. All the vertex, UVs, etc. should be in meters. All the indexes which reference objects in a list (bitmaps, cameras, etc) are 0-based