Page 1 of 1

Incorrect 'Convert Materials' Results

Posted: Sat Sep 26, 2020 7:23 pm
by blastframe
A. Operating System, including version (i.e. Win 7, OSX 10.11.2, Ubuntu 14.04, etc.)
Windows 10.0.19041

B. Graphics Card(s) model (i.e. GTX 580 - 3GB, TITAN, etc.)
TITAN Black

C. RAM Capacity (i.e. 6 GB)
64GB

D. Nvidia driver version (i.e. 7.50, 7.5.22)
456.38

E. OctaneRender Standalone version, if installed (i.e. 2.24.2, 2.23, etc.)
2020.1.5

F. OctaneRender plugin version (i.e. v2.25 - 2.21)
2020.1.5-R2

G. Host application version, including build number if available (i.e. 3ds Max 2016 Build 18.0)
Cinema 4D R23.008

H. A detailed description of the issue and steps to reproduce it (Include Screenshots or video capture), as well as an example scene if applicable.

1. Convert Materials produces incorrect values for Specular color:
In a PBR Material with one Reflectance layer, the Layer Color is white. When using Octane's Convert Materials command, the Specular Color is incorrect:
Cinema 4D PBR Specular Color
Cinema 4D PBR Specular Color
Octane Convert Materials Result: Specular
Octane Convert Materials Result: Specular
2. Metallic PBR Materials do not use Metallic Octane Materials or BRDF Model
Also, though the PBR Reflectance Attenuation is set to 'Metal', the Convert Materials result does not use 'Metallic' or 'Universal' as the Material type nor the correct BRDF model, so metals do not get converted properly.
Cinema 4D PBR Metal
Cinema 4D PBR Metal
Octane Convert Materials Result: Metal
Octane Convert Materials Result: Metal
Here is a scene file with 10 PBR materials that were converted incorrectly with Octane's Convert Materials (this is using the Robot rig from Cinema 4D's Content Browser Presets):
https://drive.google.com/drive/folders/ ... sp=sharing

Re: Incorrect 'Convert Materials' Results

Posted: Sat Sep 26, 2020 10:06 pm
by aoktar
Everything is not supported with converter. It's pretty old. And there's not matching concept to make proper conversions between these.

Re: Incorrect 'Convert Materials' Results

Posted: Sat Sep 26, 2020 11:10 pm
by blastframe
aoktar wrote:Everything is not supported with converter. It's pretty old. And there's not matching concept to make proper conversions between these.
Okay. Can you please either remove this broken feature or make the result a better approximation? As Maxon improves its Viewport, it makes using PBR for early visualization of a project before Octane a good option. A more helpful conversion would save a lot of time.

This is a super crude script, but assuming the user is using the Default PBR setup (one Diffuse layer and one Reflection layer in the Reflectance channel), it would set the Specular color correctly and the BRDF Model. I know it's not exact and there could be a lot of variations, but adjusting one Reflectance layer would be closer than the current command.

Code: Select all

import c4d

def createOctMaterial(pbrMat,metallic=False):
    if not metallic:
        c4d.CallCommand(1033893) # Octane Glossy Material
    else:
        c4d.CallCommand(1041569) # Octane Universal Material
        
    octMat = doc.GetFirstMaterial()
    doc.AddUndo(c4d.UNDOTYPE_NEW,octMat)
    doc.AddUndo(c4d.UNDOTYPE_CHANGE,octMat)
    octMat[c4d.ID_BASELIST_NAME] = pbrMat.GetName()
    return octMat

def getPBRSpecularLayer(mat):
    cntLayer = mat.GetReflectionLayerCount()
    for i in range(0, cntLayer):
        layer = mat.GetReflectionLayerIndex(i)
        if mat.GetName() == "Default Reflection":
            return layer.GetDataID()
        else:
            layer = mat.GetReflectionLayerIndex(0)
    return layer.GetDataID()

def main(doc):
    pbrMat = doc.GetActiveMaterial()
    if pbrMat != None:
        doc[c4d.DOCUMENT_COLORPROFILE] = 0
        reflectionLayerID = getPBRSpecularLayer(pbrMat)

        if pbrMat[reflectionLayerID + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] == c4d.REFLECTION_DISTRIBUTION_BECKMANN:
            octMat = createOctMaterial(pbrMat,True)
            octMat[c4d.OCT_MATERIAL_SPECULAR_COLOR] = pbrMat[reflectionLayerID + c4d.REFLECTION_LAYER_COLOR_COLOR]
            octMat[c4d.OCT_MATERIAL_TYPE] = c4d.OCT_MAT_UNIVERSAL
            octMat[c4d.OCT_MAT_BRDF_MODEL] = c4d.OCT_MAT_BRDF_BECKMANN
        elif pbrMat[reflectionLayerID + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] == c4d.REFLECTION_DISTRIBUTION_GGX:
            octMat = createOctMaterial(pbrMat,True)
            octMat[c4d.OCT_MATERIAL_SPECULAR_COLOR] = pbrMat[reflectionLayerID + c4d.REFLECTION_LAYER_COLOR_COLOR]
            octMat[c4d.OCT_MATERIAL_TYPE] = c4d.OCT_MAT_UNIVERSAL
            octMat[c4d.OCT_MAT_BRDF_MODEL] = c4d.OCT_MAT_BRDF_GGX

    c4d.EventAdd()

if __name__=='__main__':
    main(doc)