Announcement

Collapse
No announcement yet.

HDRI Bitmap Support in Max on a per pixel base?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HDRI Bitmap Support in Max on a per pixel base?

    Dear users,

    I posted this in the general area but got the hint to post it here since this is more a forum for this.

    I want to do a maxscript that retrieves me the hdri pixel information out of an exr or hdr-image. But the method getPixels() only retrieves the ldr information ( RGB888 ). What I need is 32bit per color channel ( RGBE 32323232 ) floating point.

    Does anyone know how to code this?

    Robert
    Last edited by Robert1977; 02-05-2008, 10:45 AM.
    Robert

    Max, VRay, Fusion:

    https://www.youtube.com/watch?v=g5fSLrVzpxg
    https://www.youtube.com/watch?v=bpmJgTb_9Ro

  • #2
    Hmm, I know that if you render to a buffer with (bitmap W H hdrn) the getpixels will read the float values. Maybe if you read the image into a temporary hdr buffer the values will be returned as float? not sure if it is doable I'd need to study up on the I/O stuff.
    Eric Boer
    Dev

    Comment


    • #3
      I have tried to open an hdr image with the openBitmap()-Method in Max. And when I copy the bitmap to another hdr-file and close it, the other hdr-file still is hdr. But when I try to get the pixels with the getPixel-method, it gives me some floating point values, but these are between 0 and 255.0. It is the same as in photoshop, when you use the eyedropper or color sampler tool in 8bit-mode (it will give out some color values that seem not to be correct. when you switch the eyedropper tool to 32bit mode, it will display the correct color values between 0.0 and for example 4.0 (if the contrast range is very high).
      Robert

      Max, VRay, Fusion:

      https://www.youtube.com/watch?v=g5fSLrVzpxg
      https://www.youtube.com/watch?v=bpmJgTb_9Ro

      Comment


      • #4
        Got it. You just have to divide the values given back my 3DSMax by 255, for example (color 387.987 367.173 342.556 255) is what getPixels() gives me back, and if I divide it by 255 I get:

        color 1.5215 1.43988 1.3433 1.0 .

        I want to write me a small macro that enables me to color map a linear rendered image with the methods provided by Chaosgroup after the rendering (Reinhard, Exponential, HSV-Exponential). Am not sure yet if it works on a per pixel base but I suppose so. So I can adjust the settings and see what the image would look like without having to rerender it again.

        Cheers

        Robert
        Robert

        Max, VRay, Fusion:

        https://www.youtube.com/watch?v=g5fSLrVzpxg
        https://www.youtube.com/watch?v=bpmJgTb_9Ro

        Comment


        • #5
          Don't forget that an HDRI is using an exponent in the fourth channel to provide you the extra dynamic Range ..255 is the highest value , and you have to multiply it with your RGB's.
          www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

          Comment


          • #6
            Thanks for the info, Dschaga. Good to know this. The exr doesn't give me a fourth value back with the getPixels-method. Am I missing something or is this only valid for hdr-files?


            Robert
            Last edited by Robert1977; 04-05-2008, 08:30 AM.
            Robert

            Max, VRay, Fusion:

            https://www.youtube.com/watch?v=g5fSLrVzpxg
            https://www.youtube.com/watch?v=bpmJgTb_9Ro

            Comment


            • #7
              openExr is a pure 16 or 32bit per color format. This means that openEXR have enough range (1024 values per color) and doesn't need an exponent like HDR. The exponent gives you btw a much higher range, but is in fact more complicate to manage.

              You can read everything about the different formats in very basic english/german in the wonderfull hdri handbook: http://www.hdrlabs.com/book/index.html

              btw:
              What i meant before, was that you can't divide the given hdri RGB values always by 255, but only with the fourth value E . If the value is always 255 then maxscript (or 3ds max) gives you the wrong exponent.
              www.cgtechniques.com | http://www.hdrlabs.com - home of hdri knowledge

              Comment


              • #8
                Thanks. Actually Max is giving me only three components, so I assume it is ok to divide the values by 255. At least the formulas that I implemented from Vlado for the color mapping modi are working with this.

                Thanks

                Robert
                Robert

                Max, VRay, Fusion:

                https://www.youtube.com/watch?v=g5fSLrVzpxg
                https://www.youtube.com/watch?v=bpmJgTb_9Ro

                Comment


                • #9
                  If the bitmap it's initialised as HDR (range, not format), I can assure you it returns correct linear float values (once you normalise them, ie. divide by 255): my exposimeter depends on it.
                  How a format works internally it's only an issue for a file writer, not for pixel value retrieval inside a max open bitmap.

                  As for the colormapping, avoid render effects, as those have issues with initializing a proper hdr bitmap (there's no direct method for it), and force you to set an hdr-enabled format in the render options to enable the aforementioned hdr buffer.
                  You can still write a custom interface, though.
                  Lele
                  Trouble Stirrer in RnD @ Chaos
                  ----------------------
                  emanuele.lecchi@chaos.com

                  Disclaimer:
                  The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                  Comment


                  • #10
                    Thanks for the info, lele. the custom colormapping script I wrote is working almost, and I normalized the hdr-values by 255, except for the hsv-exponential mode that is not working yet. But there I need to work on the methods for hsv to rgb conversion and vice versa.

                    Best regards.
                    Robert

                    Max, VRay, Fusion:

                    https://www.youtube.com/watch?v=g5fSLrVzpxg
                    https://www.youtube.com/watch?v=bpmJgTb_9Ro

                    Comment


                    • #11
                      Asking for the mycolor.h of a color triplet will return the hue, just as mycolor.r will return red.
                      Lele
                      Trouble Stirrer in RnD @ Chaos
                      ----------------------
                      emanuele.lecchi@chaos.com

                      Disclaimer:
                      The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                      Comment


                      • #12
                        Hi Lele, this sounds easy. Somehow forgot to try this, I read about this but it was kind of not working. Will try it again .

                        just read that you wrote a script for automatically expose the image rendered. Does this script also do colormapping from linear to exponential space?
                        And do you think anyone would be interested in the script that I wrote for me to do the color mapping styles like reinhard, exponential, hsv exponential etc. from vray after linear rendering or does anyone else have other tools to achieve this?

                        Cheers

                        Robert
                        Last edited by Robert1977; 13-05-2008, 02:41 PM.
                        Robert

                        Max, VRay, Fusion:

                        https://www.youtube.com/watch?v=g5fSLrVzpxg
                        https://www.youtube.com/watch?v=bpmJgTb_9Ro

                        Comment


                        • #13
                          My matrix exposimeter is a simple , linear (Allows for gamma display only), tool.
                          I'd say doing a post effect to colormap the image after rendering is most welcome, as my script does render a small preview for each iteration the user might want, it doesn't work as a post effect, and it produces errors when used with colormapping (to that effect, in fact, the script exposes linearly changing the render settings for the exposure phase only).
                          I DO have post-effect exposimeter script, again only working linearly, which then changes the ISOs for the camera, but the fact that the user had to initialize the HDR bitmap through the render dialog made me think I'd abandon the approach until max will provide a more coherent bitmap construct also for post effects.
                          In one line: go for it!
                          Lele
                          Trouble Stirrer in RnD @ Chaos
                          ----------------------
                          emanuele.lecchi@chaos.com

                          Disclaimer:
                          The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                          Comment

                          Working...
                          X