View Full Version : Pixelfiltes (LW SDK)

3d user
01-15-2004, 06:10 AM
I am writing a pixelfilter for LW 7.5c and after going through a
number samples I noticed from negative.c sample

"LightWave calls the process function to process each rendered frame.
The processing function has to call setRGB() and setAlpha() for every
pixel in the image, even if only a few, or none, are changed."

After some initial test runs I notices that above is true.
Is there any way around. I need to make only small changes to a small
part of the render output. Sometimes I need just to read some pixels.
The filteraccess function, however, insist I read the whole thing and
write it too!

For example here is code to manipulate the render output:
for ( y = 0; y < fa->height; y++ ) {

/* get each scanline */

r = fa->getLine( LWBUF_RED, y );
g = fa->getLine( LWBUF_GREEN, y );
b = fa->getLine( LWBUF_BLUE, y );
a = fa->getLine( LWBUF_ALPHA, y );

for ( x = 0; x < fa->width; x++ ) {

/* change each pixel value c to 1.0 - c (leave the alpha alone) */

out[ 0 ] = 1.0f - r[ x ];
out[ 1 ] = 1.0f - g[ x ];
out[ 2 ] = 1.0f - b[ x ];

/* set the new value */

fa->setRGB( x, y, out );
fa->setAlpha( x, y, a[ x ] );

If I wnat to negate just a part of the render I'd still have to pcosess the entire render area.