mortacious / python-optix

Python wrapper for the OptiX 7 raytracing engine using Cython.
MIT License
24 stars 3 forks source link

Doesn't run examples #13

Closed georgy95 closed 1 year ago

georgy95 commented 1 year ago

First of all, I downgraded from 7.7.0 to 7.6.0 SDK in order to compile the package.

Running a denoising example on a sample image yields:

python denolser.py input.exr (The name is mis-spelled).

RuntimeError: OPTIX_ERROR_INVALID_VALUE: Invalid value
Exception ignored in: 'optix.denoiser.Denoiser.__dealloc__'
Traceback (most recent call last):
  File "/home/gr/python-optix/examples/denolser.py", line 56, in <module>
    denoiser = ox.Denoiser(ctx, model_kind=model_kind, guide_albedo=args.albedo is not None, guide_normals=args.normal is not None, kp_mode=args.k)
RuntimeError: OPTIX_ERROR_INVALID_VALUE: Invalid value
Traceback (most recent call last):
  File "/home/gr/python-optix/examples/denolser.py", line 56, in <module>
    denoiser = ox.Denoiser(ctx, model_kind=model_kind, guide_albedo=args.albedo is not None, guide_normals=args.normal is not None, kp_mode=args.k)
  File "optix/denoiser.pyx", line 154, in optix.denoiser.Denoiser.__init__
AttributeError: 'optix.denoiser.Denoiser' object has no attribute '_guide_layer_scratch_size'

I'm not sure why this error is thrown as _guide_layer_scratch_size attribute is being initialized in the constructor.

Removing _guide_layer_scratch_size from the init passes the issue downstream:

Traceback (most recent call last):
  File "/home/gr/python-optix/examples/denolser.py", line 58, in <module>
    ret = denoiser.invoke(color_image, albedo=albedo_image if args.albedo else None, normals=normal_image if args.normal else None)
  File "optix/denoiser.pyx", line 294, in optix.denoiser.Denoiser.invoke
  File "optix/denoiser.pyx", line 199, in optix.denoiser.Denoiser._init_denoiser
AttributeError: 'optix.denoiser.Denoiser' object has no attribute '_intensity_scratch_size'

Setup: Ubuntu 22.04 VM with CUDA 12.1 & 530.30.02 Driver & 7.6.0 OptiX.

mortacious commented 1 year ago

Thanks for pointing out this mistake. The errors should be fixed with the PR above.

Please note, that the denoiser example is still somewhat bare bones and does not yet implement the full functionality from the original in the SDK.

georgy95 commented 1 year ago

Thanks for the PR.

I think most people would want to simply:

I ran the Denoiser yesterday - errors are all gone.

Had a an issue while running it on a transparent image I had generated earlier - but the issues seems to be more OptiX based, rather than the python-optix itself.

Also had some issues with OptiX not picking up/identifying Monte Carlo noise to denoise.