MantisBT - Open CASCADE
View Issue Details
0029528Open CASCADE[OCCT] OCCT:Visualizationpublic2018-02-28 10:442019-10-09 12:02
kgv 
bugmaster 
normalfeature 
reviewedopen 
 
[OCCT] 7.5.0* 
0029528: Visualization, TKOpenGl - allow defining sRGB textures
Most color textures are in sRGB color space, not in linear RGB color space which is used by OpenGL by default. The following changes should be done:
- Uploading color texture should be done with a flag indicating if original image is in linear RGB (GL_RGB8/GL_RGBA8) or non-linear sRGB color space (GL_SRGB8/GL_SRGB8_ALPHA8). Most 24/32-bit images are in sRGB in fact, but the choice should be done at application side. This will allow avoiding color distortion while using 24/32-bit textures.
- 24/32-bit RGB off-screen frame buffers should be creating with sRGB textures, when supported by platform. sRGB off-screen frame buffer would allow preserving more image quality (as perceived by human eye).
- GL_FRAMEBUFFER_SRGB should be enabled for proper color encoding (automatic RGB->sRGB conversion while writing values into sRGB FBO) and alpha blending operation (proper alpha blending should be done in linear RGB color space, not in sRGB).
No tags attached.
related to 0024855closed apn Open CASCADE Revision of parameters of standard materials 
related to 0030700assigned iko Open CASCADE Visualization, TKOpenGl - support PBR Metallic-Roughness shading model 
related to 0030930verified apn Open CASCADE Draw Harness, ViewerTest - add commands vlistcolors and vlistmaterials listing standard Colors and Materials 
related to 0030969reviewed bugmaster Open CASCADE Coding Rules - refactor Quantity_Color.cxx color table definition 
png mat_occt730.png (110,569) 2019-09-27 13:06
https://tracker.dev.opencascade.org/
png mat650.png (110,739) 2019-09-27 13:06
https://tracker.dev.opencascade.org/
Issue History
2018-02-28 10:44kgvNew Issue
2018-02-28 10:44kgvAssigned To => kgv
2018-10-01 07:44kgvAssigned Tokgv => mnv
2018-10-01 07:44kgvStatusnew => assigned
2018-10-01 07:57kgvRelationship addedrelated to 0030181
2019-05-07 14:24kgvRelationship addedrelated to 0030700
2019-08-13 12:04kgvTarget Version7.4.0 => 7.5.0*
2019-08-29 22:24kgvRelationship addedrelated to 0024855
2019-08-29 22:42gitNote Added: 0086541
2019-08-30 01:20gitNote Added: 0086542
2019-08-30 19:53kgvRelationship addedrelated to 0030930
2019-08-30 19:59gitNote Added: 0086559
2019-09-02 17:26gitNote Added: 0086624
2019-09-03 00:06gitNote Added: 0086674
2019-09-03 18:14gitNote Added: 0086704
2019-09-16 18:33kgvRelationship addedrelated to 0030969
2019-09-17 20:46gitNote Added: 0087224
2019-09-18 01:48gitNote Added: 0087230
2019-09-21 22:23gitNote Added: 0087402
2019-09-21 22:36gitNote Added: 0087404
2019-09-22 19:22gitNote Added: 0087430
2019-09-22 20:24gitNote Added: 0087431
2019-09-22 22:38gitNote Added: 0087432
2019-09-23 08:38gitNote Added: 0087437
2019-09-23 10:41gitNote Added: 0087443
2019-09-23 12:31gitNote Added: 0087446
2019-09-23 14:53kgvNote Added: 0087451
2019-09-23 14:53kgvAssigned Tomnv => osa
2019-09-23 14:53kgvStatusassigned => resolved
2019-09-24 10:58gitNote Added: 0087460
2019-09-24 14:01osaNote Added: 0087476
2019-09-24 14:01osaAssigned Toosa => bugmaster
2019-09-24 14:01osaStatusresolved => reviewed
2019-09-24 18:37gitNote Added: 0087493
2019-09-27 13:05kgvFile Added: materials_occt730.png
2019-09-27 13:06kgvFile Deleted: materials_occt730.png
2019-09-27 13:06kgvFile Added: mat_occt730.png
2019-09-27 13:06kgvFile Added: mat650.png
2019-10-01 15:36gitNote Added: 0087663
2019-10-04 15:48kgvRelationship addedrelated to 0031032

Notes
(0086541)
git   
2019-08-29 22:42   
Branch CR29528 has been created by kgv.

SHA-1: 0c6aed594fa53aff5a02dac7cb4294b846133ed3


Detailed log of new commits:

Author: kgv
Date: Thu Aug 29 11:04:56 2019 +0300

    0029528: Visualization, TKOpenGl - allow defining sRGB textures

Author: kgv
Date: Wed Aug 21 16:17:29 2019 +0300

    Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.

Author: kgv
Date: Wed Jul 3 11:28:26 2019 +0300

    0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes
(0086542)
git   
2019-08-30 01:20   
Branch CR29528 has been updated forcibly by kgv.

SHA-1: c0b633b6b59c3a31203d9043323266888fe97d69
(0086559)
git   
2019-08-30 19:59   
Branch CR29528 has been updated forcibly by kgv.

SHA-1: fb07e2e5cb271e173a30201e8ef0ef0d4f9e6155
(0086624)
git   
2019-09-02 17:26   
Branch CR29528 has been updated forcibly by kgv.

SHA-1: 26d1a9cf4dc7e264c7bb4bf8d9f5508d6085dfb7
(0086674)
git   
2019-09-03 00:06   
Branch CR29528_1 has been created by kgv.

SHA-1: 07a44c5fa792be51f30c1860e5cbf6bc7316a305


Detailed log of new commits:

Author: kgv
Date: Thu Aug 29 11:04:56 2019 +0300

    0029528: Visualization, TKOpenGl - allow defining sRGB textures
    
    Quantity_Color::Convert_sRGB_FromLinear(), Quantity_Color::Convert_sRGB_ToLinear()
    added auxiliary methods performing linearization / delinearization of sRGB values (gamma shift).
    
    Image_PixMap::PixelColor() and Image_PixMap::SetPixelColor() methods have been extended
    with an optional argument for performing linearization/delinearization of 8-bit sRGB pixel formats.
    
    OpenGl_TextureFormat class definition has been moved to dedicated files.
    New method OpenGl_TextureFormat::FindFormat() replaces OpenGl_Texture::GetDataFormat().
    New method OpenGl_TextureFormat::FindSizedFormat() replaces OpenGl_FrameBuffer::getColorDataFormat()
    and OpenGl_FrameBuffer::getDepthDataFormat().
    
    Graphic3d_TextureRoot::IsColorMap() - introduced new property defining
    if RGB(A)8 image formats should be loaded as sRGB(A) textures or as data RGB(A) textures.
    OpenGl_Texture initialization methods have been extended with new theIsColorMap argument.
(0086704)
git   
2019-09-03 18:14   
Branch CR29528_2 has been created by kgv.

SHA-1: 3ef6c0f2fdcb92ce3850a31c4e419249598cbd3d


Detailed log of new commits:

Author: kgv
Date: Thu Aug 29 11:04:56 2019 +0300

    0029528: Visualization, TKOpenGl - allow defining sRGB textures
    
    Quantity_Color::Convert_sRGB_FromLinear(), Quantity_Color::Convert_sRGB_ToLinear()
    added auxiliary methods performing linearization / delinearization of sRGB values (gamma shift).
    
    Image_PixMap::PixelColor() and Image_PixMap::SetPixelColor() methods have been extended
    with an optional argument for performing linearization/delinearization of 8-bit sRGB pixel formats.
    
    OpenGl_TextureFormat class definition has been moved to dedicated files.
    New method OpenGl_TextureFormat::FindFormat() replaces OpenGl_Texture::GetDataFormat().
    New method OpenGl_TextureFormat::FindSizedFormat() replaces OpenGl_FrameBuffer::getColorDataFormat()
    and OpenGl_FrameBuffer::getDepthDataFormat().
    
    Graphic3d_TextureRoot::IsColorMap() - introduced new property defining
    if RGB(A)8 image formats should be loaded as sRGB(A) textures or as data RGB(A) textures.
    OpenGl_Texture initialization methods have been extended with new theIsColorMap argument.
(0087224)
git   
2019-09-17 20:46   
Branch CR29528_nosrgb has been created by kgv.

SHA-1: 2b48f6c8e41b2da386392b5a0d16e4faa116b12c


Detailed log of new commits:

Author: kgv
Date: Tue Sep 17 20:43:15 2019 +0300

    Disable sRGB
(0087230)
git   
2019-09-18 01:48   
Branch CR29528_nosrgb has been updated forcibly by kgv.

SHA-1: 5b0911c8445ebe96faa5a44b896ece9c6e7bd5fb
(0087402)
git   
2019-09-21 22:23   
Branch CR29528_3 has been created by kgv.

SHA-1: 9ebc6264aa4c28d1f73d45bd9be65d30926ddaee


Detailed log of new commits:

Author: kgv
Date: Thu Aug 29 11:04:56 2019 +0300

    0029528: Visualization, TKOpenGl - allow defining sRGB textures
    
    Quantity_Color definition has been modified to store RGB components
    in linear color space within Quantity_TOC_RGB type.
    Standard colors defined by Quantity_NameOfColor enumeration has been updated accordingly.
    New Quantity_TOC_sRGB type has been introduced to handle RGB components in non-linear sRGB color space.
    
    OpenGl_TextureFormat class definition has been moved to dedicated files.
    New method OpenGl_TextureFormat::FindFormat() replaces OpenGl_Texture::GetDataFormat().
    New method OpenGl_TextureFormat::FindSizedFormat() replaces OpenGl_FrameBuffer::getColorDataFormat()
    and OpenGl_FrameBuffer::getDepthDataFormat().
    
    Graphic3d_TextureRoot::IsColorMap() - introduced new property defining
    if RGB(A)8 image formats should be loaded as sRGB(A) textures or as data RGB(A) textures.
    OpenGl_Texture initialization methods have been extended with new theIsColorMap argument.
    
    vreadpixel - added argument -sRGB printing color in sRGB color space.
    
    Test cases have been updated to new sRGB rendered results.
(0087404)
git   
2019-09-21 22:36   
Branch CR29528_3 has been updated forcibly by kgv.

SHA-1: 295af20259ff15adb585706a834ebe1a798ae42d
(0087430)
git   
2019-09-22 19:22   
Branch CR29528_3 has been updated forcibly by kgv.

SHA-1: 63fc0b093ed9cc26cd09f32019b844edca0e7fc5
(0087431)
git   
2019-09-22 20:24   
Branch CR29528_3 has been updated forcibly by kgv.

SHA-1: 190b8d0968dfdc6efb713ee71b07eb4f6786aaff
(0087432)
git   
2019-09-22 22:38   
Branch CR29528_3_pow has been created by kgv.

SHA-1: 944b4c370e388d0844b5e84775e5081d827322a6


Detailed log of new commits:

Author: kgv
Date: Sun Sep 22 22:34:58 2019 +0300

    Convert_LinearRGB_To_sRGB() - try Pow() instead of powf()
(0087437)
git   
2019-09-23 08:38   
Branch CR29528_3_pow has been updated forcibly by kgv.

SHA-1: 117bc96f3aed4675972abfb277af396b78497391
(0087443)
git   
2019-09-23 10:41   
Branch CR29528_3_pow has been updated forcibly by kgv.

SHA-1: b2ca630e7f7e7f18340903d33a9230e78ccd5407
(0087446)
git   
2019-09-23 12:31   
Branch CR29528_4 has been created by kgv.

SHA-1: 747451c1d6cc1c9d4629c9bf8526c91a4443220d


Detailed log of new commits:

Author: kgv
Date: Thu Aug 29 11:04:56 2019 +0300

    0029528: Visualization, TKOpenGl - allow defining sRGB textures
    
    OpenGL rendering is now done into sRGB framebuffer.
    OpenGl_ShaderManager::prepareStdProgramFboBlit() has been extended
    by programs resolving MSAA texture and applying gamma correction as fallbacks.
    
    Quantity_Color definition has been modified to store RGB components
    in linear color space within Quantity_TOC_RGB type.
    Standard colors defined by Quantity_NameOfColor enumeration has been updated accordingly.
    New Quantity_TOC_sRGB type has been introduced to handle RGB components in non-linear sRGB color space.
    
    OpenGl_TextureFormat class definition has been moved to dedicated files.
    New method OpenGl_TextureFormat::FindFormat() replaces OpenGl_Texture::GetDataFormat().
    New method OpenGl_TextureFormat::FindSizedFormat() replaces OpenGl_FrameBuffer::getColorDataFormat()
    and OpenGl_FrameBuffer::getDepthDataFormat().
    
    Graphic3d_TextureRoot::IsColorMap() - introduced new property defining
    if RGB(A)8 image formats should be loaded as sRGB(A) textures or as data RGB(A) textures.
    OpenGl_Texture initialization methods have been extended with new theIsColorMap argument.
    
    vreadpixel - added argument -sRGB printing color in sRGB color space.
    
    Test cases have been updated to new sRGB rendered results.

Author: kgv
Date: Mon Sep 16 23:06:38 2019 +0300

    0030969: Coding Rules - refactor Quantity_Color.cxx color table definition
    
    The table of named colors has been compressed and moved out
    from Quantity_Color.cxx into Quantity_ColorTable.pxx.
    
    Quantity_NameOfColor - grayscale enumeration values have been re-ordered to fix discontinuity.
    Duplicating colors has been merged within enumeration:
      CHARTREUSE=CHARTREUSE1, GOLD=GOLD1, GREEN=GREEN1, ORANGE=ORANGE1,
      ORANGERED=ORANGERED1, RED=RED1, TOMATO=TOMATO1, YELLOW=YELLOW1.
    Added aliases to several other common colors:
      BLUE=BLUE1, CYAN=CYAN1, LIGHTCYAN=LIGHTCYAN1, MAGENTA=MAGENTA1.
    
    Quantity_Color class definition has been cleaned to follow OCCT coding style.
    Quantity_Color now stores NCollection_Vec3<float> as class field instead of separate components.
    Removed unused class Quantity_ColorDefinitionError.
    
    New methods Quantity_Color::Convert_LinearRGB_To_sRGB() and Quantity_Color::Convert_sRGB_To_LinearRGB()
    converting RGB components from linear to non-linear sRGB colorspace and vice versa.
    Image_PixMap::PixelColor() and Image_PixMap::SetPixelColor() methods have been extended
    with an optional argument for performing linearization/delinearization of 8-bit sRGB pixel formats.
    
    Draw Harness command AISColor has been corrected to take color name instead of enumeration index.
(0087451)
kgv   
2019-09-23 14:53   
Patch is ready for review.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR29528_4-CR29528_4-KGV/ [^]
(0087460)
git   
2019-09-24 10:58   
Branch CR29528_4 has been updated forcibly by kgv.

SHA-1: 69cb382a6c24ff3dc64e215e7765a7222d071a42
(0087476)
osa   
2019-09-24 14:01   
The patch was reviewed
(0087493)
git   
2019-09-24 18:37   
Branch CR29528_4 has been updated forcibly by kgv.

SHA-1: 672345b6e06f999f3db51366d003fc8bc9dae710
(0087663)
git   
2019-10-01 15:36   
Branch CR29528_4 has been updated forcibly by kgv.

SHA-1: c89d107bee461db7d687d699e1f86735f48bb751