|Anonymous | Login||2019-02-18 23:09 MSK|
|My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0029902||Open CASCADE||[OCCT] OCCT:Data Exchange||public||2018-06-28 11:58||2019-02-06 12:51|
|Target Version||[OCCT] 7.4.0*||Fixed in Version|
|Summary||0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes|
|Description||XCAF 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
|Tags||No tags attached.|
|Test case number|
|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|
|Copyright © 2000 - 2019 MantisBT Team|