<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834</link>
    <title>MATLAB Central Newsreader - objects with transparency rendered using opengl looks wrong in export</title>
    <description>Feed for thread: objects with transparency rendered using opengl looks wrong in export</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 01 Jul 2008 09:35:08 -0400</pubDate>
      <title>objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#440469</link>
      <author>Abe Lau</author>
      <description>Hi all,&lt;br&gt;
I have been trying to plot some datum points using plot3 to&lt;br&gt;
a figure with a transparent surfaces created using patch and&lt;br&gt;
isosurface.&lt;br&gt;
&lt;br&gt;
However, whenever I want to export the figure to png/pdf,&lt;br&gt;
the datum points plotted will look as if it is inside the&lt;br&gt;
surface, even when the point is definitely outside the&lt;br&gt;
object (as confirmed by rotating the object).  The datum&lt;br&gt;
points look in front of the transparent object on screen&lt;br&gt;
(expected), but not in the exported pdf/png file.  Is it a&lt;br&gt;
known bug, or is there any workaround?  Thanks</description>
    </item>
    <item>
      <pubDate>Tue, 01 Jul 2008 09:53:18 -0400</pubDate>
      <title>Re: objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#440472</link>
      <author>tpl@eng.cam.ac.uk (Tim Love)</author>
      <description>&quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt;Hi all,&lt;br&gt;
&amp;gt;I have been trying to plot some datum points using plot3 to&lt;br&gt;
&amp;gt;a figure with a transparent surfaces created using patch and&lt;br&gt;
&amp;gt;isosurface.&lt;br&gt;
&lt;br&gt;
&amp;gt;However, whenever I want to export the figure to png/pdf&lt;br&gt;
If you've not already done so, it's worth reading about print's renderer&lt;br&gt;
and how it's chosen.&lt;br&gt;
&lt;br&gt;
Note also that in matlab 7.4 &quot;help print&quot; says&lt;br&gt;
&amp;nbsp;There are cases, however, where the printed output is not exactly&lt;br&gt;
&amp;nbsp;like the screen representation because of this. In these instances&lt;br&gt;
&amp;nbsp;specifying -zbuffer or -opengl will more likely give you output that&lt;br&gt;
&amp;nbsp;emulates the screen.&lt;br&gt;
(note, alas, the &quot;more likely&quot;)</description>
    </item>
    <item>
      <pubDate>Wed, 02 Jul 2008 01:43:05 -0400</pubDate>
      <title>Re: objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#440668</link>
      <author>Abe Lau</author>
      <description>tpl@eng.cam.ac.uk (Tim Love) wrote in message&lt;br&gt;
&amp;lt;g4cuqe$hr0$1@gemini.csx.cam.ac.uk&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;Hi all,&lt;br&gt;
&amp;gt; &amp;gt;I have been trying to plot some datum points using plot3 to&lt;br&gt;
&amp;gt; &amp;gt;a figure with a transparent surfaces created using patch and&lt;br&gt;
&amp;gt; &amp;gt;isosurface.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;However, whenever I want to export the figure to png/pdf&lt;br&gt;
&amp;gt; If you've not already done so, it's worth reading about&lt;br&gt;
print's renderer&lt;br&gt;
&amp;gt; and how it's chosen.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Note also that in matlab 7.4 &quot;help print&quot; says&lt;br&gt;
&amp;gt;  There are cases, however, where the printed output is not&lt;br&gt;
exactly&lt;br&gt;
&amp;gt;  like the screen representation because of this. In these&lt;br&gt;
instances&lt;br&gt;
&amp;gt;  specifying -zbuffer or -opengl will more likely give you&lt;br&gt;
output that&lt;br&gt;
&amp;gt;  emulates the screen.&lt;br&gt;
&amp;gt; (note, alas, the &quot;more likely&quot;)&lt;br&gt;
&lt;br&gt;
tpl, thx for your suggestion.  This is an interesting thing&lt;br&gt;
to try!  but unfortunately this doesn't fix the wrong&lt;br&gt;
viewpoint in the exported file.  The points which is&lt;br&gt;
obviously in front of the transparent surface still looks&lt;br&gt;
&quot;behind&quot; in the exported pdf&lt;br&gt;
&lt;br&gt;
just an example:&lt;br&gt;
load mri;&lt;br&gt;
figure; patch(isosurface(squeeze(D), 10),...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'FaceColor', [0.8 0.8 0.8],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'EdgeColor','none',...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'FaceAlpha', 0.8,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'AmbientStrength', 0.5,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'DiffuseStrength', 0.1,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'SpecularColorReflectance', 1,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'SpecularExponent', 0.5,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'SpecularStrength', 0.5);&lt;br&gt;
hold on; &lt;br&gt;
plot3(64,10,20, 'o',...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'MarkerSize', 20,...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'MarkerFaceColor', 'Blue')&lt;br&gt;
&lt;br&gt;
The blue dot is obviously way in front of the head if you&lt;br&gt;
rotate it, but when exported to pdf/png, the point looks as&lt;br&gt;
if it's hidden inside the head!  Would that be something&lt;br&gt;
wrong with my graphics card/OpenGL implementation?  would be&lt;br&gt;
great if someone can try the above out and let me know if&lt;br&gt;
they have the same issue or not.&lt;br&gt;
&lt;br&gt;
Thanks</description>
    </item>
    <item>
      <pubDate>Tue, 29 Jul 2008 12:05:02 -0400</pubDate>
      <title>Re: objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#446021</link>
      <author>Rebecca </author>
      <description>I've got the same problem, and have just tried your code and&lt;br&gt;
get the same result as you. Have you found a solution yet?&lt;br&gt;
&lt;br&gt;
&quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g4emf9$7fa$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; tpl@eng.cam.ac.uk (Tim Love) wrote in message&lt;br&gt;
&amp;gt; &amp;lt;g4cuqe$hr0$1@gemini.csx.cam.ac.uk&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;Hi all,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;I have been trying to plot some datum points using plot3 to&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;a figure with a transparent surfaces created using&lt;br&gt;
patch and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;isosurface.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;However, whenever I want to export the figure to png/pdf&lt;br&gt;
&amp;gt; &amp;gt; If you've not already done so, it's worth reading about&lt;br&gt;
&amp;gt; print's renderer&lt;br&gt;
&amp;gt; &amp;gt; and how it's chosen.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Note also that in matlab 7.4 &quot;help print&quot; says&lt;br&gt;
&amp;gt; &amp;gt;  There are cases, however, where the printed output is not&lt;br&gt;
&amp;gt; exactly&lt;br&gt;
&amp;gt; &amp;gt;  like the screen representation because of this. In these&lt;br&gt;
&amp;gt; instances&lt;br&gt;
&amp;gt; &amp;gt;  specifying -zbuffer or -opengl will more likely give you&lt;br&gt;
&amp;gt; output that&lt;br&gt;
&amp;gt; &amp;gt;  emulates the screen.&lt;br&gt;
&amp;gt; &amp;gt; (note, alas, the &quot;more likely&quot;)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; tpl, thx for your suggestion.  This is an interesting thing&lt;br&gt;
&amp;gt; to try!  but unfortunately this doesn't fix the wrong&lt;br&gt;
&amp;gt; viewpoint in the exported file.  The points which is&lt;br&gt;
&amp;gt; obviously in front of the transparent surface still looks&lt;br&gt;
&amp;gt; &quot;behind&quot; in the exported pdf&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; just an example:&lt;br&gt;
&amp;gt; load mri;&lt;br&gt;
&amp;gt; figure; patch(isosurface(squeeze(D), 10),...&lt;br&gt;
&amp;gt;     'FaceColor', [0.8 0.8 0.8],...&lt;br&gt;
&amp;gt;     'EdgeColor','none',...&lt;br&gt;
&amp;gt;     'FaceAlpha', 0.8,...&lt;br&gt;
&amp;gt;     'AmbientStrength', 0.5,...&lt;br&gt;
&amp;gt;     'DiffuseStrength', 0.1,...&lt;br&gt;
&amp;gt;     'SpecularColorReflectance', 1,...&lt;br&gt;
&amp;gt;     'SpecularExponent', 0.5,...&lt;br&gt;
&amp;gt;     'SpecularStrength', 0.5);&lt;br&gt;
&amp;gt; hold on; &lt;br&gt;
&amp;gt; plot3(64,10,20, 'o',...&lt;br&gt;
&amp;gt;     'MarkerSize', 20,...&lt;br&gt;
&amp;gt;     'MarkerFaceColor', 'Blue')&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The blue dot is obviously way in front of the head if you&lt;br&gt;
&amp;gt; rotate it, but when exported to pdf/png, the point looks as&lt;br&gt;
&amp;gt; if it's hidden inside the head!  Would that be something&lt;br&gt;
&amp;gt; wrong with my graphics card/OpenGL implementation?  would be&lt;br&gt;
&amp;gt; great if someone can try the above out and let me know if&lt;br&gt;
&amp;gt; they have the same issue or not.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks</description>
    </item>
    <item>
      <pubDate>Thu, 31 Jul 2008 06:05:11 -0400</pubDate>
      <title>Re: objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#446486</link>
      <author>Abe Lau</author>
      <description>&quot;Rebecca &quot; &amp;lt;rebecca.hodge@ges.gla.ac.uk&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g6n11e$anh$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I've got the same problem, and have just tried your code and&lt;br&gt;
&amp;gt; get the same result as you. Have you found a solution yet?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;g4emf9$7fa$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; tpl@eng.cam.ac.uk (Tim Love) wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;g4cuqe$hr0$1@gemini.csx.cam.ac.uk&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;Hi all,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;I have been trying to plot some datum points using&lt;br&gt;
plot3 to&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;a figure with a transparent surfaces created using&lt;br&gt;
&amp;gt; patch and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;isosurface.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;However, whenever I want to export the figure to png/pdf&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; If you've not already done so, it's worth reading about&lt;br&gt;
&amp;gt; &amp;gt; print's renderer&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; and how it's chosen.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Note also that in matlab 7.4 &quot;help print&quot; says&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  There are cases, however, where the printed output is not&lt;br&gt;
&amp;gt; &amp;gt; exactly&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  like the screen representation because of this. In these&lt;br&gt;
&amp;gt; &amp;gt; instances&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  specifying -zbuffer or -opengl will more likely give you&lt;br&gt;
&amp;gt; &amp;gt; output that&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;  emulates the screen.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; (note, alas, the &quot;more likely&quot;)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; tpl, thx for your suggestion.  This is an interesting thing&lt;br&gt;
&amp;gt; &amp;gt; to try!  but unfortunately this doesn't fix the wrong&lt;br&gt;
&amp;gt; &amp;gt; viewpoint in the exported file.  The points which is&lt;br&gt;
&amp;gt; &amp;gt; obviously in front of the transparent surface still looks&lt;br&gt;
&amp;gt; &amp;gt; &quot;behind&quot; in the exported pdf&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; just an example:&lt;br&gt;
&amp;gt; &amp;gt; load mri;&lt;br&gt;
&amp;gt; &amp;gt; figure; patch(isosurface(squeeze(D), 10),...&lt;br&gt;
&amp;gt; &amp;gt;     'FaceColor', [0.8 0.8 0.8],...&lt;br&gt;
&amp;gt; &amp;gt;     'EdgeColor','none',...&lt;br&gt;
&amp;gt; &amp;gt;     'FaceAlpha', 0.8,...&lt;br&gt;
&amp;gt; &amp;gt;     'AmbientStrength', 0.5,...&lt;br&gt;
&amp;gt; &amp;gt;     'DiffuseStrength', 0.1,...&lt;br&gt;
&amp;gt; &amp;gt;     'SpecularColorReflectance', 1,...&lt;br&gt;
&amp;gt; &amp;gt;     'SpecularExponent', 0.5,...&lt;br&gt;
&amp;gt; &amp;gt;     'SpecularStrength', 0.5);&lt;br&gt;
&amp;gt; &amp;gt; hold on; &lt;br&gt;
&amp;gt; &amp;gt; plot3(64,10,20, 'o',...&lt;br&gt;
&amp;gt; &amp;gt;     'MarkerSize', 20,...&lt;br&gt;
&amp;gt; &amp;gt;     'MarkerFaceColor', 'Blue')&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; The blue dot is obviously way in front of the head if you&lt;br&gt;
&amp;gt; &amp;gt; rotate it, but when exported to pdf/png, the point looks as&lt;br&gt;
&amp;gt; &amp;gt; if it's hidden inside the head!  Would that be something&lt;br&gt;
&amp;gt; &amp;gt; wrong with my graphics card/OpenGL implementation?  would be&lt;br&gt;
&amp;gt; &amp;gt; great if someone can try the above out and let me know if&lt;br&gt;
&amp;gt; &amp;gt; they have the same issue or not.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks&lt;br&gt;
&amp;gt; &lt;br&gt;
Hi Rebecca,&lt;br&gt;
unfortunately I have to say my experience with matlab export&lt;br&gt;
is really bad whenever there're transparent OpenGL object. &lt;br&gt;
The version I'm currently using (2008a) is even worse in&lt;br&gt;
this regard with saved figures not appearing the same when&lt;br&gt;
reopened, and all sorts of redrawing issues.&lt;br&gt;
&lt;br&gt;
I haven't found a decent solution, but a workaround is to&lt;br&gt;
avoid using plot3 at all.&lt;br&gt;
&lt;br&gt;
I just write up something like this to replace (or overlay)&lt;br&gt;
3D points (basically a sphere), not very sure what option&lt;br&gt;
you have for more complicated plots...&lt;br&gt;
&lt;br&gt;
function draw_sphere(centre, r, handle, varargin)&lt;br&gt;
&lt;br&gt;
% default no. of faces on the sphere&lt;br&gt;
n = 20;&lt;br&gt;
facealpha = 0.5;&lt;br&gt;
&lt;br&gt;
if nargin &amp;gt; 3&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;n = varargin{1};&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
if nargin &amp;gt; 4&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;facealpha = varargin{2};&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
% change to current axes&lt;br&gt;
figure(handle);&lt;br&gt;
&lt;br&gt;
[x y z] = sphere(n);&lt;br&gt;
&lt;br&gt;
% scale to radius&lt;br&gt;
x = x*r + centre(1);&lt;br&gt;
y = y*r + centre(2);&lt;br&gt;
z = z*r + centre(3);&lt;br&gt;
&lt;br&gt;
hold on;&lt;br&gt;
h_sphere = surface(x,y,z);&lt;br&gt;
hold off;&lt;br&gt;
&lt;br&gt;
% set alpha transparency and line width&lt;br&gt;
set(h_sphere, 'FaceAlpha', facealpha);&lt;br&gt;
set(h_sphere, 'LineWidth', 1);</description>
    </item>
    <item>
      <pubDate>Tue, 29 Sep 2009 09:48:01 -0400</pubDate>
      <title>Re: objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#683345</link>
      <author>Tim Hellwig</author>
      <description>Do you have any working solution to your problem yet?&lt;br&gt;
How do you workaround using plot3?&lt;br&gt;
I tried Scatter3 in combination with your implementation of a transparent sphere but i am getting the same results. Points appear to be inside the sphere.&lt;br&gt;
&lt;br&gt;
Best regards,&lt;br&gt;
Tim&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; wrote in message &amp;lt;g6rkmn$ld9$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Rebecca &quot; &amp;lt;rebecca.hodge@ges.gla.ac.uk&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;g6n11e$anh$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I've got the same problem, and have just tried your code and&lt;br&gt;
&amp;gt; &amp;gt; get the same result as you. Have you found a solution yet?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;g4emf9$7fa$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; tpl@eng.cam.ac.uk (Tim Love) wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;lt;g4cuqe$hr0$1@gemini.csx.cam.ac.uk&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &quot;Abe Lau&quot; &amp;lt;abe@nonexistancegmail.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt;Hi all,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt;I have been trying to plot some datum points using&lt;br&gt;
&amp;gt; plot3 to&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt;a figure with a transparent surfaces created using&lt;br&gt;
&amp;gt; &amp;gt; patch and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt;isosurface.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt;However, whenever I want to export the figure to png/pdf&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; If you've not already done so, it's worth reading about&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; print's renderer&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; and how it's chosen.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Note also that in matlab 7.4 &quot;help print&quot; says&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;  There are cases, however, where the printed output is not&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; exactly&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;  like the screen representation because of this. In these&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; instances&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;  specifying -zbuffer or -opengl will more likely give you&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; output that&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;  emulates the screen.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; (note, alas, the &quot;more likely&quot;)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; tpl, thx for your suggestion.  This is an interesting thing&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; to try!  but unfortunately this doesn't fix the wrong&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; viewpoint in the exported file.  The points which is&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; obviously in front of the transparent surface still looks&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &quot;behind&quot; in the exported pdf&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; just an example:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; load mri;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; figure; patch(isosurface(squeeze(D), 10),...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'FaceColor', [0.8 0.8 0.8],...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'EdgeColor','none',...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'FaceAlpha', 0.8,...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'AmbientStrength', 0.5,...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'DiffuseStrength', 0.1,...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'SpecularColorReflectance', 1,...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'SpecularExponent', 0.5,...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'SpecularStrength', 0.5);&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; hold on; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; plot3(64,10,20, 'o',...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'MarkerSize', 20,...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     'MarkerFaceColor', 'Blue')&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; The blue dot is obviously way in front of the head if you&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; rotate it, but when exported to pdf/png, the point looks as&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; if it's hidden inside the head!  Would that be something&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; wrong with my graphics card/OpenGL implementation?  would be&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; great if someone can try the above out and let me know if&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; they have the same issue or not.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Thanks&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; Hi Rebecca,&lt;br&gt;
&amp;gt; unfortunately I have to say my experience with matlab export&lt;br&gt;
&amp;gt; is really bad whenever there're transparent OpenGL object. &lt;br&gt;
&amp;gt; The version I'm currently using (2008a) is even worse in&lt;br&gt;
&amp;gt; this regard with saved figures not appearing the same when&lt;br&gt;
&amp;gt; reopened, and all sorts of redrawing issues.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I haven't found a decent solution, but a workaround is to&lt;br&gt;
&amp;gt; avoid using plot3 at all.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I just write up something like this to replace (or overlay)&lt;br&gt;
&amp;gt; 3D points (basically a sphere), not very sure what option&lt;br&gt;
&amp;gt; you have for more complicated plots...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function draw_sphere(centre, r, handle, varargin)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % default no. of faces on the sphere&lt;br&gt;
&amp;gt; n = 20;&lt;br&gt;
&amp;gt; facealpha = 0.5;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if nargin &amp;gt; 3&lt;br&gt;
&amp;gt;     n = varargin{1};&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if nargin &amp;gt; 4&lt;br&gt;
&amp;gt;     facealpha = varargin{2};&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % change to current axes&lt;br&gt;
&amp;gt; figure(handle);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [x y z] = sphere(n);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % scale to radius&lt;br&gt;
&amp;gt; x = x*r + centre(1);&lt;br&gt;
&amp;gt; y = y*r + centre(2);&lt;br&gt;
&amp;gt; z = z*r + centre(3);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; hold on;&lt;br&gt;
&amp;gt; h_sphere = surface(x,y,z);&lt;br&gt;
&amp;gt; hold off;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % set alpha transparency and line width&lt;br&gt;
&amp;gt; set(h_sphere, 'FaceAlpha', facealpha);&lt;br&gt;
&amp;gt; set(h_sphere, 'LineWidth', 1);</description>
    </item>
    <item>
      <pubDate>Tue, 29 Sep 2009 10:42:05 -0400</pubDate>
      <title>Re: objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#683357</link>
      <author>Sebastiaan </author>
      <description>&quot;Tim Hellwig&quot; &amp;lt;tim.hellwig@googlemail.com&amp;gt; wrote in message &amp;lt;h9sl4h$30i$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Do you have any working solution to your problem yet?&lt;br&gt;
&amp;gt; How do you workaround using plot3?&lt;br&gt;
&amp;gt; I tried Scatter3 in combination with your implementation of a transparent sphere but i am getting the same results. Points appear to be inside the sphere.&lt;br&gt;
&amp;gt; &lt;br&gt;
Exporting figures seldomly works as expected. I use export_fig to export figures:&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/23629&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/23629&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
which solved a lot of issues I had with the Matlab default export. I have no idea if it works for your problem, but it is worth to try.</description>
    </item>
    <item>
      <pubDate>Tue, 29 Sep 2009 12:39:02 -0400</pubDate>
      <title>Re: objects with transparency rendered using opengl looks wrong in export</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171834#683380</link>
      <author>Tim Hellwig</author>
      <description>&quot;Sebastiaan &quot; &amp;lt;s.breedveld@erasmusmc.REMOVE.BOO.BOO.nl&amp;gt; wrote in message &amp;lt;h9so9s$34l$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Exporting figures seldomly works as expected. I use export_fig to export figures:&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/23629&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/23629&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which solved a lot of issues I had with the Matlab default export. I have no idea if it works for your problem, but it is worth to try.&lt;br&gt;
&lt;br&gt;
Unfortunately it doesn't solve the problem. Seems to be a problem with opengl renderer and transperancy. Thx a lot though the tool seems to be nice for other plots.</description>
    </item>
  </channel>
</rss>

