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.

1 Answer 1


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]

  • 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
    Commented Dec 17, 2012 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.
    – user2478
    Commented Dec 17, 2012 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .