mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -88,6 +88,7 @@ Graphic3d_PolygonOffset.hxx
|
||||
Graphic3d_PriorityDefinitionError.hxx
|
||||
Graphic3d_RenderingMode.hxx
|
||||
Graphic3d_RenderingParams.hxx
|
||||
Graphic3d_RenderTransparentMethod.hxx
|
||||
Graphic3d_SequenceOfGroup.hxx
|
||||
Graphic3d_SequenceOfHClipPlane.hxx
|
||||
Graphic3d_SequenceOfStructure.hxx
|
||||
|
26
src/Graphic3d/Graphic3d_RenderTransparentMethod.hxx
Normal file
26
src/Graphic3d/Graphic3d_RenderTransparentMethod.hxx
Normal file
@@ -0,0 +1,26 @@
|
||||
// Created on: 2017-04-25
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Graphic3d_RenderTransparentMethod_HeaderFile
|
||||
#define _Graphic3d_RenderTransparentMethod_HeaderFile
|
||||
|
||||
//! Enumerates transparency rendering methods supported by rasterization mode.
|
||||
enum Graphic3d_RenderTransparentMethod
|
||||
{
|
||||
Graphic3d_RTM_BLEND_UNORDERED, //!< Basic blend transparency with non-commuting blend operator without sorting
|
||||
Graphic3d_RTM_BLEND_OIT //!< Weighted Blended Order-Independent Transparency with depth weight factor
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_RenderTransparentMethod_HeaderFile
|
@@ -16,9 +16,10 @@
|
||||
#ifndef _Graphic3d_RenderingParams_HeaderFile
|
||||
#define _Graphic3d_RenderingParams_HeaderFile
|
||||
|
||||
#include <Graphic3d_Mat4.hxx>
|
||||
#include <Graphic3d_RenderTransparentMethod.hxx>
|
||||
#include <Graphic3d_RenderingMode.hxx>
|
||||
#include <Graphic3d_StereoMode.hxx>
|
||||
#include <Graphic3d_Mat4.hxx>
|
||||
#include <Graphic3d_Vec4.hxx>
|
||||
|
||||
//! Helper class to store rendering parameters.
|
||||
@@ -47,6 +48,8 @@ public:
|
||||
//! Creates default rendering parameters.
|
||||
Graphic3d_RenderingParams()
|
||||
: Method (Graphic3d_RM_RASTERIZATION),
|
||||
TransparencyMethod (Graphic3d_RTM_BLEND_UNORDERED),
|
||||
OitDepthFactor (0.0f),
|
||||
NbMsaaSamples (0),
|
||||
RenderResolutionScale (1.0f),
|
||||
// ray tracing parameters
|
||||
@@ -90,39 +93,40 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
|
||||
Standard_Integer NbMsaaSamples; //!< number of MSAA samples (should be within 0..GL_MAX_SAMPLES, power-of-two number), 0 by default
|
||||
Standard_ShortReal RenderResolutionScale; //!< rendering resolution scale factor, 1 by default;
|
||||
//! incompatible with MSAA (e.g. NbMsaaSamples should be set to 0)
|
||||
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
|
||||
Graphic3d_RenderTransparentMethod TransparencyMethod; //!< specifies rendering method for transparent graphics
|
||||
Standard_ShortReal OitDepthFactor; //!< scalar factor [0-1] controlling influence of depth of a fragment to its final coverage
|
||||
Standard_Integer NbMsaaSamples; //!< number of MSAA samples (should be within 0..GL_MAX_SAMPLES, power-of-two number), 0 by default
|
||||
Standard_ShortReal RenderResolutionScale; //!< rendering resolution scale factor, 1 by default;
|
||||
//! incompatible with MSAA (e.g. NbMsaaSamples should be set to 0)
|
||||
|
||||
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
|
||||
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
|
||||
Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default
|
||||
Standard_Boolean IsShadowEnabled; //!< enables/disables shadows rendering, True by default
|
||||
Standard_Boolean IsReflectionEnabled; //!< enables/disables specular reflections, False by default
|
||||
Standard_Boolean IsAntialiasingEnabled; //!< enables/disables adaptive anti-aliasing, False by default
|
||||
Standard_Boolean IsTransparentShadowEnabled; //!< enables/disables light propagation through transparent media, False by default
|
||||
Standard_Boolean UseEnvironmentMapBackground; //!< enables/disables environment map background
|
||||
Standard_Boolean CoherentPathTracingMode; //!< enables/disables 'coherent' tracing mode (single RNG seed within 16x16 image blocks)
|
||||
Standard_Boolean AdaptiveScreenSampling; //!< enables/disables adaptive screen sampling mode for path tracing, FALSE by default
|
||||
Standard_Boolean ShowSamplingTiles; //!< enables/disables debug mode for adaptive screen sampling, FALSE by default
|
||||
Standard_Boolean TwoSidedBsdfModels; //!< forces path tracing to use two-sided versions of original one-sided scattering models
|
||||
Standard_ShortReal RadianceClampingValue; //!< maximum radiance value used for clamping radiance estimation.
|
||||
Standard_Boolean RebuildRayTracingShaders; //!< forces rebuilding ray tracing shaders at the next frame
|
||||
Standard_Integer NbRayTracingTiles; //!< total number of screen tiles used in adaptive sampling mode (PT only)
|
||||
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
|
||||
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
|
||||
Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default
|
||||
Standard_Boolean IsShadowEnabled; //!< enables/disables shadows rendering, True by default
|
||||
Standard_Boolean IsReflectionEnabled; //!< enables/disables specular reflections, False by default
|
||||
Standard_Boolean IsAntialiasingEnabled; //!< enables/disables adaptive anti-aliasing, False by default
|
||||
Standard_Boolean IsTransparentShadowEnabled; //!< enables/disables light propagation through transparent media, False by default
|
||||
Standard_Boolean UseEnvironmentMapBackground; //!< enables/disables environment map background
|
||||
Standard_Boolean CoherentPathTracingMode; //!< enables/disables 'coherent' tracing mode (single RNG seed within 16x16 image blocks)
|
||||
Standard_Boolean AdaptiveScreenSampling; //!< enables/disables adaptive screen sampling mode for path tracing, FALSE by default
|
||||
Standard_Boolean ShowSamplingTiles; //!< enables/disables debug mode for adaptive screen sampling, FALSE by default
|
||||
Standard_Boolean TwoSidedBsdfModels; //!< forces path tracing to use two-sided versions of original one-sided scattering models
|
||||
Standard_ShortReal RadianceClampingValue; //!< maximum radiance value used for clamping radiance estimation.
|
||||
Standard_Boolean RebuildRayTracingShaders; //!< forces rebuilding ray tracing shaders at the next frame
|
||||
Standard_Integer NbRayTracingTiles; //!< total number of screen tiles used in adaptive sampling mode (PT only)
|
||||
|
||||
Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
|
||||
Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
|
||||
Graphic3d_Mat4 AnaglyphLeft; //!< left anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
|
||||
Graphic3d_Mat4 AnaglyphRight; //!< right anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
|
||||
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
|
||||
|
||||
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
|
||||
//! (when defined in screen-space units rather than in 3D) to be properly displayed
|
||||
//! on device (screen / printer). 72 is default value.
|
||||
//! Note that using difference resolution in different Views in same Viewer
|
||||
//! will lead to performance regression (for example, text will be recreated every time).
|
||||
Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
|
||||
Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
|
||||
Graphic3d_Mat4 AnaglyphLeft; //!< left anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
|
||||
Graphic3d_Mat4 AnaglyphRight; //!< right anaglyph filter (in normalized colorspace), Color = AnaglyphRight * theColorRight + AnaglyphLeft * theColorLeft;
|
||||
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
|
||||
|
||||
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
|
||||
//! (when defined in screen-space units rather than in 3D) to be properly displayed
|
||||
//! on device (screen / printer). 72 is default value.
|
||||
//! Note that using difference resolution in different Views in same Viewer
|
||||
//! will lead to performance regression (for example, text will be recreated every time).
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_RenderingParams_HeaderFile
|
||||
|
@@ -25,6 +25,8 @@ enum Graphic3d_TypeOfLimit
|
||||
Graphic3d_TypeOfLimit_HasRayTracing, //!< indicates whether ray tracing is supported
|
||||
Graphic3d_TypeOfLimit_HasRayTracingTextures, //!< indicates whether ray tracing textures are supported
|
||||
Graphic3d_TypeOfLimit_HasRayTracingAdaptiveSampling, //!< indicates whether adaptive screen sampling is supported
|
||||
Graphic3d_TypeOfLimit_HasBlendedOit, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (without MSAA).
|
||||
Graphic3d_TypeOfLimit_HasBlendedOitMsaa, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (with MSAA).
|
||||
Graphic3d_TypeOfLimit_NB //!< number of elements in this enumeration
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user