Home Technical Talk

Maya Set-Up Question

polycounter lvl 9
Offline / Send Message
CandyStripes05 polycounter lvl 9
Is there anyway to apply one material to the object in one view-port and a different material in a different view-port? or have x-ray mode only effect specific meshes?

what I'm trying to do:

In persp mode I want the mesh to have a normal lambert so I can see the model easily for modelling, but in my side view-port I want to either be able to have a different lambert on it which I have the transparency set really low in order to see the reference image behind it OR I could use x-ray mode but then the reference image gets harder to read

any tips?

till then I guess I'm stuck flipping back and forth between my two materials : (

Replies

  • huffer
    Options
    Offline / Send Message
    huffer interpolator
    You can instance your object, move it out of the way, apply a lambert and model on this, while keeping the other instance transparent and aligned over reference.
  • DireWolf
    Options
    Offline / Send Message
    Why don't you do it the other way around - place your reference in front of your model and lower the reference opacity?
  • tharle
    Options
    Offline / Send Message
    tharle polycounter lvl 9
    you could also keyframe the transparency to be high and low and then you just have to change the current time to swap between the settings you want - probably easier than reapplying materials etc.
  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    If it helps, in Maya you can x-ray per object, instead of the default x-ray the whole scene or not. So by setting that to a keyboard shortcut (I use ctrl-alt-x, alt-x being the whole scene) you could x-ray your mesh whenever you want, on the fly, while keeping your ref plane opaque.
    Here's the dirty mel I've been using to toggle it on and off per object for the last 7 years :
    // declare variables
    string $selected[];
    string $hilited[];
    string $object;
    int $test[];
    int $hold;
    // assign values to variables for selected objects
    $selected = `ls -sl -dag -ap -typ surfaceShape`;
    $hilited = `ls -hl -dag -ap -typ surfaceShape`;
    // loop through any objects in component mode
    // and toggle their x-ray display
    for ($object in $hilited){
    $test = `displaySurface -q -xRay $object`;
    $hold = $test[0];
    if ($hold != false)
    displaySurface -xRay false $object;
    else
    displaySurface -xRay true $object;
    // clear test variable
    clear $test;
    }
    // loop through any objects in object mode
    // and toggle their x-ray display
    for ($object in $selected){
    $test = `displaySurface -q -xRay $object`;
    $hold = $test[0];
    if ($hold != false)
    displaySurface -xRay false $object;
    else
    displaySurface -xRay true $object;
    // clear test variable
    clear $test;
    }
    // clear selection variables
    clear $selected;
    clear $hilited;
    
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    here is a cleaner xray toggle.
    import pymel.core as pm
    
    
    def xraytoggle():
        sel = pm.ls(sl=True, dag=True, ap=True, typ='surfaceShape')
        hilighted = pm.ls(hl=True, dag=True, ap=True, typ='surfaceShape')
    
        for i in hilighted:
            value = pm.displaySurface(i, q=True, xRay=True)
            if value[0]:
                pm.displaySurface(i, xRay=False)
            else:
                pm.displaySurface(i, xRay=True)
    
        for i in sel:
            value = pm.displaySurface(i, q=True, xRay=True)
            if value[0]:
                pm.displaySurface(i, xRay=False)
            else:
                pm.displaySurface(i, xRay=True)
    
    
    xraytoggle()
    
  • Bal
    Options
    Offline / Send Message
    Bal polycounter lvl 17
    Thanks passerby, I never bothered tweaking old mel that works, but it's always nicer to have it in Python. :)
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    ya its more or less the same code, just in python, since for some reason the displaySurface commands aren't implemented as pymel object methods.
  • CandyStripes05
    Options
    Offline / Send Message
    CandyStripes05 polycounter lvl 9
    DireWolf wrote: »
    Why don't you do it the other way around - place your reference in front of your model and lower the reference opacity?

    Depending on the reference it can start to look muddy really quick and end up being useless

    thanks for all the replies! I'll have to look into those scripts : ) much appreciated!
Sign In or Register to comment.