TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

I'm trying to draw a graph with pst-solides3D with the option psSurface :

The problem is as follows :

I want to draw z = +/- (y^2-y^2), which should give a saddle-point graph with the lines x=y and x=-y that are equal to 0. Visually it's nice.


\usepackage[english]{babel} %change language if necessary
\usepackage[english,verbose]{layout}%change language if necessary

\psset{lightsrc=30 -10 10} 
\psset{viewpoint=50 20 30 rtp2xyz,Decran=70} 
%+ Saddle graph z= (y^2-x^2)
\psSurface[ngrid=.2 .2,algebraic,Zmin=-1,Zmax=1, 
hue=0 1](-5,-5)(5,5){% 
(x^2-y^2)/3 } 
%- Saddle graph z = (x^2-y^2)
\psSurface[ngrid=.2 .2,algebraic,Zmin=-1,Zmax=1, 
hue=0 1](-5,-5)(5,5){% 
(-x^2+y^2)/3 } 

However as you can see this is not satisfactory. The second plot is plotted over the first one, and covers parts of the first graph it shouldn't cover. Is there any transparency command I could use, or make pstricks understand what is in front of what ?

The rendering I'm looking for would be something like this

enter image description here

It knows what should be in front and what should not.

share|improve this question
up vote 7 down vote accepted

It makes no sense to draw more than one 3d function without using hidden lines and surfaces.


\psset{unit=0.35,lightsrc=30 -10 10,viewpoint=50 20 30 rtp2xyz,Decran=70,solidmemory} 
\defFunction[algebraic]{F1}(x,y){}{}{ (x^2-y^2)/3 }
\psSolid[object=surface,function=F1,ngrid=.2 .2,linewidth=0.5\pslinewidth,
  hue=0 1,base=-5 5 -5 5,action=none,name=Func1]
\defFunction[algebraic]{F2}(x,y){}{}{ (-x^2+y^2)/3 } 
\psSolid[object=surface,function=F2,ngrid=.2 .2,linewidth=0.5\pslinewidth, 
  hue=0 1,base=-5 5 -5 5,action=none,name=Func2]
\psSolid[object=fusion,base=Func1 Func2,opacity=0.6]


enter image description here

and the same without setting opacity (real hidden surfaces)

enter image description here

and if you want the color depending to the z value use

\psSolid[object=surface,function=F1,ngrid=.2 .2,
         tablez=-5 0.2 5 {} for, zcolor=0.66 0,
         base=-5 5 -5 5,action=none,name=Func1]

share|improve this answer
Thank you very much, I didn't know the use of fusion. A second question of mine would be : how to adjust the hue as a normal function intensity colouring : the bigger the function value, the closer to red, the smaller the function value, the closer to blue ? – Mathusalem Dec 17 '12 at 20:25
see my edit: -5 0.2 5 {} for iterates with a step of 0.2 and for each step one color from the range 0.66 0 is used. – Herbert Dec 17 '12 at 20:41
Thanks a lot for the details, it's perfect. – Mathusalem Dec 17 '12 at 21:34

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.