0
$\begingroup$

I finally got my 3D Graph :) Unfortunately, when I export I get a bad image quality.

Exported PNG

How can I export the image without the white stripes?

Here is the code for reproducing the error

scaleR = 1.2;
ni = 1;
no = 2;
IP = {3, 4, 4};

IncidentIn = {0, 1.5, 1.5};
IncidentOut = IP;
scale = Norm[IncidentOut - IncidentIn];
i = Normalize[IncidentOut - IncidentIn];
RadiusIn = IP;
n = Normalize[{0, 1, 1}];
t = Normalize[
ni/no i - n (ni/no (n.i) - Sqrt[1 - (ni/no)^2 (1 - (n.i)^2)])];
r = Normalize[i - 2 (n.i) n];
axial = {1, 0, 0};
cylinder = ContourPlot3D[
y^2 + z^2 == 32, {x, IncidentIn[[1]], (IP + scale r)[[1]]}, {y, -6,
6}, {z, -8, 8}, Mesh -> 1, 
ContourStyle -> FaceForm[{White, Red}, Opacity[0.0]], 
AxesLabel -> {"x", "y", "z"}];
cylinder2 = 
ContourPlot3D[y^2 + z^2 == 32, {x, IncidentIn[[1]], -(IP + scale r)[[1]]}, {y, -6, 6}, 
{z, -8, 8}, 
Mesh -> None, ContourStyle -> Directive[Red, Opacity[1]], 
AxesLabel -> {"x", "y", "z"}];
areaR = ContourPlot3D[
axial.({x, y, z} - IncidentIn) == 0, {x, 
IncidentIn[[1]], (IP + scale r)[[1]]}, {y, -6, 8}, {z, -6, 8}, 
Mesh -> False];
planeOI = ContourPlot3D[Cross[r, t].({x, y, z} - IncidentIn) == 0, {x, 
IncidentIn[[1]], (IP + scale r)[[1]]}, {y, 0, Sqrt[64]}, {z, 0, 
Sqrt[64]}, ContourStyle -> {White, Opacity[1]}, Mesh -> False];
axial = Graphics3D[{Arrowheads[0.03], Black, Dashed, 
Arrow[{{0, 0, 0}, {(IP + scale r)[[1]] + 2, 0, 0}}], 
AxesLabel -> {"x", "y", "z"}}]; 
radius = Graphics3D[{Arrowheads[0.03], Black, Dashed, 
Arrow[{{3, 0, 0}, 1 + IP + scale n}], 
AxesLabel -> {"x", "y", "z"}}];
inv = Graphics3D[{Thick, Arrowheads[0.03], Darker[Red], 
Arrow[{IncidentIn, IP}], AxesLabel -> {"x", "y", "z"}}];
outv = Graphics3D[{Thick, Arrowheads[0.03], Darker[Blue], 
Arrow[{IP, IP + scale t}], AxesLabel -> {"x", "y", "z"}}];
reflv = Graphics3D[{Thick, Arrowheads[0.03], Darker[Green], 
Arrow[{IP, IP + scale r}], AxesLabel -> {"x", "y", "z"}}];
points = Graphics3D[{PointSize[0.008], Opacity[1], 
Point[{IncidentIn, IP, IncidentIn*{1, 0, 0} + IP*{0, 1, 1}, 
IP + scale t, IP + scale r }]}];
directCosinv = 
Graphics3D[{Darker[Red], Dashed, 
Line[{IncidentIn, (IncidentIn*{1, 1, 0} + 
IP*{0, 0, 1}), (IncidentIn*{1, 0, 0} + IP*{0, 1, 1}), IP}], 
AxesLabel -> {"x", "y", "z"}}];
directCosoutv = 
Graphics3D[{Darker[Blue], Dashed, 
Line[{IP, (IP*{1, 1, 0} + (IP + scale t)*{0, 0, 1}), (IP*{1, 0, 
      0} + (IP + scale t)*{0, 1, 1}), IP + scale t}], 
AxesLabel -> {"x", "y", "z"}}];
directCosreflv = 
Graphics3D[{Darker[Green], Dashed, 
Line[{IP, (IP*{0, 1, 1} + (IP + scale r)*{1, 0, 0}), (IP*{0, 0, 
1} + (IP + scale r)*{1, 1, 0}), IP + scale r}], 
AxesLabel -> {"x", "y", "z"}}];
plt = Show[points, planeOI, directCosreflv, directCosinv, 
directCosoutv, outv, areaR, reflv, inv, axial, radius, cylinder, 
cylinder2, Axes -> False, AxesLabel -> {"x", "y", "z"}, 
Boxed -> False, ImageSize -> Large, 
ViewPoint -> {1.388, -2.089, 2.27}, 
ViewVertical -> {-0.13, 0.09, 1}, Lighting -> "Neutral"]
Export["FresnelInVectors.png", plt, "PNG", ImageResolution -> 600]
$\endgroup$
2
  • $\begingroup$ You can try changing the ContourStyle in cylinder to FaceForm[Red, Opacity[0.0]]. I cannot reproduce the problem on V9.0.1, V8.0.4 (Mac). If I turn on Antialiasing, I get a totally black image, though. Check whether yours is off, perhaps, change the setting. $\endgroup$ – Michael E2 Aug 6 '13 at 20:38
  • $\begingroup$ @MichaelE2 Mine's prettier! This is the recurring problem I have when I turn on Antialiasing (details here) $\endgroup$ – cormullion Aug 6 '13 at 21:38
2
$\begingroup$

My OS is Mac OSX 10.7 or 10.8. Switching Aliasing On or Off doesn't change things but when I reduce

ImageResolution -> 600

to

ImageResolution -> 500

the export works and the white stripes disappear. Using

ImageResolution -> 700

the white stripes appear again. So it seems reducing

ImageResolution

is the key! Thanks for your fast answers

$\endgroup$
1
  • $\begingroup$ Just leaving a note to say that I came here today to ask about this issue. Thanks for answering my question before I asked it! $\endgroup$ – David E Speyer Feb 12 '15 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.