MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0032606Open CASCADE[OCCT] OCCT:Visualizationpublic2021-10-04 14:382021-12-01 01:40
Reporterage 
Assigned Tokgv 
PrioritynormalSeverityfeature 
StatusresolvedResolutionopen 
PlatformOSOS Version
Product Version[OCCT] 7.5.0 
Target Version[OCCT] 7.7.0Fixed in Version 
Summary0032606: Visualization - add a shader for sky
DescriptionIt is needed to add an option to show shader-generated sky as a background
Steps To Reproducenot required
TagsNo tags attached.
Test case number
Attached Filespng file icon Sunset_With_Clouds2.PNG (602,767 bytes) 2021-10-19 02:33

- Relationships

-  Notes
(0104693)
git (administrator)
2021-10-18 07:26

Branch CR32606 has been created by CheskoArt.

SHA-1: 13c39fc8f01325cd116de96ea45196bf77cf10be


Detailed log of new commits:

Author: achesnok
Date: Fri Oct 15 01:50:13 2021 +0300

    Added skydome background
(0104694)
kgv (developer)
2021-10-18 10:39

> Added skydome background CR32606
Please don't forget that first commit in git branch should start with a full bug title, e.g.
> 0032606: Visualization - add a shader for sky
(0104716)
kgv (developer)
2021-10-18 18:35

+Standard_EXPORT Standard_Boolean OpenGl_BackgroundArray::createSkydomeArray() const
...
@@ -580,7 +649,7 @@ void OpenGl_BackgroundArray::Render (const Handle(OpenGl_Workspace)& theWorkspac
     
if (aCtx->Camera()->Tile().IsValid())
     {
       aWorldView.SetDiagonal (OpenGl_Vec4 (2.0f / aTileSize.x(), 2.0f / aTileSize.y(), 1.0f, 1.0f));

-      if (myType == Graphic3d_TOB_GRADIENT)
+      if (myType == Graphic3d_TOB_GRADIENT || myType == Graphic3d_TOB_SKYDOME)

As far as I can see, the skybox is rendered as a cube.
Could you try reusing OpenGl_BackgroundArray::createCubeMapArray()?
I guess the same array could be initialized.
And also use Graphic3d_TOB_CUBEMAP rendering path instead of Graphic3d_TOB_GRADIENT to properly handle stereoscopic / VR output.

+Standard_EXPORT Standard_Boolean OpenGl_BackgroundArray::createSkydomeArray() const

Standard_EXPORT is normally expected only in header files.
(0104722)
git (administrator)
2021-10-19 02:30

Branch CR32606 has been updated forcibly by CheskoArt.

SHA-1: 681ad4b3bb4ea1f6f96c0671ab9ad76732c769bf
(0104723)
CheskoArt (developer)
2021-10-19 02:33

Work in progress yet. Ok, i will try to reuse Cubemap.
(0105052)
git (administrator)
2021-11-06 17:46

Branch CR32606 has been updated forcibly by CheskoArt.

SHA-1: dab11880a9e627506cbac89dd48010bd209ccc59
(0105053)
git (administrator)
2021-11-06 17:55

Branch CR32606 has been updated forcibly by CheskoArt.

SHA-1: 9fe553b61c9dd78211198f00ee9350dca1ce0523
(0105054)
git (administrator)
2021-11-06 18:39

Branch CR32606 has been updated forcibly by CheskoArt.

SHA-1: f7fedc19a7bf889b207e9d1fe76e280c863d3366
(0105093)
git (administrator)
2021-11-11 00:01

Branch CR32606 has been updated forcibly by CheskoArt.

SHA-1: 4cc6b85278a0e23c2b42c5b12a46ecb98a048516
(0105098)
CheskoArt (developer)
2021-11-11 02:12

Please review the patch.
Test results: http://jenkins-test-12.nnov.opencascade.com/view/CR32606-master-achesnok/view/ALL/ [^]
(0105118)
kgv (developer)
2021-11-11 12:37

  - Added new 'vskydome' DRAW command.

It would be better moving `vskydome` functionality directly to `vbackground`.

+  if (theSunDirection.Modulus() < Precision::Confusion())
+    mySunDirection = Graphic3d_Vec3(0.0f, 1.0f, 0.0f);

It is preferred putting if/else body into figure brackets even for single-liners.

+  if (theSunDirection.Modulus() < Precision::Confusion())
+    mySunDirection = Graphic3d_Vec3(0.0f, 1.0f, 0.0f);
+
+  mySunDirection = theSunDirection.Normalized();

mySunDirection initialization to (0,1,0) has no effect.

+  //! Set sun direction (must be not null-length vec).
+  //! Sun direction with negative Y component represents moon with (-X, -Y, -Z) direction.
+  Standard_EXPORT void SetSunDirection (const Graphic3d_Vec3& theSunDirection);

Please use gp_Dir here as a more straightforward interface (it is not a performance-critical part).

+  Graphic3d_Vec3     SunDirection() const { return mySunDirection; }

Please return `const &`.

+  Standard_ShortReal Foggy() const { return myHaze; }
+  Standard_ShortReal Cloudy()  const { return myCloudy; }

I would expect these parameters being named "fogginess" and "cloudiness".
Better using the same name for class properties instead of "myHaze".

+  //! @param theCloudy [in] cloud intensity, 0.0 means no cloud at all and 1.0 - high clody.

Please use "@param[in] theCloudy" syntax for Doxygen.

+  //! Get cloud intensity.
+  Standard_ShortReal Cloudy()  const { return myCloudy; }

Please document valid range of properties and their default values.

+  //! Get time (parameter) of cloud simulation.
+  Standard_ShortReal TimeParameter() const { return myTime; }

Please document time units, it's meaning and valid range.

+#include "Aspect_SkydomeBackground.hxx"

Angle brackets.

+  myHaze = theFoggy < 0.0f ? 0.0f : theFoggy;

It is better raising an exception on invalid input rather than silently ignoring it.

+
+

Redundant double empty line.

+Standard_EXPORT Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getBgSkydomeProgram() const


Standard_EXPORT is normally not supposed to be used in .cxx file - only in .hxx at method declaration.

+    OpenGl_FrameBuffer::BufferDump(aCtx, aFBO, *aSide, Graphic3d_BufferType::Graphic3d_BT_RGBA);

OpenGl_FrameBuffer::BufferDump() is very expensive.
It is desired performing skydom rendering directly into CubeMap texture.
Take a look onto OpenGl_PBREnvironment as an example of code creating FBO for a cubemap texture.

+float smoothStarField (vec2 theSamplePos)

`in` attribute is missing.

+float smoothNoise (vec3 p)
+{
+    vec3 i = floor (p);

Broken indentation. Variable names do not meet Coding Style.

+float clouds (in vec3 aTs, in float theTime)

theTs.
(0105121)
kgv (developer)
2021-11-11 12:41

+vskydome -size 128 -cloud 0.3 -sunDir 1.0 0.5 0.0
+vbackground -sky
+vaxo
+vdump $imagedir/${casename}.png

Please extend test case with more variations of parameters.
(0105129)
kgv (developer)
2021-11-11 14:32

(0105549)
git (administrator)
2021-12-01 01:37

Branch CR32606 has been updated forcibly by CheskoArt.

SHA-1: 3a6069c5d6f81fe640632ef62373d2ea05d1bfad
(0105550)
CheskoArt (developer)
2021-12-01 01:40

Fixed all remarks. Please review patch.

- Issue History
Date Modified Username Field Change
2021-10-04 14:38 age New Issue
2021-10-04 14:38 age Assigned To => CheskoArt
2021-10-11 14:47 CheskoArt Status new => assigned
2021-10-18 07:26 git Note Added: 0104693
2021-10-18 08:46 CheskoArt File Added: Sunset.PNG
2021-10-18 10:39 kgv Note Added: 0104694
2021-10-18 18:35 kgv Note Added: 0104716
2021-10-19 02:30 git Note Added: 0104722
2021-10-19 02:33 CheskoArt Note Added: 0104723
2021-10-19 02:33 CheskoArt File Deleted: Sunset.PNG
2021-10-19 02:33 CheskoArt File Added: Sunset_With_Clouds2.PNG
2021-11-06 17:46 git Note Added: 0105052
2021-11-06 17:55 git Note Added: 0105053
2021-11-06 18:39 git Note Added: 0105054
2021-11-11 00:01 git Note Added: 0105093
2021-11-11 02:12 CheskoArt Note Added: 0105098
2021-11-11 02:12 CheskoArt Assigned To CheskoArt => kgv
2021-11-11 02:12 CheskoArt Status assigned => resolved
2021-11-11 12:37 kgv Note Added: 0105118
2021-11-11 12:38 kgv Assigned To kgv => CheskoArt
2021-11-11 12:38 kgv Severity minor => feature
2021-11-11 12:38 kgv Status resolved => assigned
2021-11-11 12:41 kgv Note Added: 0105121
2021-11-11 14:32 kgv Note Added: 0105129
2021-12-01 01:37 git Note Added: 0105549
2021-12-01 01:40 CheskoArt Note Added: 0105550
2021-12-01 01:40 CheskoArt Assigned To CheskoArt => kgv
2021-12-01 01:40 CheskoArt Status assigned => resolved


Copyright © 2000 - 2021 MantisBT Team
Powered by Mantis Bugtracker