Community
Maya Programming
Welcome to Autodeskā€™s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

Anti-Aliasing in Viewport 2.0

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Anonymous
8808 Views, 9 Replies

Anti-Aliasing in Viewport 2.0

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.

9 REPLIES 9
Message 2 of 10
morten_bohne
in reply to: Anonymous

import pymel.core as pm

hwr = pm.PyNode("hardwareRenderingGlobals")
try:
    hwr.multiSampleEnable.set(1)
except:
    print("Couldn't set Anti-aliasing")
Message 3 of 10
morten_bohne
in reply to: morten_bohne

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)

Message 4 of 10
sibleon
in reply to: Anonymous

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();

 

 

Message 5 of 10
Anonymous
in reply to: sibleon

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

Message 6 of 10

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?

Message 7 of 10

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.

Message 8 of 10
millermaneo
in reply to: sibleon

Thank you!!!. i can confirm this works in the latest version of maya 2020. Thank you for the user mel file ! greatly appreciated !
Message 9 of 10
gefxfamily
in reply to: sibleon

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

Message 10 of 10
The-Digital-Shaman
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report