Octane Material Type Converter

Forums: Octane Material Type Converter
3D Studio Max Plugin (Export Script Plugins developed by [gk] and KilaD; Integrated Plugin developed by Karba)
Forum rules
Please post only in English in this subforum. For alternate language discussion please go here viewforum.php?f=18

Octane Material Type Converter

Postby neonZorglub » Thu Feb 23, 2023 2:07 am

neonZorglub Thu Feb 23, 2023 2:07 am
Octane Material Type Converter
(from version 13.16)

A new set of features allow to change the type of an existing Octane material (for example from 'Diffuse material' to 'Universal material').
This is still in development. see the current limitations bellow.

The conversion options are available on the 'Convert...' button in each material dialog.
This is also available in the context menu of the 'Convert Current Slot Material' button, in Tools / Material Converter of the render settings dialog.
MtlTypeConvert_menu1.png

MtlTypeConvert_menu2.png


The conversion creates a new material, and copy the compatible parameters from the old material to the new one.
Some parameters will be lost if they are not available in the new material.
The scene object using the previous material will have their material assigned to the new converted material.


Here is a sample scene to try those features:
MtlTypeConvert01.zip
(185.86 KiB) Downloaded 61 times


-Open MtlTypeConvert01.max
-Open the Material Editor in Compact mode
-Select the first material :01 - Default (a Diffuse material)
-Left Click on 'Convert..." button, select 'Convert to Universal Material'
01 - Default is now a Universal material, with parameters set from the previous Diffuse material.
The teapot material has been changed to the new material.
Converted_to_Universal.jpg


Limitations:
Animations of material parameters are not converted. The converted parameter will be set with values of the current frame.
Layered material and material layers are not yet supported.
The Undo / Redo is only partially working. After a Undo, you may have to re-assign the previous material to the objects.
(you might prefer to save before convert and reload your scene..)

Compact editor
The new converted material will be re-assigned to the current Sample Slot.

Slate Editor
When converting a material, make sure it is assigned to a scene object, or set in a Sample Slot.
The new converted material will be re-assigned to the scene object and/or re-set in the Sample Slot.

The previous material still exist and will still be selected, so in order to edit / view the new material, you will need to 'get' it from the object or a Sample Slot.
neonZorglub
OctaneRender Team
OctaneRender Team
 
Posts: 899
Joined: Sun Jul 31, 2016 10:08 pm

Octane Material Type Converter - Additional uses:

Postby neonZorglub » Thu Feb 23, 2023 2:11 am

neonZorglub Thu Feb 23, 2023 2:11 am
Octane Material Type Converter - Additional uses:

The Octane material type conversion is based on an internal copy and paste of material parameters.
Those copy and paste operation allow additional functionalities.


Those copy/paste options are available :
-For Octane materials, in the Context menu of the 'Convert...' button (Right click, instead of Left click)
-In the context menu of the 'Convert Current Slot Material' button, in Tools / Material Converter of the render settings dialog.
-In the context menu of the 'Convert All Slot Materials' button, for operations on all the Sample Slots (Compact mode)

Copy-Paste_menu1.png

Copy-Paste_menu2.png

Copy-Paste_menu3.png


* Changing type of Octane textures:

For example, to convert a RGB image texture to a Grayscale image:
-Select the RGB image in a slot if the Material Editor (Compact mode).
-In the 'Convert Current Slot Material' context menu, choose 'Copy-Paste.../Copy properties'
-In a new slot, create a Grayscale image
-In the 'Convert Current Slot Material' context menu, choose 'Copy-Paste.../Paste properties'

* Copy one or all slots from a 3dsMax instance to another.
When working with multiple instances of 3dsMax (any supported version, from 2013 to 2023), you can copy materials from one instance to another:

For example, open 3dsMax 2022 and 3dsmax 2023, each with 2 different scenes.
To copy 1 material, any plugin:
-In Max2022, open the Material editor (Compact mode), and select a material.
-In Render Settings, Tools / 'Convert Current Slot Material' context menu, choose 'Copy-Paste.../Deep Copy properties (clipboard)'
-In Max2023, open the Material editor, and select a slot to receive the material
-In Render Settings, Tools / 'Convert Current Slot Material' context menu, choose 'Copy-Paste.../Paste properties (clipboard)'

To copy 1 material, when both instances slots are Octane materials:
-In Max2022, open the Material editor (Compact mode), and select a material.
-In the "Convert.." context menu, choose 'Copy-Paste.../Deep Copy properties (clipboard)'
-In Max2023, open the Material editor, and select a slot to receive the material
-In the "Convert.." context menu, choose 'Copy-Paste.../Paste properties (clipboard)'


To copy all slots:
-In Max2022, open the Material editor (Compact mode)
-In Render Settings, Tools / 'Convert All Slot Materials' context menu, choose 'Deep Copy ALL slots (clipboard)'
-In Max2023, open the Material editor (Compact mode)
-In Render Settings, Tools / 'Convert All Slot Materials' context menu, choose 'Paste (Overwrite) ALL Slots (clipboard)'



* Copy non octane materials
The copy / paste operations should works for most materials available in 3dsMax.



--- Copy and Paste operations ---
'Copy properties': Copy properties of current selected slot material or texture.
When using a Paste operation, the sub materials and textures will be references.

'Deep copy properties': Copy properties of current material, and all it's sub materials and textures.
When using a Paste operation, the sub materials and textures will be duplicates.

'Paste properties' : copy all properties of currently copied material to selected slot.
Overwrite current material properties with the properties previousely copied.
If 'Deep copy' was used, the sub materials and textures will be duplicates.

'Paste (overwrite) properties: Discard material in current slot
This re-create a new material in the current slot.


The '(clipboard)' operations stores the properties to Windows's clipboard.
This allows to copy materials between 3dsmax instances, as well as copy / paste to a text editor for extented uses.


* Viewport activation of converted / new texture
The conversion and paste operations will try to activate / re-activate texmaps that have the 'Show Shaded material in viewport' enabled.
In some cases, there may be conflicts between the source and destination texmap settings.
You can change the activation method in Preferences / Material / ViewPort Texmap re-activation mode.



* Actions and MaxScript
The copy / paste operations are availables as Octane's 'Actions' in the 3dsMax Customize menu, to let you add custom menus and buttons.

Maxscript support:
You can use showinterface OctaneMaxFPI to list available functions:

<integer>OCMCopyMaterialProp <material>material <integer>storageType <boolean>deepCopy
<integer>OCMPasteMaterialProp <material>material <integer>storageType
<material>OCMPasteOverwriteMaterialProp <integer>storageType
<integer>OCMCopyTexmapProp <texturemap>texmap
<integer>OCMPasteTexmapProp <texturemap>texmap <integer>storageType
<texturemap>OCMPasteOverwriteTexmapProp <integer>storageType
<string>OCMGetMtlPropStorage <integer>storageType
<integer>OCMSetMtlPropStorage <integer>storageType <string>propsText
<integer>OCMChangeMaterialType <material>material <string>className
<integer>OCMChangeTexmapType <texturemap>texmap <string>className

For example, loading the previous sample (MtlTypeConvert01.max)

-open Maxscript Listener window

Convert the teapot material to Glossy material:
OctaneMaxFPI.OCMChangeMaterialType $Teapot001.material "Glossy material"
or
OctaneMaxFPI.OCMChangeMaterialType meditMaterials[1] "Glossy material"


Copy teapot material settings to the sphere's material:
OctaneMaxFPI.OCMCopyMaterialProp $Teapot001.material 0 false
OctaneMaxFPI.OCMPasteMaterialProp $GeoSphere001.material 0

Convert the teapot material diffuse texture from RGB image to Grayscale image
OctaneMaxFPI.OCMChangeTexmapType $Teapot001.material.diffuse_tex "Grayscale image"


The valid values for storageType are:
0: internal copy/paste
1: Windlows clipboard
neonZorglub
OctaneRender Team
OctaneRender Team
 
Posts: 899
Joined: Sun Jul 31, 2016 10:08 pm

Return to Autodesk 3Ds Max


Who is online

Users browsing this forum: Google [Bot] and 25 guests

Sun Apr 28, 2024 4:02 pm [ UTC ]