mitsuba3 icon indicating copy to clipboard operation
mitsuba3 copied to clipboard

Bitmap and Checkerboard - max() Method Not Implemented

Open Microno95 opened this issue 3 years ago • 4 comments

Summary

I am using a 2d texture to represent a rotationally symmetric 3d volume (really useful in the case of certain types of volume emitters, refer to #678) but I'm finding that it is not possible to obtain the maximum of a bitmap or checkerboard texture.

System configuration

System information:

  OS: Windows-10
  CPU: AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD
  GPU: NVIDIA GeForce RTX 3090
  Python: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:51:29) [MSC v.1929 64 bit (AMD64)]
  NVidia driver: 531.68
  CUDA: 11.7.99
  LLVM: 15.-1.-1

  Dr.Jit: 0.4.2
  Mitsuba: 3.3.0
     Is custom build? False
     Compiled with: MSVC 19.34.31937.0
Variants:
        scalar_rgb
        scalar_mono
        scalar_mono_double
        scalar_mono_polarized
        scalar_mono_polarized_double
        scalar_rgb_double
        scalar_rgb_polarized
        scalar_rgb_polarized_double
        scalar_spectral
        scalar_spectral_double
        scalar_spectral_polarized
        scalar_spectral_polarized_double
        llvm_mono
        llvm_mono_double
        llvm_mono_polarized
        llvm_mono_polarized_double
        llvm_rgb
        llvm_rgb_double
        llvm_rgb_polarized
        llvm_rgb_polarized_double
        llvm_spectral
        llvm_spectral_double
        llvm_spectral_polarized
        llvm_spectral_polarized_double
        llvm_ad_mono
        llvm_ad_mono_double
        llvm_ad_mono_polarized
        llvm_ad_mono_polarized_double
        llvm_ad_rgb
        llvm_ad_rgb_double
        llvm_ad_rgb_polarized
        llvm_ad_rgb_polarized_double
        llvm_ad_spectral
        llvm_ad_spectral_double
        llvm_ad_spectral_polarized
        llvm_ad_spectral_polarized_double
        cuda_mono
        cuda_mono_double
        cuda_mono_polarized
        cuda_mono_polarized_double
        cuda_rgb
        cuda_rgb_double
        cuda_rgb_polarized
        cuda_rgb_polarized_double
        cuda_spectral
        cuda_spectral_double
        cuda_spectral_polarized
        cuda_spectral_polarized_double
        cuda_ad_mono
        cuda_ad_mono_double
        cuda_ad_mono_polarized
        cuda_ad_mono_polarized_double
        cuda_ad_rgb
        cuda_ad_rgb_double
        cuda_ad_rgb_polarized
        cuda_ad_rgb_polarized_double
        cuda_ad_spectral
        cuda_ad_spectral_double
        cuda_ad_spectral_polarized
        cuda_ad_spectral_polarized_double

Description

Bitmap and Checkerboard should have very simple implementations of the max method given that bitmap computes the mean (which can compute the max alongside it) and checkerboard has known components.

Happy to implement this and create a PR if there's no plans to do it. Will also see if it's straightforward to do for the mesh_attribute texture as well.

Microno95 avatar May 01 '23 11:05 Microno95

Hi @Microno95

Indeed! The Texture::max() method is a relatively recent addition I believe, we never had time to cover all existing plugins. I'd welcome any PR that even partially covers the existing plugins :smile:

njroussel avatar May 02 '23 10:05 njroussel

Great! I'll work on that, though I won't have access to my computer til Sunday so not before then 😅

Is there any interest for volume textures that are swept or tiled versions of 2d textures like 3d rotated cross-sections and swept sections? And is there any interest in composing textures/volumes through plugins that implement combining them at runtime through simple operations like addition, multiplication, mixing (using a texture or constant)?

I can roll them into the same PR as extensions to textures/volumes.

Microno95 avatar May 02 '23 10:05 Microno95

Thank you!

Is there any interest for volume textures that are swept or tiled versions of 2d textures like 3d rotated cross-sections and swept sections? And is there any interest in composing textures/volumes through plugins that implement combining them at runtime through simple operations like addition, multiplication, mixing (using a texture or constant)?

I'm not quite sure I understand the second half. What types are we talking about here? Composing these by using TensorXf objects can already be done I believe.

Overall, I think these are nice features but don't have their place in the main repository. We've discussed the ability to write and publish extensions/plugins to Mitsuba 3 a few times. I think something like this would be a great candidate. There's still a bit more work to be done on our end for this to be available.

njroussel avatar May 03 '23 06:05 njroussel

Ah, I meant in the context of specifying scenes in xml files. It's not the simplest to say combine two images directly in mitsuba 3 and rather that's left to external software. Perhaps, as you said, a separate mitsuba extensions library makes more sense. I'd be very happy to contribute to it.

Microno95 avatar May 03 '23 08:05 Microno95