pyrender icon indicating copy to clipboard operation
pyrender copied to clipboard

depth output not working when using OrthographicCamera

Open miccio-dk opened this issue 5 years ago • 8 comments

Hello there,

I'm trying to obtain a depth map using the orthographic camera. I took this example code and replaced PerspectiveCamera(yfov=np.pi / 3.0, aspectRatio=1.0) with OrthographicCamera(xmag=0.2,ymag=0.2). This is what I get with PerspectiveCamera: with PerspectiveCamera

...and with OrthographicCamera: with OrthographicCamera

It seems like all the geometry has disappeared and all I'm left with, is a dark outline. In order to confirm this, I extracted the histogram of all the data in the depth channel: Screenshot 2019-09-17 17 02 22

Am I doing anything wrong? Thanks in advance :)

miccio-dk avatar Sep 17 '19 15:09 miccio-dk

Hi there, I had the same issue and fixed it by patching the original code

https://github.com/mmatl/pyrender/compare/master...andreanicastro:master

This is my patch

andreanicastro avatar Sep 18 '19 16:09 andreanicastro

Grazie Andrea! Just out of curiosity, do you know if the lib author is interested in merging your fix?

miccio-dk avatar Sep 18 '19 21:09 miccio-dk

I was coming here for the same issue. Nice work. Unless I misread it, I think you missed another place where your patch would be required: read_depth_buf() in renderer.py

*edit: typo

ssavary avatar Sep 20 '19 17:09 ssavary

Hi all, I had a PR opened for two months and I was updating it to keep it in line with the repo. I closed it because I thought was not going to be merged. I can re-do the PR early next week :)

On 20 Sep 2019 19:27, Simon Savary [email protected] wrote:

I was coming here for the same issue. Nice work. Unless I misread it, I think you missed another place where your patch would required: read_depth_buf() in renderer.py

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/mmatl/pyrender/issues/72?email_source=notifications&email_token=ADTYPIFDQ3UAEP54RJKXEHLQKUBX5A5CNFSM4IXRK2U2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7HLZEA#issuecomment-533642384, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADTYPIENOAPCZV4VBWU7IR3QKUBX5ANCNFSM4IXRK2UQ.

andreanicastro avatar Sep 20 '19 21:09 andreanicastro

@ssavary You are right, I will have a look a the issue this evening. I think I will have a PR ready by tonight.

andreanicastro avatar Sep 25 '19 08:09 andreanicastro

Hi there, I had the same issue and fixed it by patching the original code

master...andreanicastro:master

This is my patch

Im wondering why the author not merge the code in, it solves my issue

muxizju avatar Dec 31 '20 08:12 muxizju

@andreanicastro still very helpful, thank you!

lkskstlr avatar Feb 29 '24 15:02 lkskstlr