[comp.lang.postscript] How do I draw a depth-cued line in PostScript?

lnds@sherlock.mmid.ualberta.ca (Mark Israel) (06/26/91)

How do I draw a depth-cued line in PostScript?

				Mark Israel
I have heard the Wobble!	userisra@mts.ucs.ualberta.ca

ads@canon.co.uk (Adam Billyard) (06/26/91)

lnds@sherlock.mmid.ualberta.ca (Mark Israel) writes:

> How do I draw a depth-cued line in PostScript?
> 

The PostScript imaging model has no notion of variable shading over the
area to be filled. The metaphor is of opaque paint being pushed through
a stencil. Display PostScript extends this a little by including
transparency, but in general if you want continuous shading, you must
write your own filler.

The standard way to create continuous shading (in PostScript) is to
overpaint the path again and again while altering the path (usually by
scaling) and altering the colour you're using.  Its very inefficient. 

e.g.

gsave
clippath pathbbox 4 2 roll translate scale	% 1,1 space
1 -0.1 0
{
  newpath .5 .5 2 index 0 360 arc 1 exch sub setgray fill
} for
grestore

Depth-cueing implies a 3rd dimension, so you'll have to keep the control
points you use as triples. Since PostScript is a complete language, its
quite possible to do this sort of thing.

You might look in Salmon and Slater "Computer Graphics".  They present a
complete 3D viewing model and wireframe rendering entirely written in
PostScript.  It might help demonstrate how you enrich the 2D paths with
a 3rd dimension.

	Adam.

davis@3d.enet.dec.com (Peter Davis) (06/27/91)

In article <1991Jun26.140611.1052@canon.co.uk>, ads@canon.co.uk (Adam Billyard) writes...
>The PostScript imaging model has no notion of variable shading over the
>area to be filled. The metaphor is of opaque paint being pushed through
>a stencil. Display PostScript extends this a little by including
>transparency, ...

Really?  How?  I've been working with Display PostScript for a while, and I have
come across nothing that either explicitly or implicitly allows transparency.
The only way to achieve transparent effects that I know of it to fill with a
stipple pattern using imagemask, but this is possible in regular as well as
Display PostScript.

Can you explain?  This would be very VERY useful.

Thanks.
-pd

ttl@sti.fi (Timo Lehtinen) (06/28/91)

In article <1991Jun27.164001.2435@engage.pko.dec.com> davis@3d.enet.dec.com (Peter Davis) writes:
>
>In article <1991Jun26.140611.1052@canon.co.uk>, ads@canon.co.uk (Adam Billyard) writes...
>>The PostScript imaging model has no notion of variable shading over the
>>area to be filled. The metaphor is of opaque paint being pushed through
>>a stencil. Display PostScript extends this a little by including
>>transparency, ...
>
>Really? How? I've been working with Display PostScript for a while, and I have
>come across nothing that either explicitly or implicitly allows transparency.
>The only way to achieve transparent effects that I know of it to fill with a
>stipple pattern using imagemask, but this is possible in regular as well as
>Display PostScript.
>
>Can you explain?  This would be very VERY useful.


The version of Display PostScript in the NeXTstep GUI supplied by 
NeXT, Inc. has transparency. I.e. an explicit alpha channel and a 
set of PIXAR-style operators to doo compositing etc.

Perhaps this is what the original author was referring to. NeXTstep
ofcourse is not available on any other platform other than NeXT.
(IBM has a license, but doesn't seem to be doing anything with it.)

Timo

-- 
       ____/ ___   ___/    /		Kivihaantie 8 C 25
      /           /       /		SF-00310 HELSINKI, Finland
   ____  /       /       /	Phone:	+358 0 1399 0151, +358 49 424 012
  Stream Technologies Inc.	Fax:	+358 0 1399 0154

glenn@heaven.woodside.ca.us (Glenn Reid) (06/28/91)

Adam Billyard writes...
>The PostScript imaging model has no notion of variable shading over the
>area to be filled. The metaphor is of opaque paint being pushed through
>a stencil. Display PostScript extends this a little by including
>transparency, ...

Peter Davis writes...
> Really?  How?  I've been working with Display PostScript for a while, and I  
have
> come across nothing that either explicitly or implicitly allows transparency.
> The only way to achieve transparent effects that I know of it to fill with a
> stipple pattern using imagemask, but this is possible in regular as well as
> Display PostScript.
> 
> Can you explain?  This would be very VERY useful.

No, Display PostScript has not been extended to allow transparency.
Neither has Level 2 PostScript.  However, NeXT has added an "alpha
channel" to their window server that permits bit operations that
provide transparency.  Perhaps that's what you're thinking of.

Glenn Reid
RightBrain Software
PostScript / NeXT developers

flar@bendenweyr.Eng.Sun.COM (Jim Graham) (06/28/91)

davis@3d.enet.dec.com (Peter Davis) writes:

|> ads@canon.co.uk (Adam Billyard) writes...

|> Display PostScript extends this a little by including
|> >transparency, ...
|> 
|> Really?  How?  I've been working with Display PostScript for a while,
|> and I have
|> come across nothing that either explicitly or implicitly allows
|> transparency.
|> The only way to achieve transparent effects that I know of it to fill
|> with a
|> stipple pattern using imagemask, but this is possible in regular as
|> well as
|> Display PostScript.

Appendix D of the NeXT Reference Manual describes some compositing
and transparency operators, but they are specific to the NeXT DPS
environment.

				...jim