mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0027925: Visualization - implement order-independent transparency algorithm within rasterization rendering
Weighted, Blended Order-Independent Transparency algorithm has been added rasterization pipeline. In contrast to classical blending transparency it makes transparent objects look independent from point of view. It also gives better depth occlusion when being used together with a weight factor based on value of a GL depth buffer. The feature supports desktop OpenGL, OpenGL ES 3.0, ANGLE and can be used together with MSAA on desktop GL. To be used it require availability of: 1) Shaders pipeline. 2) Floating point color format for framebuffer (GL_ARB_color_buffer_float). 3) Multiple render targets (GL_ARB_draw_buffers). Patch does not modify API and does not require application porting. It adds new rendering options to Graphic3d_RenderingParams structure: a) Transparency method from enumeration. b) Scalar factor [0-1] controlling influence of a fragment's depth to its visibility. Patch also simplifies processing of transparent objects for standard method: rendering priority of transparent graphical structures is managed automatically, therefore there is no need to care about it at application's side.
This commit is contained in:
@@ -351,7 +351,8 @@ protected: //! @name low-level redrawing sub-routines
|
||||
|
||||
//! Redraws view for the given monographic camera projection, or left/right eye.
|
||||
Standard_EXPORT virtual void redraw (const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo);
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo);
|
||||
|
||||
//! Redraws view for the given monographic camera projection, or left/right eye.
|
||||
//!
|
||||
@@ -368,6 +369,7 @@ protected: //! @name low-level redrawing sub-routines
|
||||
Standard_EXPORT virtual bool redrawImmediate (const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadFbo,
|
||||
OpenGl_FrameBuffer* theDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theIsPartialUpdate = Standard_False);
|
||||
|
||||
//! Blit image from/to specified buffers.
|
||||
@@ -383,17 +385,21 @@ protected: //! @name Rendering of GL graphics (with prepared drawing buffer).
|
||||
//! Renders the graphical contents of the view into the preprepared window or framebuffer.
|
||||
//! @param theProjection [in] the projection that should be used for rendering.
|
||||
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
|
||||
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
|
||||
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
|
||||
Standard_EXPORT virtual void render (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
//! Renders the graphical scene.
|
||||
//! @param theProjection [in] the projection that is used for rendering.
|
||||
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
|
||||
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
|
||||
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
|
||||
Standard_EXPORT virtual void renderScene (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
//! Draw background (gradient / image)
|
||||
@@ -402,9 +408,11 @@ protected: //! @name Rendering of GL graphics (with prepared drawing buffer).
|
||||
//! Render set of structures presented in the view.
|
||||
//! @param theProjection [in] the projection that is used for rendering.
|
||||
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
|
||||
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
|
||||
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
|
||||
Standard_EXPORT virtual void renderStructs (Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
OpenGl_FrameBuffer* theOitAccumFbo,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
//! Renders trihedron.
|
||||
@@ -444,6 +452,15 @@ private:
|
||||
//! Blend together views pair into stereo image.
|
||||
void drawStereoPair (OpenGl_FrameBuffer* theDrawFbo);
|
||||
|
||||
//! Check and update OIT compatibility with current OpenGL context's state.
|
||||
bool checkOitCompatibility (const Handle(OpenGl_Context)& theGlContext,
|
||||
const Standard_Boolean theMSAA);
|
||||
|
||||
//! Chooses compatible internal color format for OIT frame buffer.
|
||||
bool chooseOitColorConfiguration (const Handle(OpenGl_Context)& theGlContext,
|
||||
const Standard_Integer theConfigIndex,
|
||||
OpenGl_ColorFormats& theFormats);
|
||||
|
||||
protected:
|
||||
|
||||
OpenGl_GraphicDriver* myDriver;
|
||||
@@ -497,13 +514,18 @@ protected: //! @name Rendering properties
|
||||
//! of the view (without presentation of immediate layers).
|
||||
GLint myFboColorFormat; //!< sized format for color attachments
|
||||
GLint myFboDepthFormat; //!< sized format for depth-stencil attachments
|
||||
OpenGl_ColorFormats myFboOitColorConfig; //!< selected color format configuration for OIT color attachments
|
||||
Handle(OpenGl_FrameBuffer) myMainSceneFbos[2];
|
||||
Handle(OpenGl_FrameBuffer) myImmediateSceneFbos[2]; //!< Additional buffers for immediate layer in stereo mode.
|
||||
Handle(OpenGl_FrameBuffer) myMainSceneFbosOit[2]; //!< Additional buffers for transparent draw of main layer.
|
||||
Handle(OpenGl_FrameBuffer) myImmediateSceneFbos[2]; //!< Additional buffers for immediate layer in stereo mode.
|
||||
Handle(OpenGl_FrameBuffer) myImmediateSceneFbosOit[2]; //!< Additional buffers for transparency draw of immediate layer.
|
||||
OpenGl_VertexBuffer myFullScreenQuad; //!< Vertices for full-screen quad rendering.
|
||||
OpenGl_VertexBuffer myFullScreenQuadFlip;
|
||||
Standard_Boolean myToFlipOutput; //!< Flag to draw result image upside-down
|
||||
unsigned int myFrameCounter; //!< redraw counter, for debugging
|
||||
Standard_Boolean myHasFboBlit; //!< disable FBOs on failure
|
||||
Standard_Boolean myToDisableOIT; //!< disable OIT on failure
|
||||
Standard_Boolean myToDisableOITMSAA; //!< disable OIT with MSAA on failure
|
||||
Standard_Boolean myToDisableMSAA; //!< disable MSAA after failure
|
||||
Standard_Boolean myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
|
||||
Standard_Boolean myBackBufferRestored;
|
||||
@@ -1045,6 +1067,7 @@ public:
|
||||
|
||||
friend class OpenGl_GraphicDriver;
|
||||
friend class OpenGl_Workspace;
|
||||
friend class OpenGl_LayerList;
|
||||
};
|
||||
|
||||
#endif // _OpenGl_View_Header
|
||||
|
Reference in New Issue
Block a user