WispForMaya icon indicating copy to clipboard operation
WispForMaya copied to clipboard

[renamed] Depth buffer causes outline to be rendered incorrectly.

Open tntmeijs opened this issue 5 years ago • 4 comments

Describe the bug The Maya viewport camera uses a different aspect ratio, fov, etc. than the Wisp camera.

To Reproduce Steps to reproduce the behavior:

  1. Open Maya.
  2. Add a primitive.
  3. Load Wisp.
  4. Switch to the Wisp renderer.

Expected behavior The object should match its Maya wireframe outline perfectly.

Screenshots maya_wisp_camera_size_mismatch

Desktop (please complete the following information):

  • OS: Windows 10 64-bit
  • Maya2019

tntmeijs avatar Mar 01 '19 10:03 tntmeijs

The wireframe is closer to match the correct wireframe, but the fix is a hack right now. It is 'fixed' by multiplying the depth value by 0.5, the closer it gets to a depth value of 0. So, when the depth value is 0.0 it's multiplied by 0.5 and the closer it gets to 1.0 to less the 0.5 factor is applied to it.

float depthScalar = 1.0 - (depth.r * ((1.0 - depth.r) * 0.5));

The Maya viewport next to the 'fixed' Wisp viewport The Maya viewport next to the 'fixed' Wisp viewport

Zoomed in on tiny errors that are still there Zoomed in on tiny errors that are still there

Zoomed in on tiny errors that are still there Zoomed in on tiny errors that are still there

MeineZ avatar Apr 04 '19 11:04 MeineZ

The wireframe aligns the models correctly now. The small error is still there, but the outline is correctly surrounding the model now.

See PR #53

Screenshot from Gyazo

MeineZ avatar Apr 04 '19 13:04 MeineZ

I noticed that this formula actually shouldn't even work, if you think about it.. The current formula results in the following plot.

Screenshot from Gyazo

MeineZ avatar Apr 11 '19 23:04 MeineZ

https://i.imgur.com/Ax06oAg.png

VZout avatar Jun 11 '19 13:06 VZout