TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can the opacity of a pst-3dplot object be set to be transparent? I have an example where using opacity or strokeopacity options do not work. I am trying to make an image similar to the following:

sphere in oil

With the hopes of showing more detail inside the sphere such as this:


However, I cannot get the top portion of the sphere to appear different than the bottom through the opaque surface, or get the sphere to be transparent to see the inner lines/tagging.

Here is what I have tried (compiled with XeLatex+MakeIndex+BibTex in TeXWorks):

\usepackage[nomessages]{fp}% http://ctan.org/pkg/fp

\def \planeLocRatio {.7}
\def \radius {1}
\def \cylLength {5}
\def \planeLen {5}


                %\psset{Alpha=45, Beta=0}
                \pstThreeDLine[linewidth=2pt,linecolor=blue,arrows=->] (0,0,0)(0,0,\b)
                \pstThreeDLine[linewidth=2pt,linecolor=blue,arrows=->] (0,0,0)(0,\a,\b)
                \pstThreeDLine[linewidth=2pt,linecolor=green] (0,0,\b)(0,\a,\b)
                \pstThreeDLine[linewidth=2pt,linecolor=black] (0,\a,\b)(0,\radius,\radius)
                %\pstThreeDSquare[fillcolor=blue,fillstyle=solid,opacity=0.5](- \planeLen /2,- \planeLen /2,\planeLocRatio)(0,\planeLen,0)(\planeLen,0,0)
            \caption{Sphere model}
                %\pstThreeDSquare[fillcolor=blue,fillstyle=solid,opacity=0.5](- \planeLen /2,- \planeLen /2,\planeLocRatio)(0,\planeLen,0)(\planeLen,0,0)
        \caption{Cylinder Model}
    \caption{Sphere and cylinder particle models at the interface.}

Which outputs this at the moment:



Update: Herbert's answer was good and got many of the main points in for this figure, but I am looking to switch gears due to his answer pointing out that the package does not do hidden lines. Also, I would like to have the top surface in a different coloring than the bottom surface and a different color for the intersection area as well.

So here is what I have at the moment, which now has different issues which I will be making other questions about or updating here for future interests in this problem.



\def \planeLocRatio {.7}            % ratio of z location of plane and radius
\def \radius {0.5}
\def \planeLen {1}              % half of one side of the plane
\FPeval{\contAng}{pi/4}         % angle from z axis to intersection of plane at sphere edge
\FPeval{\a}{radius*cos(contAng)}    % z location at plane intersection
\FPeval{\b}{radius*sin(contAng)}    % radius of circle at plane intersection
\FPeval{\h}{radius-radius*cos(contAng)} % z distance from top of sphere to plane
\FPeval{\imgsize}{planeLen+1}  % maybe increasing this helps /hbox errors?


        % ==================  VIEW ===================
            viewpoint=10 45 20 rtp2xyz,

        % ================== POINTS ==================
        % origin
        \psSolid[object=point,args=0 0 0, name=O, text=O, pos=br]
        \psSolid[object=point,args=0 0 \a, name=A, text=A, pos=uc]

%%%%%%% Causes hbox problems
        %\psSolid[object=point,args=0 \b \a, name=B, text=B, pos=uc]

        % ================== LINES ==================

        % origin to center of circle at plane intersection
        \psSolid[object=line,linecolor=black!50,linewidth=2pt,args=O A, name=OA]
        % label the equation to the side of the line midway through the line
        %\psProjection[object=point,definition=milieu,args=O A,text=$Rcos \theta$,pos=uc]

        % line from origin to side of sphere intersected with plane
        %\psSolid[object=line,linecolor=black!50,linewidth=2pt,args=O B, name=OB]
        %\psProjection[object=point,definition=milieu,args=O B,text=$Rsin \theta$,pos=uc]

        % line from A to B
        %\psSolid[object=line,linecolor=black!50,linewidth=2pt,args=A B, name=AB]

        % ================== SPHERE ==================
            ngrid=30 30,            % number of grid lines across 2 dimensions r
            grid=false,         % remove line edges
            hue=0 0.5,
            intersectionplan=0 0 1 \a,

        % ================== PLANE ==================
            args=mySphere 1,
            base=-1 1 -1 1,


which at the moment outputs:


share|improve this question
up vote 3 down vote accepted

The current version of http://texnik.dante.de/tex/generic/pst-3dplot/pst-3dplot.tex takes the values of opacity and strokeopacity into account:

 \psset{Alpha=45, Beta=10}
 \pstThreeDLine[linewidth=2pt,linecolor=blue,arrows=->] (0,0,0)(0,0,\b)
 \pstThreeDLine[linewidth=2pt,linecolor=blue,arrows=->] (0,0,0)(0,\a,\b)
 \pstThreeDLine[linewidth=2pt,linecolor=green] (0,0,\b)(0,\a,\b)
 \pstThreeDLine[linewidth=2pt,linecolor=black] (0,\a,\b)(0,\radius,\radius)

However, if you want hidden lines and surfaces then use `pst-solides3d? instead.

enter image description here

share|improve this answer
Thanks @Herbert, that works well! However, I think you are right about looking into hidden lines and surfaces with pst-solides3d. I have been working on making the figure with that package but keep gettin "hbox overfull" errors. They happen all of the time with several things: planseparation, adding points or lines, etc. Do you know what would cause this? – chase Mar 27 '14 at 1:54
Overfull hboxes canhappen if your pspicture coordinates are wider than the current \textwidth – Herbert Mar 27 '14 at 7:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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