<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi Robert,</p>
<p><br>
</p>
<p> 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.<br>
</p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div style="font-family:Tahoma; font-size:13px">
<div class="BodyFragment"><font size="2"><span style="font-size:10pt">
<div class="PlainText"><font size="2"><span style="font-size:10pt"><i>Regards,</i><br>
<b>Clement Chu</b><br>
</span></font></div>
</span></font></div>
</div>
</div>
</div>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> osg-users <osg-users-bounces@lists.openscenegraph.org> on behalf of Robert Osfield <robert.osfield@gmail.com><br>
<b>Sent:</b> Friday, 1 September 2017 18:29<br>
<b>To:</b> OpenSceneGraph Users<br>
<b>Subject:</b> Re: [osg-users] RayTracedTechnique hangs with Intel HD Graphics - Update</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>Hi Clement,<br>
<br>
</div>
The numerical issue you have found causing a crash is a curious one. <br>
<br>
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.</div>
<div><br>
</div>
<div>Is there are specific line in the shader that you think is cause the crash?<br>
</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Robert.<br>
</div>
<div><br>
</div>
Robert.<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 1 September 2017 at 08:11, <span dir="ltr"><<a href="mailto:Clement.Chu@csiro.au" target="_blank">Clement.Chu@csiro.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
Hi,<br>
<br>
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,<br>
<br>
vec4 t0 = vertexPos;<br>
vec4 te = cameraPos;<br>
<br>
// by default te did to check the range (0 and 1), but t0 did not.<br>
// If I added some codes to check the range, then the problem is completed gone.<br>
<br>
if (t0.x<0.0) t0.x = 0.0; if (t0.x>1.0) t0.x = 1.0;<br>
if (t0.y<0.0) t0.y = 0.0; if (t0.y>1.0) t0.y = 1.0;<br>
f (t0.z<0.0) t0.z = 0.0; if (t0.z>1.0) t0.z = 1.0;<br>
<br>
<br>
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.<br>
<br>
<br>
Regards,<br>
Clement Chu<br>
<br>
______________________________<wbr>__________<br>
From: osg-users <<a href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.<wbr>openscenegraph.org</a>> on behalf of Clement.Chu@csiro.au <Clement.Chu@csiro.au><br>
Sent: Wednesday, 30 August 2017 17:31<br>
To: <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
Subject: [ExternalEmail] [osg-users] RayTracedTechnique hangs with Intel HD Graphics<br>
<br>
Hi,<br>
<br>
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.<br>
<br>
<br>
Regards,<br>
Clement Chu<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>