Anti-Aliasing in Viewport 2.0

This widget could not be displayed.

Anti-Aliasing in Viewport 2.0

Anonymous
Not applicable

Hello!
When I start Maya and when I switch workspaces, Multisample Anti-Aliasing in Viewport 2.0 is turned off. How to make it default? Maya 2017 Update 3, DirectX 11 engine for Viewport2.0.

0 Likes
Reply
Accepted solutions (2)
9,334 Views
9 Replies
Replies (9)

morten_bohne
Advocate
Advocate
Accepted solution
import pymel.core as pm

hwr = pm.PyNode("hardwareRenderingGlobals")
try:
    hwr.multiSampleEnable.set(1)
except:
    print("Couldn't set Anti-aliasing")
0 Likes

morten_bohne
Advocate
Advocate

there was a thread with a similar question some time ago, maybe that can help you with a way of running the code every time you open a scene: https://forums.autodesk.com/t5/maya-programming/load-python-script-on-startup/m-p/7148208/highlight/...

 

as far as i remember that solution there creates a scriptjob on SceneOpened from the usersetup.py, and in there you can throw all your settings (or even load different settings depending on the file)

0 Likes

sibleon
Participant
Participant
Accepted solution

You can add the following MEL to your userSetup.mel file. This will enable AA whenever you open a file or create a new scene. See the documentation on the userSetup.mel file 

https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/Maya/fil...

 

 

global proc enableAA()
{
    setAttr hardwareRenderingGlobals.multiSampleEnable 1;
    print "Enabled anti-aliasing\n";
}

scriptJob -event "SceneOpened" enableAA;
enableAA();

 

 

Anonymous
Not applicable

Thankyou! this fixed the viewport displaying horrible jagged edges on my models on my Retina MacBook Pro.

0 Likes

nicolashendriksvillasante
Explorer
Explorer

This doesn't seem to work in Maya 2020...I have tried creating a userSetup.mel file in the script folder (using Windows notepad) but it doesn't do anything..Any ideas?

0 Likes

sibleon
Participant
Participant

Just tested it in Maya 2020.4 (Windows) and it works fine.

 

Things to check:

  1. Place the userSetup.mel in C:\Users\<username>\Documents\maya\scripts (this way it will apply to ALL versions)
  2. Check that your userSetup.mel isn't accidently called userSetup.mel.txt (Windows hides common file extensions)
  3. When saving with Notepad, you may need to set Save as type to All files, I recall Notepad saving .txt files although you type in your own extension, like .mel

I have attached my userSetup.mel for you to try.

millermaneo
Participant
Participant
Thank you!!!. i can confirm this works in the latest version of maya 2020. Thank you for the user mel file ! greatly appreciated !
0 Likes

gefxfamily
Community Visitor
Community Visitor

I confirm! This also works on 2023.2! Thanks for the file!

0 Likes

The-Digital-Shaman
Advocate
Advocate

Do you know the code for multisampling, so it will be i.e. 16 each time?

0 Likes