WispForMaya
WispForMaya copied to clipboard
[renamed] Depth buffer causes outline to be rendered incorrectly.
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:
- Open Maya.
- Add a primitive.
- Load Wisp.
- Switch to the Wisp renderer.
Expected behavior The object should match its Maya wireframe outline perfectly.
Screenshots
Desktop (please complete the following information):
- OS: Windows 10 64-bit
- Maya2019
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 wireframe aligns the models correctly now. The small error is still there, but the outline is correctly surrounding the model now.
See PR #53
I noticed that this formula actually shouldn't even work, if you think about it.. The current formula results in the following plot.
https://i.imgur.com/Ax06oAg.png