MantisBT - Open CASCADE
View Issue Details
0030700Open CASCADE[OCCT] OCCT:Visualizationpublic2019-05-07 14:212019-10-17 12:33
kgv 
iko 
normalfeature 
assignedopen 
 
[OCCT] 7.5.0* 
0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
It is desired supporting PBR Metallic-Roughness shading model defined by glTF format specification for properly displaying such models in 3D Viewer.
No tags attached.
related to 0029902reviewed bugmaster Open CASCADE Data Exchange, XCAF - provide extended Material definition for visualization purposes 
related to 0030691verified bugmaster Open CASCADE Data Exchange - implement import of mesh data from files in glTF format 
related to 0029528reviewed bugmaster Open CASCADE Visualization, TKOpenGl - allow defining sRGB textures 
related to 0029516verified bugmaster Open CASCADE Visualization - eliminate redundant property Graphic3d_MaterialAspect::ReflectionMode() 
related to 0030126new kgv Open CASCADE Visualization, OpenGl_ShaderManager - define standard Lighting & Clipping within custom GLSL programs as template functions 
related to 0030631new kgv Open CASCADE Visualization - Vulkan graphic driver prototype 
related to 0030807verified apn Open CASCADE Visualization, TKOpenGl - supporting cubemaps 
related to 0030963verified bugmaster Open CASCADE Visualization, TKOpenGl - texture unit error during FFP global texture's parameters processing 
png new_materials_work_in_progress.png (167,250) 2019-08-30 09:03
https://tracker.dev.opencascade.org/
png new_materials_work_in_progress_2.png (197,097) 2019-09-02 16:55
https://tracker.dev.opencascade.org/
png new_materials_work_in_progress_3.png (170,120) 2019-09-27 12:26
https://tracker.dev.opencascade.org/
Issue History
2019-05-07 14:21kgvNew Issue
2019-05-07 14:21kgvAssigned To => kgv
2019-05-07 14:21kgvAssigned Tokgv => iko
2019-05-07 14:21kgvStatusnew => assigned
2019-05-07 14:22kgvRelationship addedrelated to 0029902
2019-05-07 14:23kgvRelationship addedrelated to 0030691
2019-05-07 14:24kgvRelationship addedrelated to 0029528
2019-05-07 14:26kgvRelationship addedrelated to 0029516
2019-05-07 14:27kgvRelationship addedrelated to 0030126
2019-05-07 14:27kgvRelationship addedrelated to 0030631
2019-05-07 14:27kgvRelationship addedrelated to 0029298
2019-05-15 15:36kgvNote Added: 0084371
2019-06-20 09:58gitNote Added: 0085159
2019-06-20 10:58gitNote Added: 0085164
2019-06-20 15:18gitNote Added: 0085181
2019-06-21 16:33gitNote Added: 0085201
2019-06-25 14:08kgvRelationship addedrelated to 0030807
2019-07-15 14:06gitNote Added: 0085632
2019-08-13 12:04kgvTarget Version7.4.0 => 7.5.0*
2019-08-30 09:03ikoFile Added: new_materials_work_in_progress.png
2019-09-02 16:55ikoFile Added: new_materials_work_in_progress_2.png
2019-09-12 16:37kgvRelationship addedrelated to 0030963
2019-09-13 12:29gitNote Added: 0087047
2019-09-13 12:54gitNote Added: 0087049
2019-09-16 12:06gitNote Added: 0087119
2019-09-16 17:27gitNote Added: 0087160
2019-09-18 12:49gitNote Added: 0087246
2019-09-19 17:05gitNote Added: 0087316
2019-09-20 12:48gitNote Added: 0087355
2019-09-20 13:06gitNote Added: 0087356
2019-09-20 13:40gitNote Added: 0087362
2019-09-20 14:20gitNote Added: 0087365
2019-09-23 18:16gitNote Added: 0087455
2019-09-23 21:27gitNote Added: 0087457
2019-09-24 11:02gitNote Added: 0087461
2019-09-24 11:53kgvNote Added: 0087465
2019-09-24 13:27kgvNote Added: 0087472
2019-09-24 14:34kgvNote Added: 0087479
2019-09-24 14:38gitNote Added: 0087480
2019-09-24 14:44gitNote Added: 0087481
2019-09-24 15:04gitNote Added: 0087483
2019-09-24 15:43kgvNote Added: 0087485
2019-09-25 08:09kgvNote Added: 0087500
2019-09-25 10:39kgvNote Added: 0087504
2019-09-25 14:19gitNote Added: 0087510
2019-09-27 12:04gitNote Added: 0087566
2019-09-27 12:26ikoFile Added: new_materials_work_in_progress_3.png
2019-09-27 12:55gitNote Added: 0087569
2019-09-27 14:07gitNote Added: 0087571
2019-09-27 17:15kgvNote Added: 0087579
2019-09-27 18:36kgvNote Added: 0087581
2019-09-27 18:38kgvNote Added: 0087582
2019-09-27 21:09gitNote Added: 0087583
2019-09-27 21:18kgvNote Added: 0087584
2019-09-27 21:51gitNote Added: 0087585
2019-09-27 22:15gitNote Added: 0087586
2019-09-27 22:50gitNote Added: 0087587
2019-09-27 23:12gitNote Added: 0087588
2019-09-28 22:05gitNote Added: 0087595
2019-09-28 22:36gitNote Added: 0087596
2019-09-28 23:35gitNote Added: 0087597
2019-10-01 15:34gitNote Added: 0087662
2019-10-01 17:52gitNote Added: 0087669
2019-10-01 18:06gitNote Added: 0087670
2019-10-02 09:28gitNote Added: 0087681
2019-10-02 09:51gitNote Added: 0087682
2019-10-02 10:54gitNote Added: 0087686
2019-10-02 16:58gitNote Added: 0087695
2019-10-02 17:45gitNote Added: 0087700
2019-10-02 22:26gitNote Added: 0087726
2019-10-03 15:32gitNote Added: 0087769
2019-10-03 20:29gitNote Added: 0087794
2019-10-03 21:19gitNote Added: 0087795
2019-10-03 21:39gitNote Added: 0087796
2019-10-04 00:26gitNote Added: 0087797
2019-10-04 13:23gitNote Added: 0087810
2019-10-06 10:41kgvNote Added: 0087887
2019-10-06 10:55kgvNote Added: 0087888
2019-10-06 11:25kgvNote Added: 0087889
2019-10-06 11:26kgvNote Edited: 0087888bug_revision_view_page.php?bugnote_id=87888#r21978
2019-10-06 11:26kgvNote Edited: 0087887bug_revision_view_page.php?bugnote_id=87887#r21980
2019-10-06 11:29kgvNote Edited: 0087889bug_revision_view_page.php?bugnote_id=87889#r21982
2019-10-06 11:38kgvNote Added: 0087890
2019-10-06 11:56kgvNote Edited: 0087889bug_revision_view_page.php?bugnote_id=87889#r21983
2019-10-17 12:33gitNote Added: 0088246

Notes
(0084371)
kgv   
2019-05-15 15:36   
Useful threads related to light sources definition merged as KHR_lights_punctual extension to glTF 2.0:

https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual/README.md [^]
https://github.com/KhronosGroup/glTF/issues/945 [^]
https://github.com/KhronosGroup/glTF/pull/1223 [^]
(0085159)
git   
2019-06-20 09:58   
Branch CR30700 has been created by iko.

SHA-1: a09e93e84b4cd643c202b196008e8c7cd96e07d7


Detailed log of new commits:

Author: iko
Date: Thu Jun 20 09:53:20 2019 +0300

    0030700: 0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
    
    Metallic-Roughness shading model has been implemented.
    New materials descriptors has been added to standard materal library.
    Light sources intensities are supported now in pbr shading model.
(0085164)
git   
2019-06-20 10:58   
Branch CR30700 has been updated forcibly by iko.

SHA-1: b8818a8be3628d41a2c45fc1866402ec1f41c8cb
(0085181)
git   
2019-06-20 15:18   
Branch CR30700 has been updated by iko.

SHA-1: d744023498a06f51bb1157ccc30e8d6f87ff59c0


Detailed log of new commits:

Author: iko
Date: Thu Jun 20 15:17:11 2019 +0300

    # implement facet pbr shading model

(0085201)
git   
2019-06-21 16:33   
Branch CR30700 has been updated by iko.

SHA-1: 71cd6bc929c2db4b69d6a9e0e8c91f674c97e07d


Detailed log of new commits:

Author: iko
Date: Fri Jun 21 16:31:41 2019 +0300

    # generating and header storage of environment LUT has been implemented

(0085632)
git   
2019-07-15 14:06   
Branch CR30700 has been updated forcibly by iko.

SHA-1: 2181966edb04f0b7d5bd53f19fcbdac4b0fd99b1
(0087047)
git   
2019-09-13 12:29   
Branch CR30700 has been updated forcibly by iko.

SHA-1: 52689bef0717737e80177644eff6c31525ef9d10
(0087049)
git   
2019-09-13 12:54   
Branch CR30700 has been updated forcibly by iko.

SHA-1: 48b87406f4c551d6eabb7b4512ccdb2afd2aaa8c
(0087119)
git   
2019-09-16 12:06   
Branch CR30700 has been updated forcibly by iko.

SHA-1: af255a64b454efd98fa630490161e5257b0a7e04
(0087160)
git   
2019-09-16 17:27   
Branch CR30700 has been updated by iko.

SHA-1: 87e0fec692555507a98b5808fe0ae7c0e6ea2cb8


Detailed log of new commits:

Author: iko
Date: Mon Sep 16 17:22:55 2019 +0300

    # implement PBREnvironment baking control to RenderParams
(0087246)
git   
2019-09-18 12:49   
Branch CR30700 has been updated by iko.

SHA-1: 15c75be3163f4c367318d67d8e8efe9633330dda


Detailed log of new commits:

Author: iko
Date: Wed Sep 18 12:45:10 2019 +0300

    # add documentation
Author: iko
Date: Wed Sep 18 12:31:50 2019 +0300

    # remove 'uint' type from all PBR functions
Author: iko
Date: Wed Sep 18 11:57:35 2019 +0300

    # fix missing sampler parameters applying
Author: iko
Date: Tue Sep 17 17:37:50 2019 +0300

    # add warning messages
    # add basic test cases
    # fix crash during changing shading model to PBR first time

(0087316)
git   
2019-09-19 17:05   
Branch CR30700 has been updated forcibly by iko.

SHA-1: 1a6697ad0ab4caddcb63de44558d393883e49fc0
(0087355)
git   
2019-09-20 12:48   
Branch CR30700 has been updated forcibly by iko.

SHA-1: 33f2cee09d3e269c883f4cb309db5fcb3520aece
(0087356)
git   
2019-09-20 13:06   
Branch CR30700 has been updated by iko.

SHA-1: 3104b4a895bed76621c38b7b52e87ce9289c4c93


Detailed log of new commits:

Author: iko
Date: Fri Sep 20 13:01:45 2019 +0300

    # fix compiler warnings
(0087362)
git   
2019-09-20 13:40   
Branch CR30700 has been updated forcibly by iko.

SHA-1: 8d86509b2b512a62752e5d3a43e173e975417f41
(0087365)
git   
2019-09-20 14:20   
Branch CR30700 has been updated forcibly by iko.

SHA-1: 5224804adb8d8864482963ef5c694c9764c81a60
(0087455)
git   
2019-09-23 18:16   
Branch CR30700_squashed has been created by kgv.

SHA-1: 8fe62c4b587064c8516bd715d7a6474707211b67


Detailed log of new commits:

Author: iko
Date: Thu Jun 20 09:53:20 2019 +0300

    0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
    
    Metallic-Roughness shading model has been implemented.
    New materials descriptors has been added to standard materal library.
    Light sources intensities are supported now in pbr shading model.
    
    implement facet pbr shading model
    generating and header storage of environment LUT has been implemented
    implement PBREnvironment baking
(0087457)
git   
2019-09-23 21:27   
Branch CR30700 has been updated forcibly by iko.

SHA-1: e135eb121b86a0b6384d73f2f90f11d3117556fc
(0087461)
git   
2019-09-24 11:02   
Branch CR30700 has been updated forcibly by iko.

SHA-1: e61faa6bdd5cf42fafa4aa2fa52b32930d23f3ba
(0087465)
kgv   
2019-09-24 11:53   
+  //! in order to provide environment indirect illumination in PBR shading model (Image Based Lightning).


Lighting, as there no thunder around.

+  virtual void GenPBREnvironment() = 0;

It is better avoiding confusing abbreviations in API methods - GeneratePBREnvironment() or UpdatePBREnvironment().

+++ b/src/Graphic3d/Graphic3d_PBRMaterial.cxx
@@ -0,0 +1,346 @@
+// Author: Ilya Khramov
+// Copyright (c) 2016-2019 OPEN CASCADE SAS

Please check headers for new files.

+void Graphic3d_PBRMaterial::SetMetallic (Standard_ShortReal theMetallic)
+{
+  myMetallic = clamp (theMetallic);
+}

It would be better throwing Graphic3d_MaterialDefinitionError exception on wrong input.

+void Graphic3d_PBRMaterial::SetColor (const Quantity_Color& theColor)
+{
+  SetColor (Graphic3d_Vec3 (static_cast<Standard_ShortReal> (theColor.Red()),
+                            static_cast<Standard_ShortReal> (theColor.Green()),
+                            static_cast<Standard_ShortReal> (theColor.Blue())));
+}

Quantity_Color defines cast operator to Graphic3d_Vec3.

+void Graphic3d_PBRMaterial::SetBSDF (const Graphic3d_BSDF& theBSDF)
+{

Would be good having also a method performing conversion in opposite direction.

+Standard_Boolean Graphic3d_PBRMaterial::operator== (const Graphic3d_PBRMaterial &theOther) const

+{
+  return (myMetallic == theOther.myMetallic)

Better inlining trivial methods within Graphic3d_PBRMaterial.

+void Graphic3d_PBRMaterial::GenerateEnvLUT (const Handle(Image_PixMap) &theLUT,
+Graphic3d_Vec3 Graphic3d_PBRMaterial::importanceSample (const Graphic3d_Vec2 &theHammerslayPoint,

+Graphic3d_Vec3 Graphic3d_PBRMaterial::view (Standard_ShortReal theCosV)
+Graphic3d_Vec3 Graphic3d_PBRMaterial::reflect (const Graphic3d_Vec3 &theVector,
+                                               const Graphic3d_Vec3 &theAxis)

Unexpected &.
GenerateEnvironmentLUT?
Maybe internal methods intended for LUT generation like importanceSample() could be prefixed somehow [lutImportanceSample()]?

+      theLUT->ChangeValue<Graphic3d_Vec3>(theLUT->SizeX() - 1 - y, x) = aResult;

theLUT->SizeY()?

+    if ((theNumber >> i) != 0)
+    {
+      aPhi2 += ((theNumber >> i) & 1) / Standard_ShortReal(1 << (i + 1));
+    }
+    else
+    {
+      break;
+    }

Putting a 'break' first without 'else' would probably look more natural.

+//! Class implementing Metallic-Roughness physically based material system
+class Graphic3d_PBRMaterial

"material system" -> "material definition"?

+
+  static const Standard_ShortReal MIN_ROUGHNESS; //!< Roughness cannot be 0 in real calculations, 
so it is minimal achievable level of roughness in practice

Non-integer constants may cause problems sometimes.
Better defining as method.
(0087472)
kgv   
2019-09-24 13:27   
+  Graphic3d_Vec4     myColor;     //!< base color with alpha component [0, 1]

As it called color and used as a color - please define it as Quantity_ColorRGBA.

+  Graphic3d_Vec3     myEmission;  //!< light intensity emitted by material [>= 0]
+  Standard_ShortReal myIOR;       //!< index of refraction [1, 3]
+  Graphic3d_Vec4     myColor;     //!< base color with alpha component [0, 1]

Is there some reason putting myEmission before the color?
I would reorder properties to put color first.

+  //! Returns base color with alpha component of material.
+  //! All 4 values are in range [0, 1].
+  //! (1, 1, 1, 1) by default.
+  const Graphic3d_Vec4& Color() const { return myColor; }

Might worth mentioning another alias of this property in description - albedo.

+  //! (1, 1, 1, 1) by default.
+  const Graphic3d_Vec4& Color() const { return myColor; }
...
+  myColor     (0.f, 0.f, 0.f, 1.f),

Description/implementation mismatch.
I would drop by default mentioning, as there is no meaningful default for material color - empty constructor description could be extended with initialization parameters instead.

   Standard_ShortReal                WhitePoint;                  //!< white point value used in filmic 
tone mapping (path tracing), 1.0 by default
 
+  Standard_Integer                  PBREnvPow2Size;              //!< size of IBL maps side can be 
calculated as 2^PBREnvPow2Size
+  Standard_Integer                  PBREnvSpecMapLevelsNumber;   //!< number of levels used in specular 
IBL map
+  Standard_Integer                  PBREnvBakingSamplesNumber;   //!< number of samples used in Monte-Carlo 
integration during PBR environment generation

Please put PBR rendering parameters before RayTracing options.

+  //! Physically based illumination system.
+  Graphic3d_TOSM_PBR,

Metalic-roughness physically based (PBR) illumination system.

+  //! Flat physically based shading.
+  Graphic3d_TOSM_PBR_FACET,

//! Same as Graphic3d_TOSM_PBR but using flat per-triangle normal.

+  Graphic3d_TextureUnit myPBRDiffIBLMapTexUnit; //!< texture unit where specular IBL map is expected 
to  be binded (0 if PBR is not supported)

"to be bound".

+    glGetIntegerv (GL_DRAW_FRAMEBUFFER_BINDING, &myFBO);

This would cause issues on Android as GL_DRAW_FRAMEBUFFER_BINDING has been introduced singe GLES3.

+  Standard_ShortReal           myClearColor[4];

Graphic3d_Vec4.

+  Handle(OpenGl_PBREnvironment) anEnvironment;
+
+  if (theCtx->arbFBO != NULL)
+  {

if (theCtx->arbFBO = NULL)
{
  return Handle(OpenGl_PBREnvironment)();
}

+  :
+  myPow2Size (std::max (1u, thePowOf2Size)),

I see some rationale for this syntax with : on dedicated line,
but it is uncommon to OCCT, where is usually placed on the same line with first field:
+: myPow2Size (std::max (1u, thePowOf2Size)),

+  if (theCtx != NULL)
+  {
+    theCtx->arbFBO->glDeleteFramebuffers (1, &myFBO);
+  }

myFBO is not checked for validness and not reset after deletion.

+  GLuint              myFBO;        //!< frame buffer object to generate or clear IBL maps

myFBO is not specified within field initialization list.

+  myIsComplete (Standard_True)
...
+  myIsComplete = myIsComplete && initVAO(theCtx);
+  myIsComplete = myIsComplete && initTextures (theCtx);
+  myIsComplete = myIsComplete && checkFBOComplentess (theCtx);

Weird style - it is better initializing myIsComplete=false and then setting it.

+void OpenGl_PBREnvironment::initFBO (const Handle(OpenGl_Context)& theCtx)
+{
+  theCtx->arbFBO->glGenFramebuffers (1, &myFBO);

Looks more like "createFBO()" and method lacks check if myFBO was already generated.

+// =======================================================================
+// function : processCubeMapSide
+// purpose  :
+// =======================================================================
+void OpenGl_PBREnvironment::processIBLMap (const Handle(OpenGl_Context)& theCtx,

Mismatch.

+  theCtx->ShaderManager()->BindPBREnvBakingProgram();
+  if (theCtx->ActiveProgram().IsNull())

Usually BindPBREnvBakingProgram() returns TRUE on success.

+  myVBO.BindAttribute (theCtx, Graphic3d_TOA_POS);
+  theCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, myFBO);

I would expect FBO being bound before VBOs.

+class OpenGl_PBREnvironment : public Standard_Transient
+{

OpenGl_NamedResource.

+  setParameter(theCtx, theSampler, theTarget, GL_TEXTURE_BASE_LEVEL, theParams->BaseLevel());
+  setParameter(theCtx, theSampler, theTarget, GL_TEXTURE_MAX_LEVEL,  theParams->MaxLevel());

if (IsGlGreaterEqual (1, 2))
(0087479)
kgv   
2019-09-24 14:34   
 #include <OpenGl_Workspace.hxx>
+#include "../Textures/Textures_EnvLUT.pxx"
 
 #include <TCollection_ExtendedString.hxx>

Better moving after all "normal" includes.

+//! The same function as THE_FUNC_transformNormal but is used in PBR pipeline.
+//! The normals are expected to be in world coordinate system in PBR pipeline.
+const char THE_FUNC_PBR_transformNormal[] =

Please add coordinate system description to THE_FUNC_transformNormal.
And it might be better renaming variables to THE_FUNC_transformNormal_Model + THE_FUNC_transformNormal_World or similar instead of "PBR", which looks irrelevant.

+const char THE_FUNC_PBR_transformNormal[] =
+EOL"vec3 transformNormal (in vec3 theNormal)"
+EOL"{"

Indentation is inconsistent to other string constants in the file.

+const char THE_FUNC_PBR_lightDef[] =
+  EOL"vec3  DirectLightning;"  //!< Accumulator of direct lightning from light sources

+  EOL"vec4  BaseColor;"        //!< Base color (albedo) of material for PBR
+  EOL"float Metallic;"         //!< Metallic coefficient of material
+  EOL"float Roughness;"        //!< Roughness coefficient of material
+  EOL"float IOR;"              //!< Material's index of refraction
+  EOL"vec3  Emission;";        //!< Light intensity emitted by material

Please consider reordering variables taking into account pushing these constants into UBO in some future.

+  EOL"float geometry (in float theCosV,"
+  EOL"                in float theCosL,"
+  EOL"                in float theRoughness)"
+  EOL"{"
+  EOL"  float k = theRoughness + 1.0;"
+  EOL"  k *= 0.125 * k;"
+  EOL"  float g1 = 1.0;"
+  EOL"  g1 /= g1 * (1.0 - k) + k;"
+  EOL"  float g2 = 1.0;"
+  EOL"  g2 /= g2 * (1.0 - k) + k;"
+  EOL"  return g1 * g2;"
+  EOL"}";

Why not just
+ EOL" float k = theRoughness + 1.0;"
+ EOL" k *= 0.125 * k;"
+ EOL" float g1 = 1.0 / ((1.0 - k) + k);"
+ EOL" return g1 * g1;"
?

+  EOL""

"" is redundant (just EOL).
(0087480)
git   
2019-09-24 14:38   
Branch CR30700 has been updated by iko.

SHA-1: 304aab734594e2551f204dc5cbe78611325cd1ab


Detailed log of new commits:

Author: iko
Date: Tue Sep 24 14:33:48 2019 +0300

    
    # implement 2-channel image type
(0087481)
git   
2019-09-24 14:44   
Branch CR30700 has been updated by iko.

SHA-1: 05101e4e31e75a4a282e88968fd5bc40f5e9d1b5


Detailed log of new commits:

Author: iko
Date: Tue Sep 24 14:40:41 2019 +0300

    # fix compiler warnings 2
(0087483)
git   
2019-09-24 15:04   
Branch CR30700 has been updated by iko.

SHA-1: 86af5d697ec5f5a912901337d3b83463e7338ef5


Detailed log of new commits:

Author: iko
Date: Tue Sep 24 15:00:24 2019 +0300

    # fix compiler warnings
    # delete 'lightning'
(0087485)
kgv   
2019-09-24 15:43   
+//! Returns coordinates of point theNumber from hammersley point set having size theSize.

Hammersley, as it is a name.

+  theProgram->SetUniform (myContext, "occSpecIBLLevelsNumber", myLightSourceState.SpecIBLMapLevels());


Should be added to OpenGl_StateVariable.
And probably renamed occSpecIBLLevelsNumber -> occNbSpecIBLLevels.

+    }
+
+

Please avoid redundant double empty lines.

-    + aLightsLoop
-    + EOL"  vec4 aMatAmbient  = " + aGetMatAmbient
-    + EOL"  vec4 aMatDiffuse  = " + aGetMatDiffuse
-    + EOL"  vec4 aMatSpecular = theIsFront ? occFrontMaterial_Specular() : occBackMaterial_Specular();"

+      + aLightsLoop
+      + EOL"  vec4 aMatAmbient  = " + aGetMatAmbient
+      + EOL"  vec4 aMatDiffuse  = " + aGetMatDiffuse
+      + EOL"  vec4 aMatSpecular = theIsFront ? occFrontMaterial_Specular() : occBackMaterial_Specular();"


Unexpected change.

+      + THE_FUNC_lightDef
+      + aLightsFunc
+      + EOL
       EOL"vec4 computeLighting (in vec3 theNormal,"

Please adjust indentation.

+      EOL"  vec2 Coeff = occTexture2D (occEnvLUT, vec2(abs(dot(theView, theNormal)), Roughness)).xy;"


const vec2 aCoeff

+  const TCollection_AsciiString aProgId = TCollection_AsciiString (theIsFlatNormal ? "flat-" 
: "phong-") + (theIsPBR ? "PBR-" : "") + genLightKey (myLightSourceState.LightSources()) 
+ "-";

Shader ids are lower-case by convention.

+  Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram;

new Graphic3d_ShaderProgram()

+  TCollection_AsciiString aSrcFrag, aSrcVert;
+
+  aSrcVert += TCollection_AsciiString()
...
+
+  aSrcFrag += TCollection_AsciiString()
+  + THE_FUNC_PBR_hammersley

+= looks awkward here.

+Graphic3d_TypeOfShadingModel OpenGl_ShaderManager::PBRShadingModelFallback (Graphic3d_TypeOfShadingModel 
theShadingModel,
+                                                                            Standard_Boolean             
thePBRIsAllowed

theIsPbrAllowed.
Please move to header.

+  //! Checks whether one of PBR shading models is set as default model.
+  Standard_Boolean PBRIsAllowed() const { return myShadingModel == Graphic3d_TOSM_PBR
+                                              || myShadingModel == Graphic3d_TOSM_PBR_FACET; }

IsPbrAllowed().

+  //! Sets number of mipmap levels used in specular IBL map.
+  void SetSpecIBLMapLevels (Standard_Integer theSpecIBLMapLevels) { mySpecIBLMapLevels = theSpecIBLMapLevels; 
}
+
+  //! Returns number of mipmap levels used in specular IBL map.
+  //! 0 by default or in case of using non-PBR shading model.
+  Standard_Integer SpecIBLMapLevels() const { return mySpecIBLMapLevels; }

Please declare getter first.

+  PBRColor    = theMat.PBRMaterial().Color();

Looks like color of "non-physical" material is ignored here.

+  aFile << "//this file generated by vgenenvlut draw command\n";

has been generated
(0087500)
kgv   
2019-09-25 08:09   
+  OpenGl_Vec4 Emission;       //!< material emission
+  OpenGl_Vec4 Params;         //!< extra packed parameters
+  OpenGl_Vec4 PBRColor;       //!< base color of PBR material with alpha component
..
+vec4  occFrontMaterial_Specular(void);            //!< Specular reflection
+vec4  occFrontMaterial_PBRColor(void);            //!< Base color of PBR material

Please separate common/PBR material definition parameters passed to GLSL program:
- Split materials within OpenGl_Material in two groups (either as sub-structures, or as OpenGl_PBRMaterial).
- Add flag IsPBR() or similar to Graphic3d_ShaderProgram.
- Add THE_IS_PBR macros to Declarations.glsl managed by IsPBR().
- Use different variables for PBR within DeclarationsImpl.glsl (e.g. occPBRFrontMaterial or similar).
- The same might be applied to light sources, if not all obsolete parameters are used by PBR lighting.
(0087504)
kgv   
2019-09-25 10:39   
+  //! Enum classified the type of IBL map
+  enum OpenGl_TypeOfIBLMap
+  {
+    OpenGl_TOIM_Diffuse,
+    OpenGl_TOIM_Specular
+  };
...
+  //! State of PBR environment.
+  enum PBREnvironmentState
+  {
+    OpenGl_PES_NONEXISTENT,
+    OpenGl_PES_UNAVAILABLE, // indicates failed try to create PBR environment
+    OpenGl_PES_CREATED
+  };
+
+  //! Type of action which can be done with PBR environment.
+  enum PBREnvironmentRequest
+  {
+    OpenGl_PER_NONE,
+    OpenGl_PER_BAKE,
+    OpenGl_PER_CLEAR
+  };

OpenGl_TOIM_ is an old CDL style for enumeration values, it is no more recommended (complicates association of OpenGl_TOIM_ values with enumeration name).
More convenient style is using full enumeration name as prefix, e.g. OpenGl_TypeOfIBLMap_Diffuse.
(0087510)
git   
2019-09-25 14:19   
Branch CR30700_1 has been created by iko.

SHA-1: 7aa5f7f5a62d0f04406e66fe83b077cdb5e486ab


Detailed log of new commits:

Author: iko
Date: Thu Jun 20 09:53:20 2019 +0300

    0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model
    
    Metallic-Roughness shading model has been implemented.
    New materials descriptors has been added to standard materal library.
    Light sources intensities are supported now in pbr shading model.
(0087566)
git   
2019-09-27 12:04   
Branch CR30700_1 has been updated by iko.

SHA-1: b78e60723ce7002b4710aefc0919281e22cf074f


Detailed log of new commits:

Author: iko
Date: Fri Sep 27 12:03:37 2019 +0300

    # fix remarks
(0087569)
git   
2019-09-27 12:55   
Branch CR30700_1 has been updated forcibly by iko.

SHA-1: 4df9f23ac1fae5d9a7f2e22b6cfb87f4426df326
(0087571)
git   
2019-09-27 14:07   
Branch CR30700_1 has been updated forcibly by iko.

SHA-1: 4694e33d209e5e5b1771545a6406644d3026e617
(0087579)
kgv   
2019-09-27 17:15   
+      EOL"  anIndirectLightingSpec *= occTextureCubeLod (occSpecIBLMap, -reflect (theView, theNormal), 
Roughness * float (occNbSpecIBLLevels - 1)).rgb;"

textureCubeLod() with 'Lod' suffix is disallowed by specs in Fragment shader for versions before GLSL 130 and GLSL 300 es:
> The built-ins suffixed with “Lod” are allowed only in a vertex shader.

Either, the fallback not using occTextureCubeLod() in fragment shader should be provided, or minimal requirements for PBR renderer should be increased.
(0087581)
kgv   
2019-09-27 18:36   
Please also extend vlistmaterials with PBR metalic-roughness material properties.
(0087582)
kgv   
2019-09-27 18:38   
Building issues on Android platform:

C:\occt.git\src\OpenGl\OpenGl_FrameBuffer.cxx: In static member function 'static Standard_Boolean OpenGl_FrameBuffer::BufferDump(const 
opencascade::handle<OpenGl_Context>&, const opencascade::handle<OpenGl_FrameBuffer>&, 
Image_PixMap&, Graphic3d_BufferType)':
C:\occt.git\src\OpenGl\OpenGl_FrameBuffer.cxx:745:10: warning: enumeration value 'Image_Format_RGF' not 
handled in switch [-Wswitch]
   switch (theImage.Format())
          ^
C:\occt.git\src\OpenGl\OpenGl_Sampler.cxx: In static member function 'static void OpenGl_Sampler::applySamplerParams(const 
opencascade::handle<OpenGl_Context>&, const opencascade::handle<Graphic3d_TextureParams>&, 
OpenGl_Sampler*, GLenum, bool)':
C:\occt.git\src\OpenGl\OpenGl_Sampler.cxx:267:50: error: 'GL_TEXTURE_BASE_LEVEL' was not declared in 
this scope
     setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_BASE_LEVEL, theParams->BaseLevel());
                                                  
^
C:\occt.git\src\OpenGl\OpenGl_Sampler.cxx:268:50: error: 'GL_TEXTURE_MAX_LEVEL' was not declared in this 
scope
     setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_MAX_LEVEL,  theParams->MaxLevel());
(0087583)
git   
2019-09-27 21:09   
Branch CR30700_1 has been updated by kgv.

SHA-1: 9706f274589e7ad6750a2c067be57954e8e71ddc


Detailed log of new commits:

Author: kgv
Date: Fri Sep 27 21:09:06 2019 +0300

    # corrections

(0087584)
kgv   
2019-09-27 21:18   
+  GLint aLocation = theProgram->GetStateLocation (OpenGl_OCCT_NB_SPEC_IBL_LEVELS);
+  if (aLocation != OpenGl_ShaderProgram::INVALID_LOCATION)

For new code OpenGl_ShaderUniformLocation is preferred:
if (const OpenGl_ShaderUniformLocation aLocBack = theProgram->GetStateLocation (OpenGl_OCCT_NB_SPEC_IBL_LEVELS))
(0087585)
git   
2019-09-27 21:51   
Branch CR30700_1 has been updated by kgv.

SHA-1: e660b93e4564cfbfbef9d00c84490b46b12b6f1e


Detailed log of new commits:

Author: kgv
Date: Fri Sep 27 21:51:13 2019 +0300

    OpenGl_PBREnvironment::Release() - fix crash on accessing invalid OpenGL context

(0087586)
git   
2019-09-27 22:15   
Branch CR30700_1 has been updated by kgv.

SHA-1: 730c6f80d98747aa08ebcd12ba9224eb5c76b173


Detailed log of new commits:

Author: kgv
Date: Fri Sep 27 22:15:14 2019 +0300

    # fix material transparency loss

(0087587)
git   
2019-09-27 22:50   
Branch CR30700_1 has been updated by kgv.

SHA-1: f54360b1268305ca35daa8a5e5e2767893915578


Detailed log of new commits:

Author: kgv
Date: Fri Sep 27 22:50:43 2019 +0300

    # do not extend list of deprecated constants
    # fix texture internal format for Image_Format_RGF

(0087588)
git   
2019-09-27 23:12   
Branch CR30700_1 has been updated forcibly by kgv.

SHA-1: 66b0d93ebb19e2aa328decff89915e1fcf3ee3bc
(0087595)
git   
2019-09-28 22:05   
Branch CR30700_1 has been updated by kgv.

SHA-1: d0c18cb6e6e6d7d2bd9728c36fcacfbbefc45398


Detailed log of new commits:

Author: kgv
Date: Sat Sep 28 22:05:24 2019 +0300

    # OpenGl_PBREnvironment::Bind() - avoid non-symmetrical bind/unbind texture units

(0087596)
git   
2019-09-28 22:36   
Branch CR30700_1 has been updated by kgv.

SHA-1: e9994761b431f16251acd1420104fa2e9aab36d0


Detailed log of new commits:

Author: kgv
Date: Sat Sep 28 22:36:25 2019 +0300

    # OpenGl_PBREnvironment - remove redundant default argument theIsDrawAction value

(0087597)
git   
2019-09-28 23:35   
Branch CR30700_1 has been updated by kgv.

SHA-1: 770ce60e56ece5836fc9e4a0116d47e5b2559a3b


Detailed log of new commits:

Author: kgv
Date: Sat Sep 28 23:35:03 2019 +0300

    # THE_FUNC_PBR_directionalLightFirst - remove unused variable aHalf

(0087662)
git   
2019-10-01 15:34   
Branch CR30700_1 has been updated forcibly by kgv.

SHA-1: cb0803c3f01417175b0901b88fd19ab8af895fe3
(0087669)
git   
2019-10-01 17:52   
Branch CR30700_1 has been updated by kgv.

SHA-1: cbc0096d34f3ef4135588812b9b7040aab38950d


Detailed log of new commits:

Author: kgv
Date: Tue Oct 1 17:51:53 2019 +0300

    # OpenGl_View::SetBackgroundCubeMap() - do not crash on NULL argument; added TODOs

(0087670)
git   
2019-10-01 18:06   
Branch CR30700_1 has been updated by kgv.

SHA-1: 830a375dd43ff3d8c5e60b2da3a9411c4251cbd0


Detailed log of new commits:

Author: kgv
Date: Tue Oct 1 18:05:49 2019 +0300

    # OpenGl_PBREnvironment - fix binding VBO without default VAO in Core Profile

(0087681)
git   
2019-10-02 09:28   
Branch CR30700_1 has been updated by kgv.

SHA-1: d9b0d37f038cb7e42994bc314a92f0ee2054223a


Detailed log of new commits:

Author: kgv
Date: Wed Oct 2 09:27:51 2019 +0300

    # OpenGl_ShaderManager - fix cubemap shader compilation on Andreno due to implicit cast

(0087682)
git   
2019-10-02 09:51   
Branch CR30700_1 has been updated by kgv.

SHA-1: 5539a2e6e5eae55dca8b48f2819a57ef6183e016


Detailed log of new commits:

Author: kgv
Date: Wed Oct 2 09:51:12 2019 +0300

    # occLight_Intensity() - revert expansion of light sources array definition, pack intensity

(0087686)
git   
2019-10-02 10:54   
Branch CR30700_1 has been updated by kgv.

SHA-1: 2c7bf7922f65decbaa11e22992e952d03983c7e6


Detailed log of new commits:

Author: kgv
Date: Wed Oct 2 10:54:02 2019 +0300

    # OpenGl_Material - separate Commong and PBR material definitions

(0087695)
git   
2019-10-02 16:58   
Branch CR30700_1 has been updated by kgv.

SHA-1: 55dc17d3711733f15f51205343056e6da18e966a


Detailed log of new commits:

Author: kgv
Date: Wed Oct 2 16:57:59 2019 +0300

    # OpenGl_ShaderManager::defaultGlslVersion() - define minimal GLSL version for PBR
    # as OpenGL 3.0, OpenGL ES 3.0 or OpenGL 2.1 + GL_EXT_gpu_shader4

Author: kgv
Date: Wed Oct 2 16:13:40 2019 +0300

    occLight_IsHeadlight() now returns bool instead of int.
    Avoid using lowp for enumerations.
    
    Workaround occLight_IsHeadlight() ignorance on Adreno 308
    caused by some GLSL optimizator bugs.

Author: kgv
Date: Wed Oct 2 13:44:01 2019 +0300

    # THE_FUNC_PBR_directionalLightFirst - eliminate redundant duplicate

(0087700)
git   
2019-10-02 17:45   
Branch CR30700_1 has been updated by kgv.

SHA-1: 9ee6734946ed2dba4578a58831e89affb62df8a5


Detailed log of new commits:

Author: kgv
Date: Wed Oct 2 17:45:06 2019 +0300

    # OpenGl_FrameBuffer::BufferDump - suppress compiler warning concerning Image_Format_RGF

(0087726)
git   
2019-10-02 22:26   
Branch CR30700_1 has been updated by kgv.

SHA-1: 48867171d2130842f730c0f500c686b357584167


Detailed log of new commits:

Author: kgv
Date: Wed Oct 2 22:26:26 2019 +0300

    # fix LUT texture initialization on Android, where GL_RG32F is NOT texture-filterable format on most hardware.
    # GL_RG16F is used instead.

(0087769)
git   
2019-10-03 15:32   
Branch CR30700_1 has been updated by kgv.

SHA-1: 0560cc1ae61ee074457ef954967ccc701a241e3d


Detailed log of new commits:

Author: kgv
Date: Thu Oct 3 15:32:08 2019 +0300

    # fix GLSL compilation errors on PBR env baking program

(0087794)
git   
2019-10-03 20:29   
Branch CR30700_1 has been updated by kgv.

SHA-1: 9ef2ebc7d3f1a3339b066532a67d84a667d13d0b


Detailed log of new commits:

Author: kgv
Date: Thu Oct 3 20:28:53 2019 +0300

    # cosmetics

(0087795)
git   
2019-10-03 21:19   
Branch CR30700_1 has been updated by kgv.

SHA-1: e189c6dbd6b959bfd95d90145f6cfdd92119787b


Detailed log of new commits:

Author: kgv
Date: Thu Oct 3 21:18:46 2019 +0300

    # cosmetics

(0087796)
git   
2019-10-03 21:39   
Branch CR30700_1 has been updated by kgv.

SHA-1: 0b775c11c37893eebd0b312ed1dad4f19d5caced


Detailed log of new commits:

Author: kgv
Date: Thu Oct 3 21:38:57 2019 +0300

    OpenGl_Texture::EstimatedDataSize() - fixed estimation for Cubemap textures

(0087797)
git   
2019-10-04 00:26   
Branch CR30700_1 has been updated by kgv.

SHA-1: 5796167188f4d75916483a31f73a0c46970c3f21


Detailed log of new commits:

Author: kgv
Date: Fri Oct 4 00:25:47 2019 +0300

    OpenGl_Sampler::applySamplerParams() - fixed uninitialized GL_TEXTURE_WRAP_R in case of GL_TEXTURE_CUBE_MAP target.

(0087810)
git   
2019-10-04 13:23   
Branch CR30700_1 has been updated by kgv.

SHA-1: 674ac02c5ec0651de287da4b148118524c9645fb


Detailed log of new commits:

Author: kgv
Date: Fri Oct 4 13:22:41 2019 +0300

    # OpenGl_PBREnvironment - performance profiling

(0087887)
kgv   
2019-10-06 10:41   
(edited on: 2019-10-06 11:26)
Adreno 512 - IBL baking hangs (application doesn't respond for some reason).
Times with added glFinish(), 1024 samples:
10-06 10:34:03.824 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.020619 s

10-06 10:34:03.839 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.013906 s

10-06 10:34:03.853 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.013695 s

10-06 10:34:03.866 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.012632 s

10-06 10:34:03.879 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.013041 s

10-06 10:34:03.892 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.012706 s

10-06 10:34:03.925 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.032434 s

10-06 10:34:03.958 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.032421 s

10-06 10:34:03.990 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.03109 s

10-06 10:34:04.015 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.024692 s

10-06 10:34:04.035 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.019536 s

10-06 10:34:04.055 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.019762 s

10-06 10:34:04.125 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.069585 s

10-06 10:34:04.170 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.044642 s

10-06 10:34:04.213 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.042468 s

10-06 10:34:04.255 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.042348 s

10-06 10:34:04.300 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.043973 s

10-06 10:34:04.347 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.04662 s

10-06 10:34:04.507 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.159907 
s
10-06 10:34:04.667 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.158927 
s
10-06 10:34:04.823 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.15533 
s
10-06 10:34:04.981 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.158143 
s
10-06 10:34:05.140 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.157671 
s
10-06 10:34:05.299 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.158583 
s
10-06 10:34:05.890 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.591154 
s
10-06 10:34:06.485 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.594755 
s
10-06 10:34:07.071 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.585593 
s
10-06 10:34:07.212 W/MiuiPerfServiceClient( 3422): interceptAndQueuing:2521|com.android.systemui|286|286|unknown|null|StatusBar|21902967364767|Slow 
swap buffers|1
10-06 10:34:07.660 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.588466 
s
10-06 10:34:08.249 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.588234 
s
10-06 10:34:08.841 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.591177 
s
10-06 10:34:09.197 D/PerfShielderService( 2317): com.android.systemui|StatusBar|461|21904143358257|461|6|1

10-06 10:34:09.198 W/MiuiPerfServiceClient( 3422): interceptAndQueuing:2521|com.android.systemui|461|461|unknown|null|StatusBar|21904143358257|Slow 
swap buffers|1
10-06 10:34:10.842 I/OpenGLRenderer( 2521): Davey! duration=1640ms; Flags=0, IntendedVsync=21905682908909, 
Vsync=21905682908909, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=21905683588100, 
AnimationStart=21905683628360, PerformTraversalsStart=21905683631641, DrawStart=21905683784923, SyncQueued=21905683817683, 
SyncStart=21905683907891, IssueDrawCommandsStart=21905684211537, SwapBuffers=21905688584141, FrameCompleted=21907323042266, 
DequeueBufferDuration=393000, QueueBufferDuration=1633728000, 
10-06 10:34:10.862 W/Adreno-GSL(11562): <gsl_ldd_control:548>: ioctl fd 55 code 0x400c0907 (IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID) 
failed: errno 35 Resource deadlock would occur
10-06 10:34:10.862 W/Adreno-GSL(11562): <log_gpu_snapshot:457>: panel.gpuSnapshotPath is not set.not 
generating user snapshot
10-06 10:34:10.862 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 2.02112 
s
10-06 10:34:10.863 W/Adreno-GSL(11562): <gsl_ldd_control:548>: ioctl fd 55 code 0xc040094a (IOCTL_KGSL_GPU_COMMAND) 
failed: errno 35 Resource deadlock would occur
10-06 10:34:10.863 W/Adreno-GSL(11562): <log_gpu_snapshot:457>: panel.gpuSnapshotPath is not set.not 
generating user snapshot
10-06 10:34:10.863 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 0.000637 
s
10-06 10:34:10.864 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 0.000138 
s
10-06 10:34:10.864 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 1.3e-05 
s
10-06 10:34:10.864 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 1.1e-05 
s
10-06 10:34:10.864 D/CadAssistant(11562): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 1.1e-05 
s
10-06 10:34:10.864 D/CadAssistant(11562): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 1.1e-05 s

10-06 10:34:10.865 D/CadAssistant(11562): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 1.2e-05 s

10-06 10:34:10.865 D/CadAssistant(11562): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 1.1e-05 s

10-06 10:34:10.865 D/CadAssistant(11562): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 1.1e-05 s

10-06 10:34:10.866 D/CadAssistant(11562): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 1.1e-05 s

10-06 10:34:10.866 D/CadAssistant(11562): IBL 512x512 is baked in 7.06202 s


(0087888)
kgv   
2019-10-06 10:55   
(edited on: 2019-10-06 11:26)
Mali-G51 (application works), 1024 samples:
10-06 10:51:27.521 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.020527 s

10-06 10:51:27.536 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.014951 s

10-06 10:51:27.551 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.014991 s

10-06 10:51:27.565 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.012778 s

10-06 10:51:27.578 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.013232 s

10-06 10:51:27.593 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 5 16x16) filled in 0.013895 s

10-06 10:51:27.635 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.041807 s

10-06 10:51:27.678 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.042113 s

10-06 10:51:27.721 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.042033 s

10-06 10:51:27.759 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.037676 s

10-06 10:51:27.802 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.041821 s

10-06 10:51:27.838 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 4 32x32) filled in 0.03608 s

10-06 10:51:27.906 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.0673 s

10-06 10:51:27.974 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.067517 s

10-06 10:51:28.042 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.066943 s

10-06 10:51:28.114 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.064439 s

10-06 10:51:28.175 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.060736 s

10-06 10:51:28.236 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 3 64x64) filled in 0.059916 s

10-06 10:51:28.440 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.202953 
s
10-06 10:51:28.600 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.159407 
s
10-06 10:51:28.743 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.14278 
s
10-06 10:51:29.185 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 2 128x128) filled in 0.154375 
s
10-06 10:51:29.773 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.586699 
s
10-06 10:51:30.367 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.593637 
s
10-06 10:51:30.955 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.587042 
s
10-06 10:51:31.549 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.593025 
s
10-06 10:51:32.129 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.579944 
s
10-06 10:51:32.718 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 1 256x256) filled in 0.588718 
s
10-06 10:51:37.367 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 2.32203 
s
10-06 10:51:44.333 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 2.31021 
s
10-06 10:51:46.672 D/CadAssistant(24425): processIBLMap(SPECULAR, DRAW, 0 512x512) filled in 2.33801 
s
10-06 10:51:48.673 D/CadAssistant(24425): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 2.00075 s

10-06 10:51:50.691 D/CadAssistant(24425): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 2.01699 s

10-06 10:51:52.712 D/CadAssistant(24425): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 2.02012 s

10-06 10:51:54.718 D/CadAssistant(24425): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 2.00565 s

10-06 10:51:56.733 D/CadAssistant(24425): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 2.01491 s

10-06 10:51:58.744 D/CadAssistant(24425): processIBLMap(DIFFUSE, DRAW, 0 512x512) filled in 2.00954 s

10-06 10:51:58.744 D/CadAssistant(24425): IBL 512x512 is baked in 31.244 s


(0087889)
kgv   
2019-10-06 11:25   
(edited on: 2019-10-06 11:56)
For comparison, it looks like three.js uses just 32 samples by default (1024 in OCCT within current patch):
    var PMREMGenerator = function ( sourceTexture, samplesPerLevel, resolution ) {
        this.resolution = ( resolution !== undefined ) ? resolution : 256; // NODE: 256 is currently 
hard coded in the glsl code for performance reasons
this.samplesPerLevel = ( samplesPerLevel !== undefined ) ? samplesPerLevel : 32;


but this is probably done with some hack in math and causes visual artifacts:
> By using the previous convolved maps,
> a lower number of samples are generally sufficient
>(right now 32, which gives okay results
> unless we see the reflection very carefully, or zoom in too much

(0087890)
kgv   
2019-10-06 11:38   
Adreno 308 bakes 512 environment with 100 samples within 28 seconds.
(0088246)
git   
2019-10-17 12:33   
Branch CR30700_1 has been updated by iko.

SHA-1: e3b0713609f7ebe01f6de31f28661c9c0b90157a


Detailed log of new commits:

Author: iko
Date: Thu Oct 17 12:30:47 2019 +0300

    # spherical harmonics work in progress