View Issue Details

IDProjectCategoryView StatusLast Update
0029902Open CASCADEOCCT:Data Exchangepublic2021-08-30 11:00
Reporterkgv Assigned Toapn  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Target Version7.5.0Fixed in Version7.5.0 
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 numberNot needed

Relationships

parent of 0031139 closedbugmaster Open CASCADE Data Exchange - fix misprint in RWObj_CafReader 
parent of 0032546 closedsmoskvin Open CASCADE Data Exchange, XCAF - mark material as defined XCAFDoc_VisMaterialPBR::IsDefined=true within default constructor 
related to 0023037 assignedgka Community Data Exchange - support different materials and transparency in XDE 
related to 0030691 closedbugmaster Open CASCADE Data Exchange - implement import of mesh data from files in glTF format 
related to 0030700 closedapn Open CASCADE Visualization, TKOpenGl - support PBR Metallic-Roughness shading model 

Activities

git

2019-07-03 11:30

administrator   ~0085392

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

2019-08-13 15:28

administrator   ~0086227

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 51bc6e3113c9745be338ad83e11a7d6af6c9ddc0

git

2019-08-21 16:20

administrator   ~0086386

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

2019-08-21 16:56

administrator   ~0086387

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: f4dac03e43701abc838a62be6b1151bfbd4ba391

git

2019-08-22 16:46

administrator   ~0086417

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 6f332a357293db422ad770e4c709b4506c513b0d

git

2019-08-22 17:27

administrator   ~0086418

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 163f6a67bf1a4c627001d7d69e0d2c6bcf95b50b

git

2019-08-22 17:49

administrator   ~0086419

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: a553e176efb12fd2153b60975f08aef65bc4513d

git

2019-08-22 17:55

administrator   ~0086420

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 058092bf77dfc2a37150bc66415b111b36425c67

git

2019-08-26 15:34

administrator   ~0086450

Branch CR29902_0 has been updated forcibly by kgv.

SHA-1: 3ed3d300128e0a74bcf575dd05df109605377b8f

git

2019-10-08 20:23

administrator   ~0087955

Branch CR29902_1 has been created by kgv.

SHA-1: 2454e934ae6b5898103ab579f4623f985fd23721


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
    
    Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.
    
    XCAFPrs_Style has been exteneded Material() property.
    XCAFPrs_AISObject::DispatchStyles() maps new XCAFPrs_Style::Material() property onto graphics aspects.
    
    RWGltf_GltfJsonParser and RWObj_CafReader now put Material definition into XCAF document instead of a color label.
    RWGltf_MaterialMetallicRoughness - added missing properties AlphaMode, AlphaCutOff and IsDoubleSided;
    fixed default values in constructor for Metallic and Roughness.
    
    Added commands XGetAllVisMaterials, XGetVisMaterial, XAddVisMaterial,
    XRemoveVisMaterial, XSetVisMaterial, XUnsetVisMaterial for working with
    new visualization materials table in the document.

git

2019-10-08 23:07

administrator   ~0087957

Branch CR29902_1 has been updated forcibly by kgv.

SHA-1: f2ab47fe568276fa8cd59eb261ff99a1f2a5e12a

git

2019-10-09 01:10

administrator   ~0087958

Branch CR29902_1 has been updated forcibly by kgv.

SHA-1: 9e91d7b0b23244f45699c2c6c5f69bb69a1dee90

git

2019-10-09 01:14

administrator   ~0087959

Branch CR29902_2 has been created by kgv.

SHA-1: 972728a09bf18f4b93c1fec288e4b514bf4596c0


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
    
    Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.
    
    XCAFPrs_Style has been exteneded Material() property.
    XCAFPrs_AISObject::DispatchStyles() maps new XCAFPrs_Style::Material() property onto graphics aspects.
    
    RWGltf_GltfJsonParser and RWObj_CafReader now put Material definition into XCAF document instead of a color label.
    RWGltf_MaterialMetallicRoughness - added missing properties AlphaMode, AlphaCutOff and IsDoubleSided;
    fixed default values in constructor for Metallic and Roughness.
    
    Added commands XGetAllVisMaterials, XGetVisMaterial, XAddVisMaterial,
    XRemoveVisMaterial, XSetVisMaterial, XUnsetVisMaterial for working with
    new visualization materials table in the document.

git

2019-10-09 01:35

administrator   ~0087960

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: 9e5ddc9edb1751362a84ec07678e1aa2e0501d96

git

2019-10-09 11:07

administrator   ~0087965

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: 988b2b6e1742044f9c3cf99f3f69c6126b0e87a8

git

2019-10-09 11:56

administrator   ~0087968

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: 7678f3a555442c6527513dcedb2c08731278afc0

git

2019-10-09 12:29

administrator   ~0087972

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: 8ca1c1c9933f99f7d7838d27f4afac9682cb432a

git

2019-10-09 13:51

administrator   ~0087974

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: d88f2bfc404c036172df07d285d04444d230c1d3

kgv

2019-10-09 14:56

developer   ~0087978

Patch is ready for review.

git

2019-10-09 15:54

administrator   ~0087981

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: b6e4388b62d5732d2fba663517fdb54ac8e33de9

git

2019-10-09 15:57

administrator   ~0087982

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: 5c253b40171404e86c5ff56394a59535a4b5f7bd

git

2019-10-09 16:09

administrator   ~0087983

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: ad2e9ee57fe9a8e3a74647f1f2642fb5dd8fbccf

git

2019-10-09 16:14

administrator   ~0087984

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: b942c6471a70de3a1ae8fca43708c71291aaef8f

git

2019-10-09 16:20

administrator   ~0087985

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: 62d78b9c48e65296d826823b7cda5820b417e0fa

git

2019-10-09 16:45

administrator   ~0087986

Branch CR29902_2 has been updated forcibly by kgv.

SHA-1: 5336d2b7a38e310c964e95f0ffe38ed9fbb4cc6e

gka

2019-10-09 19:17

developer   ~0087990

Branches CR29902_2 OCCT Internal repository and CR29902_2 in the OCCT Products Internal repository were reviewed.

git

2019-10-23 11:51

administrator   ~0088455

Branch CR29902_0 has been deleted by kgv.

SHA-1: 3ed3d300128e0a74bcf575dd05df109605377b8f

git

2019-10-23 11:51

administrator   ~0088456

Branch CR29902_1 has been deleted by kgv.

SHA-1: 9e91d7b0b23244f45699c2c6c5f69bb69a1dee90

git

2019-10-23 11:51

administrator   ~0088457

Branch CR29902_2 has been deleted by kgv.

SHA-1: 5336d2b7a38e310c964e95f0ffe38ed9fbb4cc6e

Related Changesets

occt: master a4815d55

2019-07-03 08:28:26

kgv


Committer: apn Details Diff
0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes

Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.

XCAFPrs_Style has been exteneded Material() property.
XCAFPrs_AISObject::DispatchStyles() maps new XCAFPrs_Style::Material() property onto graphics aspects.

RWGltf_GltfJsonParser and RWObj_CafReader now put Material definition into XCAF document instead of a color label.
RWGltf_MaterialMetallicRoughness - added missing properties AlphaMode, AlphaCutOff and IsDoubleSided;
fixed default values in constructor for Metallic and Roughness.

Added commands XGetAllVisMaterials, XGetVisMaterial, XAddVisMaterial,
XRemoveVisMaterial, XSetVisMaterial, XUnsetVisMaterial for working with
new visualization materials table in the document.
Affected Issues
0029902
mod - src/AIS/AIS_ColoredDrawer.hxx Diff File
mod - src/AIS/AIS_ColoredShape.cxx Diff File
mod - src/BinMXCAFDoc/BinMXCAFDoc.cxx Diff File
add - src/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.cxx Diff File
add - src/BinMXCAFDoc/BinMXCAFDoc_VisMaterialDriver.hxx Diff File
add - src/BinMXCAFDoc/BinMXCAFDoc_VisMaterialToolDriver.cxx Diff File
add - src/BinMXCAFDoc/BinMXCAFDoc_VisMaterialToolDriver.hxx Diff File
mod - src/BinMXCAFDoc/FILES Diff File
mod - src/IGESCAFControl/IGESCAFControl_Writer.cxx Diff File
mod - src/RWGltf/FILES Diff File
add - src/RWGltf/RWGltf_GltfAlphaMode.hxx Diff File
mod - src/RWGltf/RWGltf_GltfJsonParser.cxx Diff File
mod - src/RWGltf/RWGltf_GltfJsonParser.pxx Diff File
mod - src/RWGltf/RWGltf_MaterialMetallicRoughness.hxx Diff File
mod - src/RWMesh/RWMesh_CafReader.cxx Diff File
mod - src/RWObj/RWObj_CafReader.cxx Diff File
mod - src/RWObj/RWObj_CafReader.hxx Diff File
mod - src/STEPCAFControl/STEPCAFControl_Writer.cxx Diff File
mod - src/TKBinXCAF/EXTERNLIB Diff File
mod - src/TKXmlXCAF/EXTERNLIB Diff File
mod - src/VrmlData/VrmlData_ShapeConvert.cxx Diff File
mod - src/VrmlData/VrmlData_ShapeConvert.hxx Diff File
mod - src/XCAFDoc/FILES Diff File
mod - src/XCAFDoc/XCAFDoc.cxx Diff File
mod - src/XCAFDoc/XCAFDoc.hxx Diff File
mod - src/XCAFDoc/XCAFDoc_ColorTool.cxx Diff File
mod - src/XCAFDoc/XCAFDoc_ColorTool.hxx Diff File
mod - src/XCAFDoc/XCAFDoc_DocumentTool.cxx Diff File
mod - src/XCAFDoc/XCAFDoc_DocumentTool.hxx Diff File
add - src/XCAFDoc/XCAFDoc_VisMaterial.cxx Diff File
add - src/XCAFDoc/XCAFDoc_VisMaterial.hxx Diff File
add - src/XCAFDoc/XCAFDoc_VisMaterialCommon.hxx Diff File
add - src/XCAFDoc/XCAFDoc_VisMaterialPBR.hxx Diff File
add - src/XCAFDoc/XCAFDoc_VisMaterialTool.cxx Diff File
add - src/XCAFDoc/XCAFDoc_VisMaterialTool.hxx Diff File
mod - src/XCAFPrs/FILES Diff File
mod - src/XCAFPrs/XCAFPrs.cxx Diff File
mod - src/XCAFPrs/XCAFPrs_AISObject.cxx Diff File
mod - src/XCAFPrs/XCAFPrs_AISObject.hxx Diff File
mod - src/XCAFPrs/XCAFPrs_Style.hxx Diff File
add - src/XCAFPrs/XCAFPrs_Texture.cxx Diff File
add - src/XCAFPrs/XCAFPrs_Texture.hxx Diff File
mod - src/XDEDRAW/XDEDRAW_Colors.cxx Diff File
mod - src/XmlMXCAFDoc/FILES Diff File
mod - src/XmlMXCAFDoc/XmlMXCAFDoc.cxx Diff File
add - src/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialDriver.cxx Diff File
add - src/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialDriver.hxx Diff File
add - src/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialToolDriver.cxx Diff File
add - src/XmlMXCAFDoc/XmlMXCAFDoc_VisMaterialToolDriver.hxx Diff File

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
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: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
2019-10-08 20:23 git Note Added: 0087955
2019-10-08 23:07 git Note Added: 0087957
2019-10-09 01:10 git Note Added: 0087958
2019-10-09 01:14 git Note Added: 0087959
2019-10-09 01:35 git Note Added: 0087960
2019-10-09 11:07 git Note Added: 0087965
2019-10-09 11:56 git Note Added: 0087968
2019-10-09 12:29 git Note Added: 0087972
2019-10-09 13:51 git Note Added: 0087974
2019-10-09 14:56 kgv Note Added: 0087978
2019-10-09 14:56 kgv Assigned To kgv => gka
2019-10-09 14:56 kgv Status assigned => resolved
2019-10-09 15:54 git Note Added: 0087981
2019-10-09 15:57 git Note Added: 0087982
2019-10-09 16:09 git Note Added: 0087983
2019-10-09 16:14 git Note Added: 0087984
2019-10-09 16:20 git Note Added: 0087985
2019-10-09 16:45 git Note Added: 0087986
2019-10-09 19:17 gka Note Added: 0087990
2019-10-09 19:17 gka Assigned To gka => bugmaster
2019-10-09 19:17 gka Status resolved => reviewed
2019-10-23 01:07 apn Changeset attached => occt master a4815d55
2019-10-23 01:07 apn Assigned To bugmaster => apn
2019-10-23 01:07 apn Status reviewed => verified
2019-10-23 01:07 apn Resolution open => fixed
2019-10-23 11:51 git Note Added: 0088455
2019-10-23 11:51 git Note Added: 0088456
2019-10-23 11:51 git Note Added: 0088457
2019-10-23 16:52 apn Test case number => Not needed
2019-11-07 00:02 kgv Relationship added parent of 0031139
2020-12-02 16:40 emo Fixed in Version => 7.5.0
2020-12-02 17:11 emo Status verified => closed
2021-08-30 11:00 kgv Relationship added parent of 0032546