MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0026711Open CASCADE[OCCT] OCCT:Visualizationpublic2015-09-19 16:152017-04-02 16:50
Reporterkgv 
Assigned Tobugmaster 
PrioritynormalSeverityfeature 
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.0.0Fixed in Version[OCCT] 7.0.0 
Summary0026711: Visualization, TKOpenGl - support creation of multisampling off-screen FBOs
DescriptionIt is desirable to support creation of FBOs with multisampling textures.

See:
https://www.opengl.org/wiki/Multisampling [^]
Steps To Reproduce
pload MODELING VISUALIZATION
box b 2 3 1
vclear
vclose ALL
vinit View1 w=512 h=512
vdisplay b
vfit
vrotate 0.5 0 0
vrenderparams -msaa 8
TagsNo tags attached.
Test case numberv3d glsl msaa
Attached Filespng file icon penrose_msaa_off.png (48,006 bytes) 2015-09-19 19:04
png file icon penrose_msaa_8.png (49,133 bytes) 2015-09-19 19:04

- Relationships
parent of 0026834closedbugmaster Open CASCADE Visualization, OpenGl_FrameBuffer - use GL_DEPTH_COMPONENT instead of GL_DEPTH for texture initialization 
parent of 0028615closedbugmaster Open CASCADE Visualization, TKOpenGl - enabling MSAA leads to black screen on OpenGL ES 
has duplicate 0026756closedbugmaster Community Antialiasing cannot be controlled anymore by graphics driver 
related to 0024324closedbugmaster Community Antialiasing exposes triangulation edges [on NVIDIA] 
related to 0027360closedbugmaster Open CASCADE Visualization - remove obsolete anti-aliasing API 
related to 0027606closedbugmaster Community Visualization - view is blocking when MSAA has been overridden in graphics driver settings 
related to 0027755closedbugmaster Open CASCADE Visualization, V3d_View::ToPixMap() - fix image dump with MSAA turned on 

-  Notes
(0045932)
git (administrator)
2015-09-19 16:46

Branch CR26711 has been created by kgv.

SHA-1: 1d10df3a20507824fb8e7cce431f4ad6f907c34d


No new revisions were added by this update.
(0045935)
git (administrator)
2015-09-19 18:56

Branch CR26711 has been updated forcibly by kgv.

SHA-1: 454b6834af8e898899efd1b337693ea3cf7d0076
(0046716)
kgv (developer)
2015-10-14 10:51

// GLSL Fragment shader resolving MSAA buffer into normal buffer
uniform sampler2DMS uColorSampler;
uniform sampler2DMS uDepthSampler;

int main(void)
{
  // only integer coordinates can be used to fetch from sampler2DMS
  ivec2 aTexCoord = ivec2 (int(gl_FragCoord.x), int(gl_FragCoord.y));

  // fetch depth from the first sample - simple blending is not applicable
  gl_FragDepth = texelFetch (uDepthSampler, aTexCoord, 0).r;"

  // compute average color
  vec3 aColor (0.0, 0.0, 0.0);
  for (int aSample = 0; aSample < THE_NB_SAMPLES; ++aSample)
  {
    aColor += texelFetch (uColorSampler, aTexCoord, aSample).rgb;
  }
  occFragColor = vec4 (aColor / THE_NB_SAMPLES, 1.0);


// GLSL Fragment shader for blitting from one MSAA buffer
// to another one of the same size.
// Uses gl_SampleID variable which forces shader to be executed for each sample individually.
// This vaiable is available in OpenGL 4.0+ and OpenGL ES 3.2+
// or on lower versions with extensions
// GL_ARB_sample_shading and GL_OES_sample_variables.
#version 150
#extension GL_ARB_sample_shading : enable
// or just #version 400

/*
#version 300 es
#extension GL_OES_sample_variables
// or just #version 320 es
*/

uniform sampler2DMS uColorSampler;
uniform sampler2DMS uDepthSampler;

int main(void)
{
  // only integer coordinates can be used to fetch from sampler2DMS
  ivec2 aTexCoord = ivec2 (int(gl_FragCoord.x), int(gl_FragCoord.y));

  gl_FragDepth = texelFetch (uDepthSampler, aTexCoord, gl_SampleID).r;"
  occFragColor = texelFetch (uColorSampler, aTexCoord, gl_SampleID);"
(0046717)
kgv (developer)
2015-10-14 10:55

Conservative Morphological Anti-Aliasing (CMAA) can be used as alternative to MSAA and FXAA algorithms, see:
- OpenGL extension GL_INTEL_framebuffer_CMAA.
  https://www.khronos.org/registry/gles/extensions/INTEL/framebuffer_CMAA.txt [^]
- Article describing the algorithm.
  https://software.intel.com/en-us/articles/conservative-morphological-anti-aliasing-cmaa-update [^]

However at the moment it seems there no OpenGL driver implementing this extension yet.
(0046718)
kgv (developer)
2015-10-14 11:01

OpenGL ES extension GL_EXT_multisampled_render_to_texture is an alternative to traditional MSAA available on some mobile devices.

Some GPU architectures - such as tile-based renderers - are capable of performing multisampled rendering by storing multisample data in internal high-speed memory and downsampling the data when writing out to external memory after rendering has finished.

Since per-sample data is never written out to external memory, this approach saves bandwidth and storage space.

https://www.khronos.org/registry/gles/extensions/EXT/EXT_multisampled_render_to_texture.txt [^]
(0046719)
kgv (developer)
2015-10-14 11:19

The following issues have been observed within implementation:
- Radeon HD 6450 on Windows 7 + AMD Catalyst 15.7 fails to blit between to identical MSAA depth buffers using glBlitFramebuffer(). Debug context emits erroneous message: "glBlitFramebuffer was called with either GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT set while there was no valid depth/stencil attachment on the read framebuffer".
- Redeon R9 290 on Linux + Mesa (RadeonSI) fails to resolve MSAA FBO to screen buffer using glBlitFramebuffer() when color buffers do not match due to alpha channel (e.g. window buffer is RGB8 and FBO is RGBA8).
- RayTracing GLSL programs can no be trivially adapted to use MSAA, because of reading from uOpenGlColorTexture and uOpenGlDepthTexture. Using gl_SampleID within RayTracing core would make evaluation of entire shader per-sample, performing expensive super-sampling rather than lazy multi-sampling. It should be considered to reorganize combining of RayTracing and OpenGL Rasterization to avoid reading from OpenGL Rasterization buffers (write depth value and color as is and rely on fixed functionality for blending colors).
(0046728)
kgv (developer)
2015-10-14 12:16
edited on: 2015-10-14 12:22

Current list of FBOs in OpenGl_View with description:
//! GL_RGBA8, off-screen dump
myFBO;

//! GL_RGBA8, FBOs (Left + Right) containing main scene content.
myMainSceneFbos[2];

//! GL_RGBA8, additional buffers for immediate layer in stereo mode.
myImmediateSceneFbos[2];

//! GL_RGBA32F, either FSAA buffers
//! (for RayTracing, does not actually require higher precision)
//! or PathTracing accumulation buffers (require extra precision).
myRaytraceFBO1;
myRaytraceFBO2;

//! GL_RGBA8, additional FBO used as texture containing OpenGL Rasterization to be fetched within RayTracing 
core.
myOpenGlFBO


(0046740)
git (administrator)
2015-10-14 15:26

Branch CR26711_1 has been created by kgv.

SHA-1: f691f053277613e52f307f466e43d06d4a38223e


Detailed log of new commits:

Author: kgv
Date: Wed Oct 14 15:26:28 2015 +0300

    0026711: Visualization, TKOpenGl - support creation of multisampling off-screen FBOs
    
    OpenGl_Texture::Init2DMultisample() - new method to initialize multisampled texture.
    Graphic3d_RenderingParams::NbMsaaSamples - add option defining MSAA samples number.
    
    RayTracing will keep using FBO without MSAA, however it is possible to combine
    MSAA for rasterization and FSAA for RayTracing.
    
    OpenGl_FrameBuffer constructor has been changed to do not take arguments.
    OpenGl_FrameBuffer::Init() method has been extended with mandatory parameters
    defining Color and Depth attachment formats
    and optional parameter defining number of MSAA parameters.
    
    Draw Harness, add option -msaa to vrenderparams.
(0046742)
git (administrator)
2015-10-14 15:39

Branch CR26711_1 has been updated forcibly by kgv.

SHA-1: 8be893e9a141467263bc035c31b2a698a5170175
(0046743)
kgv (developer)
2015-10-14 15:41

Patch is ready for review.
(0047241)
san (developer)
2015-10-20 19:50

Branch CR26711_1 reviewed without remarks, ready for testing.
(0047243)
mkv (tester)
2015-10-20 20:30

Dear kgv,
could you please rebase branch CR26711_1 on current master, there are conflict files.
(0047244)
git (administrator)
2015-10-20 20:43

Branch CR26711_1 has been updated forcibly by kgv.

SHA-1: 5ca942863a4415e19111ccde871ca4c460222e97
(0047245)
kgv (developer)
2015-10-20 20:44

Dear mkv,

branch has been rebased onto current master.
There have not been any merge conflicts.
(0047265)
mkv (tester)
2015-10-21 12:59

Dear BugMaster,
Branch CR26711_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 5ca942863a4415e19111ccde871ca4c460222e97

There are following compilation errors:

Windows:
http://jenkins-test-01.nnov.opencascade.com:8080/view/CR26711-1-master/job/CR26711-1-master_build_occt_windows_64/1/parsed_console/ [^]
95>d:\builds\vc10\cr26711-1-master-occt-64\inc\opengl_framebuffer.hxx(126): error C4716: 'OpenGl_FrameBuffer::InitLazy' : must return a value

Number of compiler warnings:

occt component :
Linux: 12 (8 on master)

products component :
Linux: 39 (39 on master)

There is new additional compilation warning on Linux platform:
http://jenkins-test-01.nnov.opencascade.com:8080/user/mnt/my-views/view/A_mnt_warnings/portlet/dashboard_portlet_17008/job/CR26711-1-master_build_occt_linux/1/warnings17Result/package.-133837126/ [^]
OpenGl_View.cxx:54, GNU C Compiler 4 (gcc), Priority: Normal
when initialized here [-Wreorder]

http://jenkins-test-01.nnov.opencascade.com:8080/user/mnt/my-views/view/A_mnt_warnings/portlet/dashboard_portlet_17008/job/CR26711-1-master_build_occt_linux/1/warnings17Result/package.-671474530/ [^]
OpenGl_FrameBuffer.hxx:126, GNU C Compiler 4 (gcc), Priority: Normal
no return statement in function returning non-void [-Wreturn-type]
OpenGl_View.hxx:605, GNU C Compiler 4 (gcc), Priority: Normal
'GLint OpenGl_View::myFboColorFormat' [-Wreorder]
OpenGl_View.hxx:611, GNU C Compiler 4 (gcc), Priority: Normal
'OpenGl_View::myToFlipOutput' will be initialized after [-Wreorder]
(0047266)
mkv (tester)
2015-10-21 13:00

Dear kgv,
Branch CR26711_1 has been rejected due to:
- compilation errors
- additional warnings
(0047301)
git (administrator)
2015-10-21 19:04

Branch CR26711_1 has been updated by kgv.

SHA-1: 021202b77816ca483fb4a7dad65359b7553c1342


Detailed log of new commits:

Author: kgv
Date: Wed Oct 21 19:04:46 2015 +0300

    fix compilation issues

(0047302)
git (administrator)
2015-10-21 19:06

Branch CR26711_2 has been created by kgv.

SHA-1: 905d3c5a413528f451c0b5776c491af3e3bb1d5c


Detailed log of new commits:

Author: kgv
Date: Wed Oct 21 19:06:02 2015 +0300

    0026711: Visualization, TKOpenGl - support creation of multisampling off-screen FBOs
    
    OpenGl_Texture::Init2DMultisample() - new method to initialize multisampled texture.
    Graphic3d_RenderingParams::NbMsaaSamples - add option defining MSAA samples number.
    
    RayTracing will keep using FBO without MSAA, however it is possible to combine
    MSAA for rasterization and FSAA for RayTracing.
    
    OpenGl_FrameBuffer constructor has been changed to do not take arguments.
    OpenGl_FrameBuffer::Init() method has been extended with mandatory parameters
    defining Color and Depth attachment formats
    and optional parameter defining number of MSAA parameters.
    
    Draw Harness, add option -msaa to vrenderparams.
(0047303)
kgv (developer)
2015-10-21 19:06

Please test updated patch from branch CR26711_2.
(0047347)
mkv (tester)
2015-10-22 17:49

Dear kgv,
could you please rebase branch CR26711_2 on IR-2015-10-22, there are conflict files.
(0047349)
git (administrator)
2015-10-22 18:23

Branch CR26711_3 has been created by kgv.

SHA-1: 1eae662e547d34d2e83d82beb71c3c2d9e23ee83


Detailed log of new commits:

Author: kgv
Date: Wed Oct 21 19:06:02 2015 +0300

    0026711: Visualization, TKOpenGl - support creation of multisampling off-screen FBOs
    
    OpenGl_Texture::Init2DMultisample() - new method to initialize multisampled texture.
    Graphic3d_RenderingParams::NbMsaaSamples - add option defining MSAA samples number.
    
    RayTracing will keep using FBO without MSAA, however it is possible to combine
    MSAA for rasterization and FSAA for RayTracing.
    
    OpenGl_FrameBuffer constructor has been changed to do not take arguments.
    OpenGl_FrameBuffer::Init() method has been extended with mandatory parameters
    defining Color and Depth attachment formats
    and optional parameter defining number of MSAA parameters.
    
    Draw Harness, add option -msaa to vrenderparams.
(0047350)
kgv (developer)
2015-10-22 18:24

Please test rebased patch in branch CR26711_3.
(0047439)
mkv (tester)
2015-10-26 14:26

Dear BugMaster,
Branch CR26711_3 was rebased on branch IR-2015-10-22 of occt git-repository.
SHA-1: 1eae662e547d34d2e83d82beb71c3c2d9e23ee83
(0047440)
mkv (tester)
2015-10-26 14:26

Dear BugMaster,
Branch CR26711_3 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 1eae662e547d34d2e83d82beb71c3c2d9e23ee83

Number of compiler warnings:

occt component :
Linux: 1 (1 on master)
Windows: 0 (0 on master)

products component :
Linux: 39 (39 on master)
Windows: 0 (0 on master)

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR26711-3-master-occt-64/Debian70-64/v3d/glsl/msaa.html [^]
http://occt-tests/CR26711-3-master-occt-64/Windows-64-VC10/v3d/glsl/msaa.html [^]
v3d glsl msaa: OK

Testing on Linux:
occt component :
Total MEMORY difference: 92314267 / 92336834 [-0.02%]
Total CPU difference: 19748.929999999793 / 19731.589999999687 [+0.09%]
products component :
Total MEMORY difference: 26175596 / 26216391 [-0.16%]
Total CPU difference: 7404.779999999986 / 7362.230000000012 [+0.58%]

Testing on Windows:
occt component :
Total MEMORY difference: 58075754 / 58088905 [-0.02%]
Total CPU difference: 18238.513712798926 / 18494.667354799 [-1.39%]
products component :
Total MEMORY difference: 17128002 / 17132478 [-0.03%]
Total CPU difference: 5526.741027599959 / 5651.245425699974 [-2.20%]

There are no differences in images found by testdiff.
(0047441)
mkv (tester)
2015-10-26 14:27

Dear BugMaster,
Branch CR26711_3 is TESTED.
(0053198)
git (administrator)
2016-04-17 14:35

Branch CR26711 has been deleted by kgv.

SHA-1: 454b6834af8e898899efd1b337693ea3cf7d0076
(0053199)
git (administrator)
2016-04-17 14:35

Branch CR26711_1 has been deleted by kgv.

SHA-1: 021202b77816ca483fb4a7dad65359b7553c1342
(0053200)
git (administrator)
2016-04-17 14:35

Branch CR26711_2 has been deleted by kgv.

SHA-1: 905d3c5a413528f451c0b5776c491af3e3bb1d5c
(0053201)
git (administrator)
2016-04-17 14:35

Branch CR26711_3 has been deleted by kgv.

SHA-1: 1eae662e547d34d2e83d82beb71c3c2d9e23ee83

- Related Changesets
occt: master 3c4b62a4
Timestamp: 2015-10-21 16:06:02
Author: kgv
Committer: bugmaster
Details ] Diff ]
0026711: Visualization, TKOpenGl - support creation of multisampling off-screen FBOs

OpenGl_Texture::Init2DMultisample() - new method to initialize multisampled texture.
Graphic3d_RenderingParams::NbMsaaSamples - add option defining MSAA samples number.

RayTracing will keep using FBO without MSAA, however it is possible to combine
MSAA for rasterization and FSAA for RayTracing.

OpenGl_FrameBuffer constructor has been changed to do not take arguments.
OpenGl_FrameBuffer::Init() method has been extended with mandatory parameters
defining Color and Depth attachment formats
and optional parameter defining number of MSAA parameters.

Draw Harness, add option -msaa to vrenderparams.
mod - src/Graphic3d/Graphic3d_RenderingParams.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_Context.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_Context.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_FrameBuffer.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_FrameBuffer.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_GlFunctions.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_Texture.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_Texture.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_View.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_View.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_View_Print.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_View_Raytrace.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_View_Redraw.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_Window_1.mm Diff ] File ]
mod - src/OpenGl/OpenGl_Workspace.cxx Diff ] File ]
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff ] File ]
add - tests/v3d/glsl/msaa Diff ] File ]

- Issue History
Date Modified Username Field Change
2015-09-19 16:15 kgv New Issue
2015-09-19 16:15 kgv Assigned To => kgv
2015-09-19 16:46 git Note Added: 0045932
2015-09-19 18:56 git Note Added: 0045935
2015-09-19 19:04 kgv File Added: penrose_msaa_off.png
2015-09-19 19:04 kgv File Added: penrose_msaa_8.png
2015-10-07 15:52 kgv Relationship added has duplicate 0026756
2015-10-14 10:51 kgv Note Added: 0046716
2015-10-14 10:55 kgv Note Added: 0046717
2015-10-14 10:56 kgv Description Updated View Revisions
2015-10-14 11:01 kgv Note Added: 0046718
2015-10-14 11:19 kgv Note Added: 0046719
2015-10-14 12:16 kgv Note Added: 0046728
2015-10-14 12:22 kgv Note Edited: 0046728 View Revisions
2015-10-14 15:26 git Note Added: 0046740
2015-10-14 15:28 kgv Steps to Reproduce Updated View Revisions
2015-10-14 15:39 git Note Added: 0046742
2015-10-14 15:41 kgv Note Added: 0046743
2015-10-14 15:41 kgv Assigned To kgv => san
2015-10-14 15:41 kgv Status new => resolved
2015-10-20 19:50 san Note Added: 0047241
2015-10-20 19:50 san Assigned To san => bugmaster
2015-10-20 19:50 san Status resolved => reviewed
2015-10-20 20:17 mkv Assigned To bugmaster => mkv
2015-10-20 20:30 mkv Note Added: 0047243
2015-10-20 20:30 mkv Assigned To mkv => kgv
2015-10-20 20:30 mkv Status reviewed => feedback
2015-10-20 20:43 git Note Added: 0047244
2015-10-20 20:44 kgv Note Added: 0047245
2015-10-20 20:44 kgv Assigned To kgv => bugmaster
2015-10-20 20:44 kgv Status feedback => reviewed
2015-10-20 20:48 mkv Assigned To bugmaster => mkv
2015-10-21 12:59 mkv Note Added: 0047265
2015-10-21 13:00 mkv Note Added: 0047266
2015-10-21 13:00 mkv Assigned To mkv => kgv
2015-10-21 13:00 mkv Status reviewed => assigned
2015-10-21 19:04 git Note Added: 0047301
2015-10-21 19:06 git Note Added: 0047302
2015-10-21 19:06 kgv Note Added: 0047303
2015-10-21 19:06 kgv Assigned To kgv => bugmaster
2015-10-21 19:06 kgv Status assigned => resolved
2015-10-21 19:06 kgv Status resolved => reviewed
2015-10-22 14:43 mkv Assigned To bugmaster => mkv
2015-10-22 17:49 mkv Note Added: 0047347
2015-10-22 17:49 mkv Assigned To mkv => kgv
2015-10-22 17:49 mkv Status reviewed => feedback
2015-10-22 18:23 git Note Added: 0047349
2015-10-22 18:24 kgv Note Added: 0047350
2015-10-22 18:24 kgv Assigned To kgv => bugmaster
2015-10-22 18:24 kgv Status feedback => reviewed
2015-10-22 19:31 mkv Assigned To bugmaster => mkv
2015-10-26 14:26 mkv Note Added: 0047439
2015-10-26 14:26 mkv Note Added: 0047440
2015-10-26 14:27 mkv Note Added: 0047441
2015-10-26 14:27 mkv Assigned To mkv => bugmaster
2015-10-26 14:27 mkv Status reviewed => tested
2015-10-26 14:27 mkv Test case number => v3d glsl msaa
2015-10-30 16:00 bugmaster Changeset attached => occt master 3c4b62a4
2015-10-30 16:00 bugmaster Status tested => verified
2015-10-30 16:00 bugmaster Resolution open => fixed
2015-11-02 17:49 kgv Relationship added parent of 0026834
2016-04-06 12:18 san Relationship added related to 0024324
2016-04-06 12:34 san Relationship added related to 0027360
2016-04-17 14:35 git Note Added: 0053198
2016-04-17 14:35 git Note Added: 0053199
2016-04-17 14:35 git Note Added: 0053200
2016-04-17 14:35 git Note Added: 0053201
2016-04-20 15:42 aiv Fixed in Version => 7.0.0
2016-04-20 15:51 aiv Status verified => closed
2016-06-16 11:52 kgv Relationship added related to 0027606
2016-08-01 19:00 san Relationship added related to 0027625
2016-08-09 10:12 kgv Relationship added related to 0027755
2017-04-02 16:50 kgv Relationship added parent of 0028615


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker