[comp.sys.next] Compositing question

smb@data.com (Steven M. Boker) (03/09/91)

I have been putting a little time into updating Dave Joerg's MovieApp
and I've come across a compositing situation that I can't seem to think
my way around.  Essentially what I want to do is to overlay multiple
NXImage's with the visual effect of them being on tracing paper.  The
top sheet is fully visible, the next sheet is gray, the next sheet below
that is lighter gray and so on.  I have tried the dissolve:topoint: method
in NXImage, but there is a lower limit to the grayscale that is produced.

In other words, if I have a 1.0 gray pixel and dissolve at 50% with a
0.0 gray pixel, the result should be a .5 gray pixel.  If I repeat the
operation on the resulting pixel recursively, the pixel should approach
0.0 as a limit.  However, the pixel's gray stops before 0.0 (or vice-versa
before 1.0).

If you are wondering what all of this is good for, I've been animating
data sets.  They look like flocks of birds, really.  I would like to be
able to create "vapor trails" behind each bird.  These vapor trails should
decay to white as a limit, but don't.

I've tried a large number of compositing combinations and transparency
combinations and have continued to run into the same phenomenum.  Am I
missing something obvious?  

Thanks.  

ps.  I should be able to upload the 2.0 version of MovieApp to the archives
     within a couple of days.  I'll post when its ready.  The 68040 is
     a big win here, but be sure you have plenty of memory for the
     bitmap caching.

Steve.

-- 
 #====#====#====#====#====#====#====#====#====#====#====#====#====#====#====#
 #  Steve Boker           #                 En Vino Kaos                    #
 #  smb@data.com          #                En Kaos Veritas                  #
 #====#====#====#====#====#====#====#====#====#====#====#====#====#====#====#

wb1j+@andrew.cmu.edu (William M. Bumgarner) (03/09/91)

If you dissolve by 50% each time, it will never reach zero, as you said.
 To actually dissolve completely, I suspect you need to have an ever
increasing delta value as you do w/dissolve:toPoint:.

Check out the documentation on dissolve:toPoint, it has more information
about the dissolve numbers needded to achieve a complete dissolve.

b.bum


b.bumgarner            | Disclaimer:  All opinions expressed are my own.
wb1j+@andrew.cmu.edu   | I officially don't represent anyone unless I
NeXT Campus Consultant | explicity say I am doing so. So there. <Thpppt!>
"I ride tandem with the random/Things don't run the way I planned them.."

smb@data.com (Steven M. Boker) (03/10/91)

In article <Ibq3uOm00W02I6_LZK@andrew.cmu.edu> wb1j+@andrew.cmu.edu (William M. Bumgarner) writes:
>If you dissolve by 50% each time, it will never reach zero, as you said.
> To actually dissolve completely, I suspect you need to have an ever
>increasing delta value as you do w/dissolve:toPoint:.
>

Here is what I have run into.  There is a difference in compositing with
2.0 and compositing with 1.0.  The simplest way to view this for yourself
is to compile CompositeLab on a 1.0 machine and also on a 2.0 machine.

Set the color of the source to be white and the transparency of the
source to be 20% (or so).  Now set the composite method to be SOVER and
set the transparency of the destination to fully opaque.  If you
now vary the color of the destination slowly from black to white you
will see the anomaly I am up against.

In 1.0 everything works as you would expect.  The portion of the destination
that is covered by the source is _always_ a lighter shade of gray than
the uncovered destination, until the entire rectangle has become white.

In 2.0 we see something different.  The portion of the destination that
is covered by the source is lighter than the portion of the destination
that is uncovered until the destination's color is about two thirds of
the way toward white.  After that, the source has _no_effect_ on the
destination.  In fact, you will see that the value of this lower limit
is dependent on the transparency value of the source.

My view is that this is a bug.  The metaphor of optical compositing can
no longer be used to understand the behavior of the compositing operations.
I will have to do a computationally expensive workaround which will limit
the complexity of smooth animation that I will be able to accomplish or
will require preprocessing of the animation as opposed to being able to
have the user interactively vary the transparency controls.

Steve.

-- 
 #====#====#====#====#====#====#====#====#====#====#====#====#====#====#====#
 #  Steve Boker           #                 En Vino Kaos                    #
 #  smb@data.com          #                En Kaos Veritas                  #
 #====#====#====#====#====#====#====#====#====#====#====#====#====#====#====#