Best supported grayscale format



  • 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!


  • Moderators

    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.



  • 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


  • Moderators

    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.



  • 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?


  • Moderators

    [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?


  • Moderators

    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).



  • 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?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.