Autodesk / maya-usd

A common USD (Universal Scene Description) plugin for Autodesk Maya
774 stars 201 forks source link

ogsRender produces different image results from viewport/render view #265

Closed dj-mcg closed 4 years ago

dj-mcg commented 4 years ago

Describe the bug Automated tests will use ogsRender to produce image results. This will often produce images that are different from those that are seen in the viewer or render window when working interactively.

Steps to reproduce Steps to reproduce the behavior:

  1. Run testProxyShapeDrawColorAccuracy
  2. Observe the resulting image - only the top face illuminated, noisy shadow pattern

Expected behavior The image matches what is seen in the viewport

santosg87 commented 4 years ago

adding the pxr label, as this requires the pxr-USD unit tests

huidong-chen commented 4 years ago

@santosg87 Do we still have this issue? I think our automation relies on ogsRender so it might already be working?

mattyjams commented 4 years ago

Hey @HdC-adsk! We're still seeing a strange discrepancy here when comparing the behavior between the Pixar batch renderer and the VP2.0 render delegate.

I'm using the test scene located here: https://github.com/Autodesk/maya-usd/blob/dev/plugin/pxr/maya/lib/pxrUsdMayaGL/testenv/ProxyShapeDrawColorAccuracyTest/ProxyShapeDrawColorAccuracyTest.ma

When I open that scene in interactive Maya (2019.2), set the Cube_1 assembly to Collapsed, and switch the lighting mode to "All lights", here's what I see with the Pixar batch renderer: pxr_batch_renderer_viewport

And here's what I see with the VP2.0 render delegate: vp2_render_delegate_viewport

There's a bit of a brightness/value difference between the two, but otherwise they match reasonably closely, which is good.

I'm getting different results though when I generate the images through the unit test here: https://github.com/Autodesk/maya-usd/blob/dev/plugin/pxr/maya/lib/pxrUsdMayaGL/testenv/testProxyShapeDrawColorAccuracy.py

With the Pixar batch renderer, I'm getting this: pxr_batch_renderer_unit_test_ogsRender

While with the VP2.0 render delegate, I get this: vp2_render_delegate_unit_test_ogsRender

It looks like maybe shadow bias artifacts? I'm not sure why we're seeing something different with the render delegate between the viewport and ogsRender though.

huidong-chen commented 4 years ago

Hey @mattyjams , How can I run the unit test? I cannot reproduce it manually so would like to see if there is any difference in the unit test.

mattyjams commented 4 years ago

@HdC-adsk: Yeah, it is unfortunately fairly cumbersome right now, but here's how I'm running the test in the maya-usd repo on Linux (we have it automated internally):

results = unittest.TextTestRunner(stream=sys.stdout).run(suite) if results.wasSuccessful(): print("SUCCESS") else: print("FAILURE")



- Execute everything in the script editor tab and that should run the test. You should hopefully then find the output images in the newly created `tmp` directory in your current working directory.
mattyjams commented 4 years ago

I took another look at this, and I think things are indeed working as expected.

The Storm-based Pixar batch renderer (poorly) supports depth map shadows but not ray-traced shadows, while the Viewport 2.0 render delegate supports both. The directionalLight in the Maya scene for the testProxyShapeDrawColorAccuracy test was set to use ray-traced shadows (which is the default). This meant that the "all_lights" image written by the test would not include shadows when run with the Pixar batch renderer, but it would include a very noisy shadow when run with the Viewport 2.0 render delegate, since the geometry is just a very simple cube.

When using the Viewport 2.0 render delegate in an interactive Maya session, if I switched to using "All lights" and turned on shadows, then I started seeing something in the viewport that looked more like the noisy shadow image generated by ogsRender.

Shadows aren't important in this test, so I simply turned them off in #815.

Thanks for taking a look @HdC-adsk!

mattyjams commented 4 years ago

This should be resolved with the merge of #815. Closing...