Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Best supported grayscale format
Forum Updated to NodeBB v4.3 + New Features

Best supported grayscale format

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 5.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    glararan
    wrote on last edited by
    #1

    Hi,

    I have question about grayscale best format. And why?

    I need best for heightmap. Currently I have 8-bit RGB format(png) which is totally useless.

    Bigger bits in heightmap mean bigger number of gray colors and I use these for rendering height.

    I tried .raw 32-bit, but it is unsupported.

    So I need to know which grayscale format and which is maximum bits allowed.

    And small question on end. When I use grayscale, which QImage format is should be? RGBA-bits(ex. RGBA32)?

    Thanks for reply and help!

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      i don't quite understand what the issue is you have. Do you want to display 32bit full-grayscale shades? To achieve a higher scale of gray shades for rendering??

      [quote author="glararan" date="1377704361"]
      I need best for heightmap. Currently I have 8-bit RGB format(png) which is totally useless.
      [/quote]
      why is it useless?

      [quote author="glararan" date="1377704361"]
      And small question on end. When I use grayscale, which QImage format is should be? RGBA-bits(ex. RGBA32)?[/quote]
      IMHO QImage::Format_Indexed8 with a color table of all gray shades.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • G Offline
        G Offline
        glararan
        wrote on last edited by
        #3

        Yes I want to achieve 32bit full-grayscale shades as you say.

        8-bit RGB is useless cause I can't use red, green, blue (just white and black) and more gray shades.

        QImage::Format_Indexed8 is used when I'm loading 32-bit?

        And which is best format? Tiff? Or?

        Thanks

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          gray shades are composed by RGB values for example. A gray color shade is given when the red, green and blue values are all equal.
          Qt uses 32bit integers to define RGB colors. So you have 256 possible values per color. Which also limits the gray shades to 256 possible values.

          Higher values don't make general sense for Qt as a framework it is. Since it's fairly enough for displays where 32bit and RGB is common. Meaning you wouldn't see a difference on the screen if you would have a higher grayscale-color range.

          IMHO if you need such feature you would need to create you own implementation to store the color information in a 64bit integer for example. You can check out the implementation for "qRgb() method":http://qt-project.org/doc/qt-4.8/qcolor.html#qRgb for a reference. Which also means that you would have to create your own image format then...
          Or use a external library for this special purpose (if there is one?).
          When painting you would need to convert these values to 32 RGB values then, which isn't a solution for your goal of a heightmap.

          You would need to use a colored map then to visualize your map.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • G Offline
            G Offline
            glararan
            wrote on last edited by
            #5

            Higher values are for terrain smoothing in height.

            When I will have 244-255 as 10000-11000 it will make more different height.

            What is colored map? Can you give example?

            1 Reply Last reply
            0
            • raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              [quote author="glararan" date="1377783899"]
              What is colored map? Can you give example?
              [/quote]
              I mean not gray-scaled but colored ;)
              From red to green for example. Where red is the highest possible value and green the lowest. This would give you more possible different color values than the 256 gray color shades.

              Or i think this would be also make sense:
              Depending on the zoom level you can interpolate the colors. So 256 gray shades should be enough then. When you zoom into the map you can "reuse" the colors and still be able to visualize what you want.
              Since heightmaps should visualize bigger terrains do you really need such high range of colors?

              Do you just want to display the map on the screen or also print it?

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #7

                Nevertheless what i want to say is. Even when you print the map there would be so much data compressed on such a little area that you wouldn't see a difference if the colors next to each other are different by a 1/10000 shade.

                I would go with the "dynamic approach" by adapting the color range (using 256 gray shades).

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  glararan
                  wrote on last edited by
                  #8

                  I'm working on map editor.

                  Current screen:
                  !http://www.sdilej.eu/pics/8fc6e0ecd036e7aef6854544c895fe2d.png(Map editor)!

                  I using Tessellation shader and I have maximum height at 32f which is for me very low.

                  And if I raise color from (currently png grayscale 8-bit) RGB (0, 120, 255) to RGB(0, 121, 255) I don't see a change on Terrain (I'm using own function to raise pixel on cursor position, when I'm raising about 10s terrain start changing)

                  That's why I need as much possible grayscale colors in Qt. And currently height is just 32f if I increase maximum height it will need more colors.

                  Do you understand me now?

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved