SCRIPT: override octane materials in viewport 2.0

Forums: SCRIPT: override octane materials in viewport 2.0
Sub forum for help and tutorials.

Moderator: JimStar

SCRIPT: override octane materials in viewport 2.0

Postby calus » Fri Mar 04, 2016 1:23 pm

calus Fri Mar 04, 2016 1:23 pm
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 505 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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: TIP: overide octane materials in the viewport 2.0

Postby Jolbertoquini » Fri Mar 04, 2016 4:06 pm

Jolbertoquini Fri Mar 04, 2016 4:06 pm
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
User avatar
Jolbertoquini
Licensed Customer
Licensed Customer
 
Posts: 1067
Joined: Sun Aug 31, 2014 7:08 am
Location: London

Re: TIP: override octane materials in the viewport 2.0

Postby zurakan » Thu Mar 10, 2016 12:50 pm

zurakan Thu Mar 10, 2016 12:50 pm
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
zurakan
Licensed Customer
Licensed Customer
 
Posts: 44
Joined: Fri Sep 27, 2013 7:13 am

Re: TIP: override octane materials in the viewport 2.0

Postby calus » Thu Mar 10, 2016 12:55 pm

calus Thu Mar 10, 2016 12:55 pm
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
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: TIP: override octane materials in the viewport 2.0

Postby calus » Thu Mar 10, 2016 1:29 pm

calus Thu Mar 10, 2016 1:29 pm
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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: TIP: override octane materials in the viewport 2.0

Postby zurakan » Thu Mar 10, 2016 2:15 pm

zurakan Thu Mar 10, 2016 2:15 pm
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
zurakan
Licensed Customer
Licensed Customer
 
Posts: 44
Joined: Fri Sep 27, 2013 7:13 am

Re: TIP: override octane materials in the viewport 2.0

Postby calus » Thu Mar 10, 2016 2:28 pm

calus Thu Mar 10, 2016 2:28 pm
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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: SCRIPT: override octane materials in viewport 2.0

Postby effectzero » Wed Dec 21, 2016 1:39 am

effectzero Wed Dec 21, 2016 1:39 am
God bless you Calus!
effectzero
Licensed Customer
Licensed Customer
 
Posts: 2
Joined: Sat Jan 23, 2016 8:04 am

Return to Help / Tutorials


Who is online

Users browsing this forum: No registered users and 1 guest

Thu May 02, 2024 3:36 pm [ UTC ]