OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

RayTracedTechnique hangs with Intel HD Graphics - Update


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Clement
User


Joined: 08 Jul 2011
Posts: 97

PostPosted: Fri Sep 01, 2017 7:12 am    Post subject:
RayTracedTechnique hangs with Intel HD Graphics - Update
Reply with quote

Hi,

Finally I found where causes the problem. For some reasons, gl_Vertex is not normalized. I looked at osg shader source code (src\osgVolume\Shaders). For example, in file volume_frag.cpp,

vec4 t0 = vertexPos;
vec4 te = cameraPos;

// by default te did to check the range (0 and 1), but t0 did not.
// If I added some codes to check the range, then the problem is completed gone.

if (t0.x<0.0) t0.x = 0.0; if (t0.x>1.0) t0.x = 1.0;
if (t0.y<0.0) t0.y = 0.0; if (t0.y>1.0) t0.y = 1.0;
f (t0.z<0.0) t0.z = 0.0; if (t0.z>1.0) t0.z = 1.0;


I believe the problem is related to GLSL version and latest Intel HD Graphics driver is using higher version of GLSL, but gl_Vertex does not normalize or the value is just over 1 or less then 0 (eg. 1.00001). Then it causes the crash when running the sampling loop. I am not an expert on GLSL, so I would like to confirm the best solution to handle this problem. Thanks.


Regards,
Clement Chu

________________________________________
From: osg-users <> on behalf of <>
Sent: Wednesday, 30 August 2017 17:31
To:
Subject: [ExternalEmail] RayTracedTechnique hangs with Intel HD Graphics

Hi,

My program uses RayTracedTechnique for volume rendering, but it hangs with Intel HD graphics 520, 530 and 620. My old laptop works fine which is using Intel HD Graphic 3000. Other machines with Nvidia cards are working fine too. I believe the problem is on shaders in the sampling loop. My program is using osg 3.2.3. I also tried to upgrade to osg 3.4.1, but the same problem occurred with Intel HD Graphic 520, 530 and 620. Do anyone have similar problem and any solution to fix it? Many thanks.


Regards,
Clement Chu



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11152

PostPosted: Fri Sep 01, 2017 8:30 am    Post subject:
RayTracedTechnique hangs with Intel HD Graphics - Update
Reply with quote

Hi Clement,


The numerical issue you have found causing a crash is a curious one.

The gl_Vertex isn't a normalized on any system, osgVolume::RayTracedTechnique does use a unit cube for it's geometry though, so the vertex data should all be in the 0.0f to 1.0f range.  Perhaps the intel driver/hardware combination is resulting in some numerical precision issue so that the values are going slightly outside the 0 to 1.0f range, but even if it does I wouldn't expect the fragment shaders to suddenly have problems.


Is there are specific line in the shader that you think is cause the crash?



FYI, osgVolume checks for the shader/volume.vert and shader/volume.frag filenames first then fallsback to the built in shaders that are found in the src/osgVolume/Shaders/volume_frag.cpp.  The shader/volume.frag can be found in OpenSceneGraph-Data/shader so if you have this available and it's on the OSG_FILE_PATH then you should be able to edit the shader files without recompiling the application.


Robert.



Robert.


On 1 September 2017 at 08:11, < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

   Finally I found where causes the problem.  For some reasons, gl_Vertex is not normalized.  I looked at osg shader source code (srcosgVolumeShaders).  For example, in file volume_frag.cpp,

vec4 t0 = vertexPos;
vec4 te = cameraPos;

// by default te did to check the range (0 and 1), but t0 did not.
// If I added  some codes to check the range, then the problem is completed gone.

if (t0.x<0.0) t0.x = 0.0; if (t0.x>1.0) t0.x = 1.0;
if (t0.y<0.0) t0.y = 0.0; if (t0.y>1.0) t0.y = 1.0;
f (t0.z<0.0) t0.z = 0.0; if (t0.z>1.0) t0.z = 1.0;


I believe the problem is related to GLSL version and latest Intel HD Graphics driver is using higher version of GLSL, but gl_Vertex does not normalize or the value is just over 1 or less then 0 (eg. 1.00001).  Then it causes the crash when running the sampling loop.  I am not an expert on GLSL, so I would like to confirm the best solution to handle this problem. Thanks.


Regards,
Clement Chu

________________________________________
From: osg-users < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> on behalf of <>
Sent: Wednesday, 30 August 2017 17:31
To: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Subject: [ExternalEmail] RayTracedTechnique hangs with Intel HD Graphics

Hi,

   My program uses RayTracedTechnique for volume rendering, but it hangs with Intel HD graphics 520, 530 and 620. My old laptop works fine which is using Intel HD Graphic 3000.  Other machines with Nvidia cards are working fine too.  I believe the problem is on shaders in the sampling loop.  My program is using osg 3.2.3.  I also tried to upgrade to osg 3.4.1, but the same problem occurred with Intel HD Graphic 520, 530 and 620.  Do anyone have similar problem and any solution to fix it?  Many thanks.


Regards,
Clement Chu
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Clement
User


Joined: 08 Jul 2011
Posts: 97

PostPosted: Fri Sep 01, 2017 9:27 am    Post subject:
RayTracedTechnique hangs with Intel HD Graphics - Update
Reply with quote

Hi Robert,


Since I don't know how to debug or print message in shader code, I am not sure what exact value of vertex. I guess the value of vertex is not in the range (0.0 to 1.0), so texture3D method cannot get correct color value by coordinate. In file volume_frag.cpp, variable texcoord is assigned from vertex data. If vertex data is not the 0.0f to 1.0f range, variable color (type vec4) will become strange value. Even I added some codes to make sure values of color.x, color.y, color.z and color.w in the range (0.0 to 1.0), it still cause the crash. Unless vertex is in the range (0.0 to 1.0). So far, this problem occurs in Intel HD Graphics 520 or above. My old laptop is Intel HD Graphics 3000, but it works fine and Nvidia cards work fine too.




Regards,
Clement Chu





From: osg-users <> on behalf of Robert Osfield <>
Sent: Friday, 1 September 2017 18:29
To: OpenSceneGraph Users
Subject: Re: RayTracedTechnique hangs with Intel HD Graphics - Update

Hi Clement,


The numerical issue you have found causing a crash is a curious one.

The gl_Vertex isn't a normalized on any system, osgVolume::RayTracedTechnique does use a unit cube for it's geometry though, so the vertex data should all be in the 0.0f to 1.0f range. Perhaps the intel driver/hardware combination is resulting in some numerical precision issue so that the values are going slightly outside the 0 to 1.0f range, but even if it does I wouldn't expect the fragment shaders to suddenly have problems.


Is there are specific line in the shader that you think is cause the crash?



FYI, osgVolume checks for the shader/volume.vert and shader/volume.frag filenames first then fallsback to the built in shaders that are found in the src/osgVolume/Shaders/volume_frag.cpp. The shader/volume.frag can be found in OpenSceneGraph-Data/shader so if you have this available and it's on the OSG_FILE_PATH then you should be able to edit the shader files without recompiling the application.


Robert.



Robert.


On 1 September 2017 at 08:11, < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

Finally I found where causes the problem. For some reasons, gl_Vertex is not normalized. I looked at osg shader source code (srcosgVolumeShaders). For example, in file volume_frag.cpp,

vec4 t0 = vertexPos;
vec4 te = cameraPos;

// by default te did to check the range (0 and 1), but t0 did not.
// If I added some codes to check the range, then the problem is completed gone.

if (t0.x<0.0) t0.x = 0.0; if (t0.x>1.0) t0.x = 1.0;
if (t0.y<0.0) t0.y = 0.0; if (t0.y>1.0) t0.y = 1.0;
f (t0.z<0.0) t0.z = 0.0; if (t0.z>1.0) t0.z = 1.0;


I believe the problem is related to GLSL version and latest Intel HD Graphics driver is using higher version of GLSL, but gl_Vertex does not normalize or the value is just over 1 or less then 0 (eg. 1.00001). Then it causes the crash when running the sampling loop. I am not an expert on GLSL, so I would like to confirm the best solution to handle this problem. Thanks.


Regards,
Clement Chu

________________________________________
From: osg-users < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> on behalf of <>
Sent: Wednesday, 30 August 2017 17:31
To: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Subject: [ExternalEmail] RayTracedTechnique hangs with Intel HD Graphics

Hi,

My program uses RayTracedTechnique for volume rendering, but it hangs with Intel HD graphics 520, 530 and 620. My old laptop works fine which is using Intel HD Graphic 3000. Other machines with Nvidia cards are working fine too. I believe the problem is on shaders in the sampling loop. My program is using osg 3.2.3. I also tried to upgrade to osg 3.4.1, but the same problem occurred with Intel HD Graphic 520, 530 and 620. Do anyone have similar problem and any solution to fix it? Many thanks.


Regards,
Clement Chu
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11152

PostPosted: Fri Sep 01, 2017 1:42 pm    Post subject:
RayTracedTechnique hangs with Intel HD Graphics - Update
Reply with quote

HI Clement,

On 1 September 2017 at 10:26, < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
  Since I don't know how to debug or print message in shader code, I am not sure what exact value of vertex.  I guess the value of vertex is not in the range (0.0 to 1.0), so texture3D method cannot get correct color value by coordinate.  In file volume_frag.cpp,  variable texcoord is assigned from vertex data. If vertex data is not the 0.0f to 1.0f range, variable color (type vec4) will become strange value.  Even I added some codes to make sure values of color.x, color.y, color.z and color.w  in the range (0.0 to 1.0), it still cause the crash. Unless vertex is in the range (0.0 to 1.0). So far, this problem occurs in Intel HD Graphics 520 or above.  My old laptop is Intel HD Graphics 3000, but it works fine and Nvidia cards work fine too.


Debugging shaders is *really* hard because you just can't put in break points, print out values, do any of the normal debugging approaches we take for granted on the desktop.  So it's a case of think of idea what might be wrong, adapt the shaders to test that, run them app and just and make sense of the results. 



The fact that shaders can be loaded and compiled at runtime helps reduce the time takes to see changes so this can help a bit, for yourself I would certainly recommend copying the volume.vert and volume.frag shaders from OpenSceneGraph-Data, put  them on your path as use in testing.


Another thing that might help if you are having to put "workaround" code in just for a certain hardware vendor then the vendor string and #pragma(tic) shader composition might be of help.  I use this facility to detect and provide a workaround for an NVidia issue - look at how NVIDIA_Corporation is used in the shaders.  The osg::State object checks the GL_VENDOR string at runtime and sets a #define with this value that you can then reference using #pragma import_defines(..). 



I don't know what the string will be for Intel.  Run an OSG application with the OSG_NOTIFY_LEVEL set to INFO and search the console output for a "GL_VENDOR = " entry.  You can they use this in the shader mods.


--


On the specific issue of the vertex value clamping, RayTracedTechnique creates a box with dimensons of 0,0,0 to 1,1,1 so there shouldn't be any values outside this being passed to the vertex shader. However, the CPU->driver->GPU might be changing the precision enough that you are getting values outside this range.  I find it odd that the shaders would be sensitive to such small precision issues though.


Robert.

 

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 315

PostPosted: Sat Sep 02, 2017 5:51 pm    Post subject:
Re: RayTracedTechnique hangs with Intel HD Graphics - Update
Reply with quote

Hi,
it surely is the duplicate of
http://forum.openscenegraph.org/viewtopic.php?t=14304
The problem seams fixes by l76
Code:
                                       "    #ifdef NVIDIA_Corporation\n"
                     "    // Recent NVidia drivers have a bug in length() where it throws nan for some values of input into length() so catch these\n"
                     "    else if (num_iterations!=num_iterations) num_iterations = max_iteratrions;\n"
                     "    #endif\n"

Perhaps you should try changing this ifdef

I'm using MultipassTechnique since a few time and there's not this issue.


cheers

Clement wrote:
Hi,

Finally I found where causes the problem. For some reasons, gl_Vertex is not normalized. I looked at osg shader source code (src\osgVolume\Shaders). For example, in file volume_frag.cpp,

vec4 t0 = vertexPos;
vec4 te = cameraPos;

// by default te did to check the range (0 and 1), but t0 did not.
// If I added some codes to check the range, then the problem is completed gone.

if (t0.x<0.0) t0.x = 0.0; if (t0.x>1.0) t0.x = 1.0;
if (t0.y<0.0) t0.y = 0.0; if (t0.y>1.0) t0.y = 1.0;
f (t0.z<0.0) t0.z = 0.0; if (t0.z>1.0) t0.z = 1.0;


I believe the problem is related to GLSL version and latest Intel HD Graphics driver is using higher version of GLSL, but gl_Vertex does not normalize or the value is just over 1 or less then 0 (eg. 1.00001). Then it causes the crash when running the sampling loop. I am not an expert on GLSL, so I would like to confirm the best solution to handle this problem. Thanks.


Regards,
Clement Chu

________________________________________
From: osg-users <> on behalf of <>
Sent: Wednesday, 30 August 2017 17:31
To:
Subject: [ExternalEmail] RayTracedTechnique hangs with Intel HD Graphics

Hi,

My program uses RayTracedTechnique for volume rendering, but it hangs with Intel HD graphics 520, 530 and 620. My old laptop works fine which is using Intel HD Graphic 3000. Other machines with Nvidia cards are working fine too. I believe the problem is on shaders in the sampling loop. My program is using osg 3.2.3. I also tried to upgrade to osg 3.4.1, but the same problem occurred with Intel HD Graphic 520, 530 and 620. Do anyone have similar problem and any solution to fix it? Many thanks.


Regards,
Clement Chu



------------------
Post generated by Mail2Forum
Code:


Last edited by mp3butcher (Julien Valentin) on Sat Sep 02, 2017 6:20 pm; edited 4 times in total
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 315

PostPosted: Sat Sep 02, 2017 5:59 pm    Post subject:
Re: RayTracedTechnique hangs with Intel HD Graphics - Update
Reply with quote

Back to top
View user's profile Send private message
Clement
User


Joined: 08 Jul 2011
Posts: 97

PostPosted: Sun Sep 03, 2017 2:27 am    Post subject:
RayTracedTechnique hangs with Intel HD Graphics - Update
Reply with quote

Hi,

This is two different problems. The length method problem is fixed since osg 3.2.3. See this post http://forum.openscenegraph.org/viewtopic.php?t=15148 for the details.

Recently, I found the problem is related to Intel graphic driver. Specify on latest Intel graphic cards. My work laptop is dell and there is no problem on old Intel graphic card. Since I changed to new dell laptop with latest Intel graphic card, I found the problem is on gl_Vertex which value is not normalised and causes the crash on sampling loop. So far I tested 5 different laptops with different Intel graphic cards. Only Intel graphic card with 3 digit version number will cause the problem (old Intel card is using 4 digit for version).

Regards,
Clement Chu

________________________________________
From: osg-users <> on behalf of Julien Valentin <>
Sent: Sunday, 3 September 2017 04:00
To:
Subject: Re: RayTracedTechnique hangs with Intel HD Graphics - Update

Hi,
it surely is the duplicate of
http://forum.openscenegraph.org/viewtopic.php?t=14304
I thought this issue was fixed since all this time
The hack i use is there
curious bug indeed, and so curious solution too
@robert
Perhaps it may be merged into master...your call...

cheers


Clement wrote:
Quote:
Hi,

Finally I found where causes the problem. For some reasons, gl_Vertex is not normalized. I looked at osg shader source code (src\osgVolume\Shaders). For example, in file volume_frag.cpp,

vec4 t0 = vertexPos;
vec4 te = cameraPos;

// by default te did to check the range (0 and 1), but t0 did not.
// If I added some codes to check the range, then the problem is completed gone.

if (t0.x<0.0) t0.x = 0.0; if (t0.x>1.0) t0.x = 1.0;
if (t0.y<0.0) t0.y = 0.0; if (t0.y>1.0) t0.y = 1.0;
f (t0.z<0.0) t0.z = 0.0; if (t0.z>1.0) t0.z = 1.0;


I believe the problem is related to GLSL version and latest Intel HD Graphics driver is using higher version of GLSL, but gl_Vertex does not normalize or the value is just over 1 or less then 0 (eg. 1.00001). Then it causes the crash when running the sampling loop. I am not an expert on GLSL, so I would like to confirm the best solution to handle this problem. Thanks.


Regards,
Clement Chu

________________________________________
From: osg-users <> on behalf of <>
Sent: Wednesday, 30 August 2017 17:31
To:
Subject: [ExternalEmail] RayTracedTechnique hangs with Intel HD Graphics

Hi,

My program uses RayTracedTechnique for volume rendering, but it hangs with Intel HD graphics 520, 530 and 620. My old laptop works fine which is using Intel HD Graphic 3000. Other machines with Nvidia cards are working fine too. I believe the problem is on shaders in the sampling loop. My program is using osg 3.2.3. I also tried to upgrade to osg 3.4.1, but the same problem occurred with Intel HD Graphic 520, 530 and 620. Do anyone have similar problem and any solution to fix it? Many thanks.


Regards,
Clement Chu
_______________________________________________
osg-users mailing list

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

------------------
Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71607#71607








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Running a per-frame task on the graph... James Turner General 0 Fri Sep 22, 2017 8:53 am View latest post
No new posts RayTracedTechnique hangs with Intel H... Clement General 0 Wed Aug 30, 2017 7:32 am View latest post
No new posts Update to Depth Patitioner ravidavi General 2 Tue May 23, 2017 9:03 pm View latest post
No new posts Update to FindCollada.cmake zonk Submission 12 Tue Apr 04, 2017 8:54 pm View latest post
No new posts Computer Graphics for Simulation Pape... John Richardson General 0 Fri Jan 13, 2017 6:56 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP