-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Sporadic issue in maya2022, I run a series of 4 playblasts where the main modifications are to the viewport_options:
{
'displayAppearance': 'flatShaded' if flat_shaded==True else 'smoothShaded',
'displayLights': 'all' if lit==True else 'default',
'displayTextures': 1 if tex==True else 0,
}
A simplified sample function would look like (sorry, haven't tested the exact function, but should have all the main bits):
def custom_capture(name, tex = True, flat_shaded = False, lit = True, start_frame=0, end_frame=10):
cam_name = 'persp'
viewport_ptions = {
'displayAppearance': 'flatShaded' if flat_shaded==True else 'smoothShaded',
'displayLights': 'all' if lit==True else 'default',
'displayTextures': 1 if tex==True else 0}
display_options = {
"displayGradient": 0,
"background": (0, 0, 0),
"backgroundTop": (0.535, 0.617, 0.702),
"backgroundBottom": (0.052, 0.052, 0.052)}
viewport2_options = {
"multiSampleEnable" : 1,
"lineAAEnable" : 1,
"ssaoEnable": 1,
"enableTextureMaxRes": 1}
capture.capture(camera=cam_name, start_frame=start, end_frame=end, filename=name, format="qt", compression="none", width=2048, height=2048, quality=100, maintain_aspect_ratio=False, overwrite=True, viewport_options=viewport_options, viewer=True, off_screen=True, display_options=display_options, viewport2_options=viewport2_options)
Then these are run in the following sequence:
# generate smooth shaded, lit, with textures
custom_capture(name = 'smooth_lit_tex',tex=True, flat_shaded = False, lit = True)
# generate flat shaded, lit, with no textures
custom_capture(name = 'flat_lit_notex',tex=False, flat_shaded = True, lit = True)
# generate flat shaded, lit, with textures
custom_capture(name = 'flat_lit_tex',tex=True, flat_shaded = True, lit = True)
# generate flat shaded, unlit, no textures
custom_capture(name = 'flat_unlit_notex',tex=False, flat_shaded = True, lit = 0)
It seems that fairly consistently, if the active viewport is not set to flatShaded - flatShaded playblasts turn out blank. Similarly true with the "displayTextures" setting. If the main viewport is not first set, the renders turn out blank.
A bit difficult to put your finger on, though, as in some sessions everything works. But upon opening a clean maya session and re-running, typically any except the "smooth_lit_tex" one above will turn out black.
The hacky workaround I found was to temporarily force all modelPanel's to use my target "viewport_settings" in code, run the capture command, and then reset. The suspicion being that the panel created within the capture command is actually inheriting something from the viewports and it's not being successfully overwritten due to some maya 2022 bug.
Platform: Windows 10
Maya Version: 2022.3.0-18.0.PFIX