Page 1 of 1

SCRIPT: override octane materials in viewport 2.0

Posted: Fri Mar 04, 2016 1:23 pm
by calus
OctaneHardwareShader.jpg
Most of the time, octane materials display in viewport 2.0 is not usefull for nice playblast (specially in directx mode it only show a grey color).

You can override octane material with maya shaders in viewport 2.0 using my script:
OctaneHardwareShader.zip
open this script in your script editor and press enter
(529 Bytes) Downloaded 563 times

Code: Select all

//this script adds a "hardware Shader" attribute in the "Extra Attributes" section for every octane material in your scene.
//you can then connect manually to this attribute whatever maya shader you want to see in viewport 2.0 instead of the octane material.

string $mats[] = `ls -typ octaneDiffuseMaterial -typ octaneGlossyMaterial -typ octaneMixMaterial -typ octanePortalMaterial -typ octaneSpecularMaterial`;
for ($mat in $mats) {
    if (1-`attributeExists hardwareShader $mat`) {
        addAttr -ln hardwareShader -usedAsColor -h 0 -attributeType float3 $mat;
        addAttr -ln colorR -attributeType "float" -parent hardwareShader $mat;
        addAttr -ln colorG -attributeType "float" -parent  hardwareShader $mat;
        addAttr -ln colorB -attributeType "float" -parent  hardwareShader $mat;
        print  $mat;
    }
}

Re: TIP: overide octane materials in the viewport 2.0

Posted: Fri Mar 04, 2016 4:06 pm
by Jolbertoquini
Excellent ^^ Thank you very much

Re: TIP: override octane materials in the viewport 2.0

Posted: Thu Mar 10, 2016 12:50 pm
by zurakan
hi calus
it not work for me
which version octane
i use OctaneRender® for Maya® 2.24.2 - 7.22 Win [TEST]

Re: TIP: override octane materials in the viewport 2.0

Posted: Thu Mar 10, 2016 12:55 pm
by calus
I use 7.22 as-well, maybe it's more a Maya version related issue, I use maya 2016 sp5.
I'll test it on maya 2014, but what exactly is your issue ?

Re: TIP: override octane materials in the viewport 2.0

Posted: Thu Mar 10, 2016 1:29 pm
by calus
Well, I tested in Maya 2014, the script work nicely, but maybe you don't use it as expected.
Usage:
- make sure you use viewport 2.0
- create some octane materials for some objects in your scene
- load the script in the mel section of your script editor
- execute the script (ENTER key of the numpad)
- now every Octane material should have a new "hardware shader" attribute in their "extra attribute" section in the attribute editor
- Clic on the little checker of the "hardware shader" attribute of any of your Octane material, it will open the create node window
- chose for example a Maya Blinn material and make it red
- now what you should see in your viewport 2.0 is the red Blinn shader instead of the octane material. The red blinn material only override the Octane material in viewport 2.0, not in other viewport and not at render time obviously
- if you create a new Octane Material, execute the script again (if you use the script regularly just drag and drop it from the script editor to a Maya shelf to make a button)

Re: TIP: override octane materials in the viewport 2.0

Posted: Thu Mar 10, 2016 2:15 pm
by zurakan
Thank so much
it work now
last time i use Texture not Shader not work

Use Shader it fine

Re: TIP: override octane materials in the viewport 2.0

Posted: Thu Mar 10, 2016 2:28 pm
by calus
Nice it works for you now :D
Also every material type will work to override the Octane material including for example glsl shader, directx shader, stingray pbr shader, to make insane playblast.

Re: SCRIPT: override octane materials in viewport 2.0

Posted: Wed Dec 21, 2016 1:39 am
by effectzero
God bless you Calus!