SCRIPT: override octane materials in viewport 2.0

Sub forum for help and tutorials.

Moderator: JimStar

Post Reply
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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;
    }
}
Last edited by calus on Mon Aug 15, 2016 9:03 am, edited 5 times in total.
Pascal ANDRE
User avatar
Jolbertoquini
Licensed Customer
Posts: 1067
Joined: Sun Aug 31, 2014 7:08 am
Location: London
Contact:

Excellent ^^ Thank you very much
Octane Render for Maya.
https://vimeo.com/jocg/videos
https://www.linkedin.com/in/jocgtd
http://www.hmxmedia.com/
--------------------
Join MAYA OCTANE USERS Skype discussion here :
https://join.skype.com/LXEQaqqfN15w
zurakan
Licensed Customer
Posts: 44
Joined: Fri Sep 27, 2013 7:13 am

hi calus
it not work for me
which version octane
i use OctaneRender® for Maya® 2.24.2 - 7.22 Win [TEST]
Win7 Ultimate x64 xeon Core 40 / maya2Octane 1.20a , maya 2014SP4 & Octane 1.50,
128GB Ram, 4 x GTX Titan 6GB
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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 ?
Pascal ANDRE
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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)
Pascal ANDRE
zurakan
Licensed Customer
Posts: 44
Joined: Fri Sep 27, 2013 7:13 am

Thank so much
it work now
last time i use Texture not Shader not work

Use Shader it fine
Win7 Ultimate x64 xeon Core 40 / maya2Octane 1.20a , maya 2014SP4 & Octane 1.50,
128GB Ram, 4 x GTX Titan 6GB
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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.
Pascal ANDRE
effectzero
Licensed Customer
Posts: 2
Joined: Sat Jan 23, 2016 8:04 am

God bless you Calus!
Post Reply

Return to “Help / Tutorials”