This article is the 12th day article of Maya Advent Calendar 2019.
In CG animation production, a barren waiting time of waiting for a bake occurs in every process. This time, I will introduce a technique to reduce the waiting time for baking work as much as possible.
Stop drawing the screen in Maya. ↓ Make heavy processing. ↓ Resume screen drawing in Maya and check the result.
It will be the flow.
Here are three ways to stop drawing screens in Maya.
To stop drawing the screen from the UI, press the stop button surrounded by a red frame.
When executed, the work screen will be surrounded by a red frame. Drawing on the Maya screen will stop while this red frame appears.
Press the stop button again to resume drawing on the screen.
You can stop drawing with the pause flag of the ogs command.
Execute the following command to stop drawing the screen. The screen will be surrounded by a red line as you did from the UI.
cmds.ogs(pause=True)
Use the same command to resume drawing.
cmds.ogs(pause=True)
This feature cannot be used because the pause flag does not exist in the ogs command prior to Maya 2017.
http://help.autodesk.com/cloudhelp/2015/JPN/Maya-Tech-Docs/CommandsPython/ogs.html
When processing to bake from 1 to 1000 frames, write as follows.
#Stop drawing
cmds.ogs(pause=True)
#Bake processing
cmds.bakeResults( bakenodes, t=(1,1000), simulation=True )
#Resume drawing
cmds.ogs(pause=True)
The one I use most often
Execute the following command to stop drawing the screen. The red frame is not displayed on the screen like the ogs command. It just freezes the screen.
cmds.refresh(suspend=True)
Use the same command to resume drawing.
cmds.refresh(suspend=False)
When processing to bake from 1 to 1000 frames, write as follows.
#Stop drawing
cmds.refresh(suspend=True)
#Bake processing
cmds.bakeResults( bakenodes, t=(1,1000), simulation=True )
#Resume drawing
cmds.refresh(suspend=False)
I would like to measure the time required for baking when the screen is stopped / drawing is not stopped. Let's compare each of maya2019 / maya2018 / maya2017 / maya2015.
Measure the time it takes to bake a simple Hair simulation. Bake range is from 1 to 1000F. The total number of Joints to bake is 91. Maya's evaluation mode is fixed at DG.
"""
How to not stop drawing
"""
import time
#Start measurement
start = time.time()
#Bake processing
bakenode = cmds.ls('bake_joint*')
cmds.bakeResults( bakenode, t=(1,1000), simulation=True )
#End of measurement
elapsed_time = time.time() - start
print (u"processing time:{0}".format(elapsed_time) + "[sec]")
"""
How to stop drawing using the ogs command
"""
import time
#Start measurement
start = time.time()
#Stop drawing
cmds.ogs(pause=True)
#Bake processing
bakenode = cmds.ls('bake_joint*')
cmds.bakeResults( bakenode, t=(1,1000), simulation=True )
#Resume drawing
cmds.ogs(pause=True)
#End of measurement
elapsed_time = time.time() - start
print (u"processing time:{0}".format(elapsed_time) + "[sec]")
"""
How to stop drawing using the refresh command
"""
import time
#Start measurement
start = time.time()
#Stop drawing
cmds.refresh(suspend=True)
#Bake processing
bakenode = cmds.ls('bake_joint*')
cmds.bakeResults( bakenode, t=(1,1000), simulation=True )
#Resume drawing
cmds.refresh(suspend=False)
#End of measurement
elapsed_time = time.time() - start
print (u"processing time:{0}".format(elapsed_time) + "[sec]")
Addition: The measurement result in parallel mode has been added.
Open the verification data created in Maya 2019.2 in each version and measure. Measured in DG mode and parallel mode. Stop screen drawing when using ogs command and refresh command
Maya | Bake as it is | ogs command | refresh command |
---|---|---|---|
maya2019 | 60.34s | 32.31s | 43.90s |
maya2018 | 59.15s | 31.56s | 45.97s |
maya2017 | 55.93s | 25.34s | 31.18s |
maya2016 | 51.18s | None | 20.76s |
maya2015 | 47.82s | None | 17.21s |
Maya | Bake as it is | ogs command | refresh command |
---|---|---|---|
maya2019 | 17.34s | 15.80s | 14.87s |
maya2018 | 18.78s | 16.17s | 19.69s |
maya2017 | 16.84s | 13.92s | 12.94s |
maya2016 | 46.50s | None | 20.14s |
maya2015 | None | None | None |
The parallel mode is pretty good! Also, the processing speed is faster if you stop drawing the screen for both DG / parallel.
According to my personal rule of thumb, this speed difference increases as the amount of data handled increases. If it takes 10 minutes to bake, it will take about 2 minutes ...!
Besides baking animations Screen drawing stop is also effective when outputting the geometry cache and saving the simulation cache.
Use your time meaningfully!