6
$\begingroup$

So I can create a 2D image that looks like

contourplot = 
 ContourPlot[
  Sin[ x/2] Cos[y], {x, -4 π, 4 π}, {y, -4 π, 4 π}, 
  PlotRange -> All, BaseStyle -> 30]

enter image description here

Notice there is no frame around the image as a whole. Now I want to use this in a 3D plot using the following command

backgroundimage = 
  Graphics3D[{Texture[contourplot], 
    Style[Polygon[{{-1000, -500, -500}, {-1000, 500, -500}, {-1000, 
        500, 500}, {-1000, -500, 500}}, 
      VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}], 
     Lighting -> {{"Ambient", White}}]}];


Show[backgroundimage, Boxed -> False, ImageSize -> 800, 
 ViewPoint -> {2, -2, .3}]

enter image description here

A black border has been added around the 3D object. How can I remove this border? Or is there some way to just make it white?

Thanks

$\endgroup$
4
$\begingroup$

Use EdgeForm@None for your Polygon:

backgroundimage = Graphics3D[
     {Texture[contourplot],
      Style[{EdgeForm@None,
             Polygon[{{-1000, -500, -500}, {-1000, 500, -500}, {-1000, 500, 500}, 
                      {-1000, -500, 500}}, 
            VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
     },
     Lighting -> {{"Ambient", White}}
     ]}];


Show[backgroundimage, Boxed -> False, ImageSize -> 800, ViewPoint -> {2, -2, .3}]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Thanks! I noticed that even with EdgeForm set to None, there is what appears to be a dashed line at the bottom, visible in your image. I think this is where the Texture meets the Box surrounding the Graphics3D. I was able to make this go away by replacing None with White. $\endgroup$ – Jason B. Oct 1 '13 at 17:09
  • $\begingroup$ @JasonB That's great you've got what you need :) $\endgroup$ – Kuba Oct 1 '13 at 18:16
  • 1
    $\begingroup$ EdgeForm[] is more compact. $\endgroup$ – J. M. is away Dec 28 '16 at 10:47
  • $\begingroup$ @J.M. can't argue with that :) $\endgroup$ – Kuba Dec 28 '16 at 11: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.