Taichi: Something wrong with Cornell box example

Created on 3 Jun 2020  路  6Comments  路  Source: taichi-dev/taichi

  • os: macOS Catalina 10.15.5
  • Python version: 3.7.0
  • taichi version: 0.6.7

It seems that there is something wrong with the example 'Cornell box' .
Thanks for your help in advance.
Screenshot 2020-06-03 at 4 38 35 PM
Screenshot 2020-06-03 at 4 44 15 PM

mac metal potential bug rendering

Most helpful comment

Hi,

Thank you for reporting this!

This is an issue due to the graphics card. My MBP has two cards:

  1. AMD Radeon Pro 5500M
  2. Intel(R) UHD Graphics 630

I can repro this on 2, but not 1. My wild guess would be that this was due to some floating point arithmetics differences. Maybe some denominators were close to zero and led to this problem? (@yuanming-hu have you encountered such kind of errors before? I.e. numerical rounding errors led to NaN..? )

Unfortunately, my understanding of Metal is not enough for me to easily spot where the problem was :( It is even possible that Apple had a poor support on the integrated graphics cards.. (We once observed that Metal's memory order went completely nonsense on an old MBP model)

I could make a patch to disable direct light sampling in this case. The result will be more noisy, but hopefully it can at least present a reasonable result.

All 6 comments

The error itself seems like a numpy warning indicating img / img.mean() * 0.24 got a negative number therefore all var become nan. But I failed to reproduce it with python 3.7.7 and numpy 1.18.4, not sure if it was caused by the version

[Taichi] mode=release
[Taichi] version 0.6.7, supported archs: [cpu, metal], commit ca4d9dda, python 3.7.7

0.44 samples/s (10 iters, var=0.15163780748844147)
14.49 samples/s (20 iters, var=0.14393506944179535)
15.90 samples/s (30 iters, var=0.13919679820537567)
16.09 samples/s (40 iters, var=0.13583609461784363)
15.96 samples/s (50 iters, var=0.1332968771457672)
16.11 samples/s (60 iters, var=0.13132062554359436)
16.11 samples/s (70 iters, var=0.12971432507038116)

Would you mind sharing your numpy info via pip show numpy? I can not reproduce this on my mac either.

pip show numpy

Screenshot 2020-06-04 at 1 26 21 AM
Here it is. Thank you!

Screenshot 2020-06-04 at 1 26 21 AM

Thanks for sharing, but again I can not reproduce this. A quick workaround would be adding a line of img = np.clip(img, 0, 1) right after line 453 to ensure no negative value presents

img = np.clip(img, 0, 1)

Thanks for your help! I tried it and also updated the python version to 3.8.3 ,however, the problem is still not solved.

Hi,

Thank you for reporting this!

This is an issue due to the graphics card. My MBP has two cards:

  1. AMD Radeon Pro 5500M
  2. Intel(R) UHD Graphics 630

I can repro this on 2, but not 1. My wild guess would be that this was due to some floating point arithmetics differences. Maybe some denominators were close to zero and led to this problem? (@yuanming-hu have you encountered such kind of errors before? I.e. numerical rounding errors led to NaN..? )

Unfortunately, my understanding of Metal is not enough for me to easily spot where the problem was :( It is even possible that Apple had a poor support on the integrated graphics cards.. (We once observed that Metal's memory order went completely nonsense on an old MBP model)

I could make a patch to disable direct light sampling in this case. The result will be more noisy, but hopefully it can at least present a reasonable result.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jackalcooper picture jackalcooper  路  4Comments

yuanming-hu picture yuanming-hu  路  3Comments

KLozes picture KLozes  路  4Comments

liaopeiyuan picture liaopeiyuan  路  3Comments

archibate picture archibate  路  3Comments