SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Maya Technical Issues / shader switch

Maya Technical Issues Post all your interface and configuration related problems with Maya software here.

Join the conversation. Reply to post
 
Thread Tools
08-10-2012, 07:57 AM   #1
digitalone
Registered User
 
Join Date: May 2012
Posts: 31
shader switch
Hello every,

is it possible to switch a shading material already connected to selected faces without having to re select the faces all over again? If anyone knows how this is done i would greatly appreciate.
  Reply with quote
08-10-2012, 08:35 AM   #2
PixalZA
Lifetime Member
 
PixalZA's Avatar
 
Join Date: May 2011
Location: Riyadh, Saudi Arabia
Posts: 525
In Hypershade right click on the material that you already assigned and select "Select Objects with Material".
__________________
Earth: The crazy asylum of the universe.
  Reply with quote
08-10-2012, 08:42 AM   #3
Gen
Super Moderator
 
Gen's Avatar
 
Join Date: Dec 2006
Location: South FL
Posts: 3,514
Or if you don't have hypershade open, you can select the shader and use this bit of code :

Code:
hyperShade -o "";
It'll select whatever objects that are using the selected shader. You can drop that onto a shelf.
__________________
- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
  Reply with quote
08-10-2012, 08:51 AM   #4
PixalZA
Lifetime Member
 
PixalZA's Avatar
 
Join Date: May 2011
Location: Riyadh, Saudi Arabia
Posts: 525
Cool. Didn't know about that one. Thanks
__________________
Earth: The crazy asylum of the universe.
  Reply with quote
08-10-2012, 12:04 PM   #5
digitalone
Registered User
 
Join Date: May 2012
Posts: 31
Guys im talking about FACES. How do i change the shaders connected to those FACES without reselecting it.
  Reply with quote
08-10-2012, 12:35 PM   #6
Gen
Super Moderator
 
Gen's Avatar
 
Join Date: Dec 2006
Location: South FL
Posts: 3,514
I'm confused, what are you asking exactly? Switching one shader out for another, or editing the attributes of different shaders that are applied to different faces on the same object?
__________________
- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
  Reply with quote
08-10-2012, 12:45 PM   #7
honestdom
The Nurb Herd
 
honestdom's Avatar
 
Join Date: Oct 2007
Location: London
Posts: 2,381
Quote:
In Hypershade right click on the material that you already assigned and select "Select Objects with Material".
then right click the new shader "assign to selected objects"
  Reply with quote
09-10-2012, 07:20 AM   #8
digitalone
Registered User
 
Join Date: May 2012
Posts: 31
Guys this is quiet simple. If you have a cube primitive and you decided to apply a shader to one of its faces, how would you change that shader without reselecting it.
  Reply with quote
09-10-2012, 08:02 AM   #9
honestdom
The Nurb Herd
 
honestdom's Avatar
 
Join Date: Oct 2007
Location: London
Posts: 2,381
The answer is also quite simple. But there is a lot of jargon that comes with maya. If you don't understand, show a bit of humility and say "I don't get it". Dont put it back on us like we dont understand. Did you even attempt what was suggested? Probably not.
  Reply with quote
09-10-2012, 08:27 AM   #10
digitalone
Registered User
 
Join Date: May 2012
Posts: 31
Ofcourse not because i already know how to do what was suggested and that is not what im talking about. Is this really hard to understand.

Every polygon object is made up of faces, edges and vertices. So let say my object is made up of 40 faces and i decided to select 10 faces and applied a phong shader to it, how do i change that phong shader without reselecting those faces again.

Thank you
  Reply with quote
09-10-2012, 09:10 AM   #11
honestdom
The Nurb Herd
 
honestdom's Avatar
 
Join Date: Oct 2007
Location: London
Posts: 2,381
ahhhh well that changes nothing then.

Quote:
Originally Posted by PixalZA View Post

In Hypershade right click on the material that you already assigned and select "Select Objects with Material".

then right click the new shader "assign to selected objects"
  Reply with quote
09-10-2012, 10:24 AM   #12
digitalone
Registered User
 
Join Date: May 2012
Posts: 31
Ahhh dame, my apologies thank guys, much appreciated
  Reply with quote
26-09-2019, 10:01 AM   #13
Hasi
Registered User
 
Join Date: Sep 2019
Posts: 1
SOLUTION
Quote:
is it possible to switch a shading material already connected to selected faces without having to re select the faces all over again? If anyone knows how this is done i would greatly appreciate.
The MEL script is quite easy (maybe it can be done in a more efficient way, but this works):
Select the materials you want to replace, select the target material last and run the script.

With the optimize scene command in the file menu you can afterwards remove all unused shading nodes.

//Copy from here to....
undoInfo -ock;
$target = `ls -selection -tail 1`;
select -tgl $target;
$selection = `ls -sl`;
for ($material in $selection) {
hyperShade -objects $material;
hyperShade -assign $target;
}
undoInfo -cck;
//...Here

If you don't know how to run MEL Script in Maya then watch a video on YouTube.
  Reply with quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop surface shader become shaded? Bubblegummonster Maya Materials & Textures 1 11-12-2013 06:51 PM
Batch render issue Fantilir Lighting & Rendering 3 01-10-2013 02:05 AM
Tricky double sided shader problem robchis Lighting & Rendering 1 13-12-2006 09:44 PM
stop auto making a shader for Convert to File texture junkyBob Lighting & Rendering 0 25-02-2005 02:31 PM
Duplicating model with switch utilities in the shader network? kbrown Maya Materials & Textures 2 04-07-2004 01:20 PM