mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.8k stars 429 forks source link

imgtool: unknown command "denoise-optix". usage: imgtool <command> [options] where <command> is: #369

Closed disini closed 1 year ago

disini commented 1 year ago

Hi sir:

I cloned a new version on 20230717, and compile it successfully with cuda 12.2 and optix 7.7, on ubuntu 22.04.2.

The render function works fine, but when I tried to denoise some exr files using the imgtool, I saw this :

disini commented 1 year ago

 mmp/pbrt-v4/2023/20230717_clone/build_ubuntu/release# ./imgtool denoise-optix bmw-m6-spp=1000.exr --outfile bmw-m6-spp=1000_denoised.exr
imgtool: unknown command "denoise-optix".
usage: imgtool <command> [options]

where <command> is:

assemble: Assemble multiple images representing cropped regions of a larger
    image into a single composite image.

average: Generate an image that is the result of averaging multiple images.
    The constituent images are specified with a path that gives their
    prefix.

bloom: Apply a bloom effect to the specified image where pixels that are
    brighter than a threshold are blurred and added to nearby pixels.

cat: Print the pixel values of the specified image to standard output.

convert: Convert an image, possibly going from one format to another.
    A variety of image processing operations can be performed as well.

diff: Compute the difference between an image and a reference image
    according to a variety of metrics and optionally output a
    difference image.

error: Compute the average error of a set of images with respect to a
   reference image. All image files starting with <filename prefix>
    are used to compute error.

falsecolor: Generate a false color image encoding the magnitude of the
    average of the channels in each pixel in the provided image.

info: Prints out image information including resolution, colorspace and pixel stats

makeemitters: Generate the description of a small quadrilateral emitter for
    every pixel in the image.

makeequiarea: Convert a equirectangular environment map (as used in pbrt-v3)
    to an equi-area parameterization (as used in pbrt-v4).

makesky: Generate an environment map based on the Hosek-Wilkie sky model.

scalenormalmap: Scale the provided normal map by applying the given factor for x and y
    and output the resulting normal map.

splitn: Generate a composite image from the specified images by taking
    a strip of pixels from each image, in the order given. An additional
    image of cropped regions of each of the images may be optionally
    generated as well.

whitebalance: Apply white balancing to the specified image.

"imgtool help <command>" provides detailed information about <command>.
disini commented 1 year ago

and my question is, was the denoise and denoise-optix commands removed in the latest version ?

When I check the usage of imgtool with the version 20220818 I compiled last year, it shows like this :

disini commented 1 year ago
/mmp/pbrt-v4/2022/20220818/build_ubuntu_01$ ./imgtool
usage: imgtool <command> [options]

where <command> is:

assemble: Assemble multiple images representing cropped regions of a larger
    image into a single composite image.

average: Generate an image that is the result of averaging multiple images.
    The constituent images are specified with a path that gives their
    prefix.

bloom: Apply a bloom effect to the specified image where pixels that are
    brighter than a threshold are blurred and added to nearby pixels.

cat: Print the pixel values of the specified image to standard output.

convert: Convert an image, possibly going from one format to another.
    A variety of image processing operations can be performed as well.

denoise: Applies a simple denoising algorithm to the provided image.
    The image should be a multi-channel EXR as generated by pbrt's
    "gbuffer" film.

denoise-optix: Denoises the image using NVIDIA's OptiX denoiser which is
    based on a deep neural network. The provided image should
    be a multi-channel EXR as generated by pbrt's "gbuffer" film.

diff: Compute the difference between an image and a reference image
    according to a variety of metrics and optionally output a
    difference image.

error: Compute the average error of a set of images with respect to a
   reference image. All image files starting with <filename prefix>
    are used to compute error.

falsecolor: Generate a false color image encoding the magnitude of the
    average of the channels in each pixel in the provided image.

info: Prints out image information including resolution, colorspace and pixel stats

makeemitters: Generate the description of a small quadrilateral emitter for
    every pixel in the image.

makeequiarea: Convert a equirectangular environment map (as used in pbrt-v3)
    to an equi-area parameterization (as used in pbrt-v4).

makesky: Generate an environment map based on the Hosek-Wilkie sky model.

scalenormalmap: Scale the provided normal map by applying the given factor for x and y
    and output the resulting normal map.

splitn: Generate a composite image from the specified images by taking
    a strip of pixels from each image, in the order given. An additional
    image of cropped regions of each of the images may be optionally
    generated as well.

whitebalance: Apply white balancing to the specified image.

"imgtool help <command>" provides detailed information about <command>.
disini commented 1 year ago

That old version does have the two commands in the help tips, but it doesn't work anymore ??

It gives an error log :

/mmp/pbrt-v4/2022/20220818/build_ubuntu_01$ ./imgtool denoise-optix crown.exr --outfile crown_denoised.exr
Warning: crown.exr: image doesn't have Albedo.{R,G,B} channels. Denoising quality may suffer.
Warning: crown.exr: image doesn't have Nsx, Nsy, Nsz channels. Denoising quality may suffer.
[ tid 42125 @     0.000s mmp/pbrt-v4/2022/20220818/src/pbrt/gpu/denoiser.cpp:47 ] FATAL OptiX call optixDenoiserCreate(optixContext, OPTIX_DENOISER_MODEL_KIND_HDR, &options, &denoiserHandle) failed with code 7990: "Internal error"
(./imgtool                               )  0x0x55d7c580717a - pbrt::PrintStackTrace() + 0x3a
(./imgtool                               )  0x0x55d7c5807411 - pbrt::CheckCallbackScope::Fail() + 0x21
(./imgtool                               )  0x0x55d7c586cf12 - pbrt::LogFatal(pbrt::LogLevel, char const*, int, char const*) + 0xf2
(./imgtool                               )  0x0x55d7c592a7df - void pbrt::LogFatal<int, char const*>(pbrt::LogLevel, char const*, int, char const*, int&&, char const*&&) + 0x5f
(./imgtool                               )  0x0x55d7c5929808 - pbrt::Denoiser::Denoiser(pbrt::Vector2<int>, bool) + 0x1028
(./imgtool                               )  0x0x55d7c5637b39 - denoise_optix(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) + 0x4a9
(./imgtool                               )  0x0x55d7c5617636 - main + 0x4c6
(/lib/x86_64-linux-gnu/libc.so.6         )  0x0x7f97ea029d90 - (unknown) + 0x29d90
(/lib/x86_64-linux-gnu/libc.so.6         )  0x0x7f97ea029e40 - __libc_start_main + 0x80
(./imgtool                               )  0x0x55d7c561e315 - _start + 0x25

I'm so confused about this, how could I fix this problem?

Much appreciated!

pbrt4bounty commented 1 year ago

Here is working, CUDA 11.6, optix 7.4. Make sure that your CUDA / Optix versions don't introduce a new code for denoise


C:\apps\pbrt4>imgtool denoise-optix test.exr --outfile deno.exr
Warning: test.exr: image doesn't have Albedo.{R,G,B} channels. Denoising quality may suffer.
Warning: test.exr: image doesn't have Ns.X, Ns.Y, Ns.Z channels. Denoising quality may suffer.

C:\apps\pbrt4>pbrt
pbrt version 4 (built Jul 18 2023 at 23:49:54)
Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
The source code to pbrt (but *not* the book contents) is covered by the Apache 2.0 License.
See the file LICENSE.txt for the conditions of the license.```
mmp commented 1 year ago

imgtool denoise was removed in b1603296ce47e0c7e688674ea895e4e640cf3502.

If denoise-optix isn't being offered in the help text then you haven't built pbrt with GPU support. Did you provide PBRT_OPTIX7_PATH when you built it?

disini commented 1 year ago

imgtool denoise was removed in b160329.

If denoise-optix isn't being offered in the help text then you haven't built pbrt with GPU support. Did you provide PBRT_OPTIX7_PATH when you built it?

Thanks so much sir! I'll try it now~~

disini commented 1 year ago

Here is working, CUDA 11.6, optix 7.4. Make sure that your CUDA / Optix versions don't introduce a new code for denoise

C:\apps\pbrt4>imgtool denoise-optix test.exr --outfile deno.exr
Warning: test.exr: image doesn't have Albedo.{R,G,B} channels. Denoising quality may suffer.
Warning: test.exr: image doesn't have Ns.X, Ns.Y, Ns.Z channels. Denoising quality may suffer.

C:\apps\pbrt4>pbrt
pbrt version 4 (built Jul 18 2023 at 23:49:54)
Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
The source code to pbrt (but *not* the book contents) is covered by the Apache 2.0 License.
See the file LICENSE.txt for the conditions of the license.```

Thank you buddy, I'll check it ~~