Skip to main content
Inspiring
January 14, 2010
Answered

Render Color channels from a PF_EffectWorld?

  • January 14, 2010
  • 1 reply
  • 896 views

Hello,

I am transforming the input layer with the transform_world function, resizing the image buffer and so far so good. But, How can I display only a single channel at a time? I mean either R,G,B or A channels but not the whole image. I know how to do it using Subpixel sampling, but I really want to know how to do it without it.

Thank you!

This topic has been closed for replies.
Correct answer shachar carmi

gutsblow wrote:

I know how to do it using Subpixel sampling, but I really want to know how to do it without it.

subpixel sampling???

you might poke some's eye with that...

perhaps you meant the iteration suite?

anyway, i don't know any operation in the AE API that manipulates only specific channels.

to display only one channel you have to either filter your pre-transform input,

or your post-transform output.

i can think of a few ways to do that.

1. use the iteration suites.

these will hand you each pixel in the input and output buffers,

and all you have to do is:

outP->alpha = inP->alpha;

outP->red = 0;

outP->green = 0;

outP->blue = inP->blue;

and viola! you've suppressed the red and green channels. (no subpixel sampling here)

the pros of using this method is the it's multi-threaded and easy to manage. it can also replace the copying intermediate buffers into the output (or input to intermediate).

the cons: it's handling all the channels, so it's wasteful.

2. the do it yourself approach.

get the base address of the world you wish to filter, and iterate through that world yourself.

this way you can get the PF_Plane for the channels you wish to affect, and skip directly to the correct spot in memory for that channel,

avoiding the other channels altogether.

pros: is the least wasteful and most customizable way.

cons: good luck getting that to be multi-threaded.

3. the compositing approach.

to show only the red channel, create a new world and fill it with red.

composite it using composite_rect and the "multiply" transfer mode.

that will supress other colors.

4. the someone-else's-problem approach.

if you're using smartFX,  you can tell AE which channels to use.

AE will ignore the result of the other channels.

i never used that, so i don't know if you'll get only what you want, or you'll get the original input for the unused channels.

personally, i'd go with the iteration suite.

1 reply

shachar carmiCommunity ExpertCorrect answer
Community Expert
January 15, 2010

gutsblow wrote:

I know how to do it using Subpixel sampling, but I really want to know how to do it without it.

subpixel sampling???

you might poke some's eye with that...

perhaps you meant the iteration suite?

anyway, i don't know any operation in the AE API that manipulates only specific channels.

to display only one channel you have to either filter your pre-transform input,

or your post-transform output.

i can think of a few ways to do that.

1. use the iteration suites.

these will hand you each pixel in the input and output buffers,

and all you have to do is:

outP->alpha = inP->alpha;

outP->red = 0;

outP->green = 0;

outP->blue = inP->blue;

and viola! you've suppressed the red and green channels. (no subpixel sampling here)

the pros of using this method is the it's multi-threaded and easy to manage. it can also replace the copying intermediate buffers into the output (or input to intermediate).

the cons: it's handling all the channels, so it's wasteful.

2. the do it yourself approach.

get the base address of the world you wish to filter, and iterate through that world yourself.

this way you can get the PF_Plane for the channels you wish to affect, and skip directly to the correct spot in memory for that channel,

avoiding the other channels altogether.

pros: is the least wasteful and most customizable way.

cons: good luck getting that to be multi-threaded.

3. the compositing approach.

to show only the red channel, create a new world and fill it with red.

composite it using composite_rect and the "multiply" transfer mode.

that will supress other colors.

4. the someone-else's-problem approach.

if you're using smartFX,  you can tell AE which channels to use.

AE will ignore the result of the other channels.

i never used that, so i don't know if you'll get only what you want, or you'll get the original input for the unused channels.

personally, i'd go with the iteration suite.

gutsblowAuthor
Inspiring
January 15, 2010

Hello Sachar,

You saved the day again. Once again, thank you for the detailed reply. Yes, I actually meant Iteration suite. Somehow, I was under the false impression that I have to sample the pixels again, to do it using Iteration suite. When using iteration suite, it is a bit slow, hence I was looking for alternatives. But, I guess now I need not sample pixels anymore, that problem might be solved. The compositing approach also sounds pretty good. I did see the SmartFX method of eliminating channels we don't require in the SDK, but that seems like a dangerous territory to jump into right now. Anyways, Thanks again for helping me.