Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029902Open CASCADE[OCCT] OCCT:Data Exchangepublic2018-06-28 11:582019-09-04 15:54
Assigned Tokgv 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.5.0*Fixed in Version 
Summary0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes
DescriptionXCAF defines a structure XCAFPrs_Style accumulating visual properties:
- Surface color and transparency, RGBA;
- Curve color, RGB;
- Hidden flag, Boolean.

This structure is filled in by XCAFDoc_ColorTool from Color attributes on the Label (XCAFDoc_ColorGen, XCAFDoc_ColorSurf and XCAFDoc_ColorCurv).
The following sources in XCAF document are actually considered by XCAFPrs::CollectStyleSettings for a given Label
(in ascending order of priority, so that each next item in the list overrides previous one, when both defined):
- Reference Label (Product Label for a given Instance Label);
- Components (for a given Label to an Assembly);
- Layer, where the Label is defined on, if any (using XCAFDoc_LayerTool);
- SHUO structures;
- Label itself;
- Sub-shape Labels.

XCAF structure also considers that sub-entity (Component) inherits a Style of a parent object (Assembly) in the Tree (if Style is not defined for sub-shape).
So that XCAFPrs::CollectStyleSettings() will return an incomplete map when called for a Component without own Style (considering parent Assembly object defines a Style).

In practice, this obscure behavior of XCAFPrs::CollectStyleSettings() may happen only for application-based XCAF document, because within STEP and IGES translators such definition is not possible (and therefore, it is preferred that application would not define such XCAF document to avoid problems with Data Exchange and make Style deduction straight-forward).

There are, however, a context, where existing Style definition is not enough for defining visual properties.
The following attributes are missing for preserving visual properties in 3D Viewer and for Data Exchange capabilities with formats like glTF and OBJ:
1) Common Material definition
   Obsolete material definition used for T&L (Transform and lighting) shading model coming from FFP (Fixed-Function Pipeline); but also implemented via GLSL programs.
2) Metallic-Roughness definition
   Commonly used by real-time Physically-Based Rendering (PBR) engines.
3) BSDF (bidirectional scattering distribution function)
   A PBR material definition for Path-Tracing engines (as used by OCCT itself).

As a shared task across all Material definitions is introduction of Textures - references to external Image files or embedded into XCAF document.

Although only one Material definition can be used at once by Rendering engine for specific object, and Common Material definition is already obsolete, it is still desired supporting several definitions for compatibility reasons (for rendering using faster Shading Model or for Data Exchange with formats supporting one or another Material definition).

Note that extending Rendering capabilities of OCCT 3D Viewer is a dedicated task.
It might be reasonable keeping Graphic3d_MaterialAspect definition independent from XCAF types, since they are following different tasks (Data Exchange and Visualization), though this would imply some code duplication.
Relationship with XCAFPrs_Style, an auxiliary structure transferring visual properties from XCAF layer to OCCT 3D Viewer layer (XCAFPrs_AISObject) should be also examined during implementation; probably, XCAFPrs_Style should store a Handle pointing to Material definition, and existing Color attributes should behave like Graphic3d_MaterialAspect + Graphic3d_AspectFillArea3d::InteriorColor().

Materials are expected to be shared across components in the Assembly Tree, so that it makes sense splitting Materials definition and assignment in 2 parts:
- Dedicated section in the document listing all Materials (probably with a map for a fast lookup, detection of unique materials and a tool to clean up duplicates / unused Materials).
- Refer to a Material (not duplicate) at Component/Layer/Shape Label.

0) Extension to Material definition
 - enum: alphaMode
 - float: alphaCutoff
 - bool: closed primitive group of triangles (solid)
 - bool: backCulling, back face culling flag
 - texture: normalMap, RGB tangent space normal map.

1) Common Material definition
 - vec3: Ambient [Graphic3d_TOR_AMBIENT]
 - vec3: Diffuse (or vec4 considering Alpha) [Graphic3d_TOR_DIFFUSE]
 - vec3: Specular [Graphic3d_TOR_SPECULAR]
 - vec3: Emission [Graphic3d_TOR_EMISSION]
 - float: Shininess
 - float: Transparency/Alpha

2) Metallic-Roughness material
 - vec4: baseColor, base color of the material (or scale factor to the texture)
 - float: metallic, metalness of the material (or scale factor to the texture)
 - float: roughness, roughness of the material (or scale factor to the texture)
 - texture: baseColorTexture, sRGB texture for the base color
 - texture: metallicRoughnessTexture, RG texture packing the metallic and roughness properties together
 - vec3: emissiveFactor
 - texture: emissive, RGB emissive map controls the color and intensity of the light being emitted by the material.
 - texture: occlusion, R occlusion map indicating areas of indirect lighting.

3) BSDF definition [Graphic3d_BSDF]
 - vec4: Kc (Weight of coat specular/glossy BRDF)
 - vec3: Kd (Weight of base diffuse BRDF)
 - vec3: Ks (Weight of base specular/glossy BRDF)
 - vec3: Kt (Weight of base specular/glossy BTDF)
 - vec3: Le (Radiance emitted by the surface)
 - vec4: Absorption (Volume scattering color/density)
 - vec4: FresnelCoat (Parameters of Fresnel reflectance of coat layer)
 - vec4: FresnelBase (Parameters of Fresnel reflectance of base layer)
 - float RefractionIndex
TagsNo tags attached.
Test case number
Attached Files

- Relationships
related to 0023037assignedgka Community Data Exchange - support different materials and transparency in XDE 
related to 0030691verifiedbugmaster Open CASCADE Data Exchange - implement import of mesh data from files in glTF format 
related to 0030700assignediko Open CASCADE Visualization, TKOpenGl - support PBR Metallic-Roughness shading model 

-  Notes
git (administrator)
2019-07-03 11:30

Branch CR29902_0 has been created by kgv.

SHA-1: 7eb29b2a1917995a4138872f595c7e88ec332329

Detailed log of new commits:

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

    0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes
git (administrator)
2019-08-13 15:28

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 51bc6e3113c9745be338ad83e11a7d6af6c9ddc0
git (administrator)
2019-08-21 16:20

Branch CR29902_0 has been updated by kgv.

SHA-1: 5cdae2f875de2cdba6b2322ac21902cd9d26a851

Detailed log of new commits:

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

    Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.

Author: nds
Date: Thu Aug 15 13:17:18 2019 +0300

    0030901: Visualization - OSD_MemInfo moving memory computation out of the constructor

git (administrator)
2019-08-21 16:56

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: f4dac03e43701abc838a62be6b1151bfbd4ba391
git (administrator)
2019-08-22 16:46

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 6f332a357293db422ad770e4c709b4506c513b0d
git (administrator)
2019-08-22 17:27

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 163f6a67bf1a4c627001d7d69e0d2c6bcf95b50b
git (administrator)
2019-08-22 17:49

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: a553e176efb12fd2153b60975f08aef65bc4513d
git (administrator)
2019-08-22 17:55

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 058092bf77dfc2a37150bc66415b111b36425c67
git (administrator)
2019-08-26 15:34

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 3ed3d300128e0a74bcf575dd05df109605377b8f

- Issue History
Date Modified Username Field Change
2018-06-28 11:58 kgv New Issue
2018-06-28 11:58 kgv Assigned To => gka
2018-06-28 11:59 kgv Assigned To gka => kgv
2018-06-28 11:59 kgv Status new => assigned
2018-06-28 11:59 kgv Relationship added related to 0029296
2018-09-28 14:19 kgv Relationship added related to 0030171
2019-02-06 12:51 abv Relationship added related to 0023037
2019-05-05 13:15 kgv Relationship added related to 0030691
2019-05-07 14:18 kgv Relationship added related to 0030699
2019-05-07 14:22 kgv Relationship added related to 0030700
2019-07-03 11:30 git Note Added: 0085392
2019-08-13 15:28 git Note Added: 0086227
2019-08-21 16:20 git Note Added: 0086386
2019-08-21 16:56 git Note Added: 0086387
2019-08-22 16:46 git Note Added: 0086417
2019-08-22 17:27 git Note Added: 0086418
2019-08-22 17:49 git Note Added: 0086419
2019-08-22 17:55 git Note Added: 0086420
2019-08-26 15:34 git Note Added: 0086450
2019-09-04 15:54 abv Target Version 7.4.0 => 7.5.0*

Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker