[comp.sys.amiga.tech] 32 shades of gray

richard@gryphon.CTS.COM (Richard Sexton) (03/08/88)

(Love the new group, guys.  Can we make it last ?)

Alright, I'm letting you guys in on one of my secrets.

I've been using this tip to acheive what looks for all the world
like 32 gray scales.

First you make a stack of 16 bars, in colors 0 - 15 with rgb values
from (0,0,0) to (15,15,15):

  +----------+
  |   0      |
  +----------+
  |   1      |
  +----------+
	.
	.
	.
  +----------+
  |   15     +
  +----------+

with 0 being (0,0,0) and 15 being (15,15,15)

Now, to get the additional 16 shades of gray, dither 1:1 between
every n'th color and it's n+1'th counterpart. Use the following pattern:


       * * * * * * * * * *
        * * * * * * * * * *
       * * * * * * * * * * 

So color 0 (of 32) is pure color 0.

Color 1 (of 32) is color 0 and color 1 (of 16) dithered with a 50% duty cycle.

Color 2 (of 32) is pure color 1 (of 16)

.
.
.

etc.


Hmm. this is easier to do than explain. I will mail or post a small 
brush done with this technique is it is requested.

It's a nice trick which yields smoother looking continuous tones.


-- 
                      "...(alright Nils, alright)..."
                          richard@gryphon.CTS.COM 
   {ihnp4!scgvaxd!cadovax, rutgers!marque, codas!ddsw1} gryphon!richard

mills-cl@pike.cis.ohio-state.edu (christopher mills) (03/09/88)

In article <2801@gryphon.CTS.COM> richard@gryphon.CTS.COM (Richard Sexton) writes:

>Alright, I'm letting you guys in on one of my secrets.
>
>I've been using this tip to acheive what looks for all the world
>like 32 gray scales.
>
>First you make a stack of 16 bars, in colors 0 - 15 with rgb values
>from (0,0,0) to (15,15,15):

...

>with 0 being (0,0,0) and 15 being (15,15,15)
>
>Now, to get the additional 16 shades of gray, dither 1:1 between
>every n'th color and it's n+1'th counterpart. Use the following pattern:
>
>
>       * * * * * * * * * *
>        * * * * * * * * * *
>       * * * * * * * * * * 
>
>So color 0 (of 32) is pure color 0.
>
>Color 1 (of 32) is color 0 and color 1 (of 16) dithered with a 50% duty cycle.
>
>Color 2 (of 32) is pure color 1 (of 16)

...

>                      "...(alright Nils, alright)..."
>                          richard@gryphon.CTS.COM 
>   {ihnp4!scgvaxd!cadovax, rutgers!marque, codas!ddsw1} gryphon!richard


	Not so big of a secret.  My first ray-tracing attempts were in black
and white, 640 x 400, 16 shades of grey with a 2 x 2 dither patern, giving
(as I recall) 61 shades of grey.  It looked pretty good...

					Chris

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 _____________________           |     Christopher Mills.
(_)________________   \          |     mills-cl@polaris.cis.ohio-state.edu
  ________________|\   \         |     Current Thought: I'm looking for a
 (_)______________\_\   \        |          job.  Need a brilliant MSEE?
   ______________________\       |          (I don't do windows).
  (_)____________________|       |     DISCLAMER: I really wish I could blame
                                 |          my thoughts on someone else...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

cmcmanis%pepper@Sun.COM (Chuck McManis) (03/09/88)

In article <2801@gryphon.CTS.COM> (Richard Sexton) writes:
> I've been using this tip to acheive what looks for all the world
> like 32 gray scales.
> Now, to get the additional 16 shades of gray, dither 1:1 between
> every n'th color and it's n+1'th counterpart. Use the following pattern:

I like it, but like you said, trying to get the gist of the pattern
was a bit tough. Do you do region dithering or pixel dithering?

Pixel dithering is using pixels that are actually 2 X 2 blocks of the
form 
	+-----+-----+
	|  n  | n+1 |
	+-----+-----+
	| n+1 |  n  |
	+-----+-----+
	
And 'region' dithering simply applys a pattern fill of the above pattern
to "regions" of a given grey scale. 

In the pixel techinique you get a effective 320 X 200 X 5 greyscale image
in a 640 X 400 screen. Sounds like a mode I should ad to my image processing
stuff.

--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

papa@pollux.usc.edu (Marco Papa) (03/09/88)

In article <7941@tut.cis.ohio-state.edu> mills-cl@pike.cis.ohio-state.edu (christopher mills) writes:
>In article <2801@gryphon.CTS.COM> richard@gryphon.CTS.COM (Richard Sexton) writes:
>>Alright, I'm letting you guys in on one of my secrets.
>>I've been using this tip to acheive what looks for all the world
>>like 32 gray scales.
>	Not so big of a secret.  My first ray-tracing attempts were in black
>and white, 640 x 400, 16 shades of grey with a 2 x 2 dither patern, giving
>(as I recall) 61 shades of grey.  It looked pretty good...

Come on, guys! This stuff has been in the literature for over 6 years.   Take
a look at "Fundamentals of Interactive Computer Graphics" by J.D. Foley and 
Andrew Van Dam, published in 1981:

"Halftone approximation", on page 597-602 on bi-level displays [1 bit/pixel],
and "Reporoducing Color Hard Copy", p. 620, on generating 125 different colors
on 3 bit/pixel displays. This is how it is done on Tektronix 4105/4107 
terminals (see Color Plate  27).  I did it on the Amiga for our unreleased
Tek 4105 emulator, and it looked pretty good, except for the flicker. Nothing
new.  Just what everybody should now by now.

-- Marco
	

jesup@pawl21.pawl.rpi.edu (Randell E. Jesup) (03/09/88)

In article <2801@gryphon.CTS.COM> richard@gryphon.CTS.COM (Richard Sexton) writes:
>I've been using this tip to acheive what looks for all the world
>like 32 gray scales.
...
>Now, to get the additional 16 shades of gray, dither 1:1 between
>every n'th color and it's n+1'th counterpart. Use the following pattern:

	Not only does it work for pure grays, but if you take a set of grays,
say 5, and 1 or two different shades of another color, and then use the
50% dither, you produce what appears to be several new shades of that other
color (MD Blue + DK gray = DK Blue, for example.  The gray and the color you
dither with can't be TOO far apart in luminance, or it's noticable, but in
general it is useful.

     //	Randell Jesup			      Lunge Software Development
    //	Dedicated Amiga Programmer            13 Frear Ave, Troy, NY 12180
 \\//	beowulf!lunge!jesup@steinmetz.UUCP    (518) 272-2942
  \/    (uunet!steinmetz!beowulf!lunge!jesup) BIX: rjesup

(-: The Few, The Proud, The Architects of the RPM40 40MIPS CMOS Micro :-)

avery@puff.cs.wisc.edu (Aaron Avery) (03/09/88)

Well, one of my first amiga programming projects (almost 2.5 years ago!) 
involved displaying an image digitized by the Macintosh compatible 
Thunderscan(R) digitizer. This device provides 5 bits/pixel, so I just
HAD to see the difference! I wrote the program so that you could use
command-line switches to display in low/high res, lace/nonlace, and
double/nondouble modes. The double is the aforementioned pixel level
dithering idea. I found one problem with it, tho. On my monitor, at least
one of the dithered grey levels hit the green phosphors in my monitor
more than the red+blue, which gave it a green 'tint'. I have a 1080 with
a minor corner focus problem. 

Aaron Avery (avery@puff.cs.wisc.edu)
	    ({seismo,caip,allegra,harvard,ihnp4}!uwvax!puff!avery)

haitex@pnet01.cts.com (Wade Bickel) (03/13/88)

richard@gryphon.CTS.COM (Richard Sexton) writes:
>(Love the new group, guys.  Can we make it last ?)
>
>Alright, I'm letting you guys in on one of my secrets.
>
>I've been using this tip to acheive what looks for all the world
>like 32 gray scales.
>
>
>                      "...(alright Nils, alright)..."
>                          richard@gryphon.CTS.COM 
>   {ihnp4!scgvaxd!cadovax, rutgers!marque, codas!ddsw1} gryphon!richard


        This can be done in seconds using the saturation and value controls
on "Doug's Color Comander", a program I'm alpha testing for Seven Seas'
software which I think will be released very soon.  I'm expecting a beta
version any day now.  You could then alter the gray scale into a shaded color
scale in seconds, and from there build a pallet.

                                                                Wade.

UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex
ARPA: crash!pnet01!haitex@nosc.mil
INET: haitex@pnet01.CTS.COM