I asked this set of questions (actually 2 of the 3 below) on the PSTricks mailing list a couple of days ago, but have since heard that Herbert's "to do" list is quite lengthy. So, I'm distributing them to a wider audience here, in hopes of getting some feedback...

Consider the following minimal example:

  \psset{viewpoint=50 45 20 rtp2xyz,Decran=25,lightsrc=50 45 20,lightintensity=1}%

  % ================== SPHERE ==================
    r=3.5,% sphere radius
    object=calottesphere,% sphere
    theta=90,phi=-90,% angles between which to draw the hollow spherical section
    ngrid=45 45,% number of grid lines across 2 dimensions r
    grid,% remove line edges
    hollow=true,% object has a hollow look
    action=draw**](0,0,0)% draw the object

  % ================== SECTION CURVE ==================
  % pi/2~1.5707963267948966192313216916398
  % pi/30~0.10471975511965977461542144610932
  % pi/15~0.20943951023931954923084289221863
  % pi/6~0.52359877559829887307710723054658
  % r=3.5*sin(45)~2.4748737341529
  % x=r*cos(t), y=r*sin(t), z={2.4748737341529,4.4748737341529}
      object=courbe,% object is a curve
      r=0,% with of curve line is 0
      range=\rA\space \rB,%

It produces this sphere and dashed line segment:

Sphere with dashed line segment

Since I am unfamiliar with fiddling around in the guts of packages, I am not sure whether my questions are at all reasonable, or perhaps just too far-fetched. However, asking is free, right? Riiight...

Question 1: Is it possible to change the default shadow colour from black to something else?

My motivation for this question stems from the fact that the shadow of the object from the light source (lightsrc) depends on the specified viewpoint parameter, and could potentially be solid black. Consequently, in an attempt to reduce the shadow intensity, lightsrc and viewpoint could be chosen closer together. However, the package documentation suggests against this by stating the following (on page 16):

Note: In order to get some shadow regions to appear in the graphic — which emphasises the 3D character — we would suggest choosing the light source and the view point differently.

So, in order to heed this note, it would be ideal to have/use an option like shadowcolor=black!50 (say). On that thought - and here I'm going for gold - how about an option like lightsrccolor=green!50!red (say) for those festive times when you're really screwing around with different-coloured light bulbs.

Question 2: Is it possible to create a dashed line style (linestyle=dashed) for a parametric curve in 3D (object=courbe)?

Although the section curve in the graphic looks like a dashed line, it actually uses the multido package to sequentially print 15 solid line segments of a parametric curve along intervals of pi (pi/15~0.2094 to more accurate). However, I think this artificially bloats the resulting EPS/PDF since each of the (15) line segments is considered its own \psSolid[object=courbe,...].

Question 3: pst-solides3d provides the option opacity=k where 0<=k<=1 which sets the fill opacity of a surface. Is it possible to add a similar option for stroke opacity?

This option stems from playing around with PSTricks' options for opacity: strokeopacity (for normal stroke operation) and opacity (for filled areas).


For objects which should test if visible or not it is not possible with linestyle=dashed because all line segments are in general shorter than the ones from the dash and they will be sorted before drawn. However, you can delete some segments from such a line:

\psset{viewpoint=50 45 20 rtp2xyz,Decran=25,lightsrc=viewpoint,lightintensity=1.25}
\psSolid[object=sphere,r=3.5,ngrid=30 30,hue =0 0.5,grid=false]
\psSolid[object=courbe,r=0,range=-0.75 2.5,resolution=90,
    rm=1 2 88{} for, % delete every second segment

enter image description here

strokeopacity in general should work and the shadowcolor cannot be modified by now.

  • Thanks Herbert. I'm looking forward to when light and shadow colours could be incorporated into pst-solides3d. – Werner Sep 30 '12 at 5:14

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.