ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Easy way to do a "visibility status"-check on a 2d/3d-point?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Johan Malmsten
Easy way to do a "visibility status"-check on a 2d/3d-point?
on Nov 20, 2009 at 11:29:31 pm

I'm sure someone has done this before. I just can't seem to get my wording right when I do google-searches and on this site.

I want to know if there's an easy way to do a "visibility check".

I mean. If I have a point, 2d or 3d. I want to be able to determine if that point is obscured by pixels of another layer. And as a bonus, maybe even know the sum-total of the alpha-channel change that the other layers are adding to the target-points pixel. The icing on the cake would be to get whatever color is being added to the point before its fully obscured.

The common example: I have a lens flare that's supposed to follow something in space. But at the same time I want stuff to obscure it. I could just put it in a layer beneath, but that would obscure all parts of the flare with all the opaque pixels in front. I want it so that it only reacts to when the target-point (the light-emitter) is obscured. Like in real life.

I'm sure people have been using functions like this in some way. I just want to know how...

Return to posts index

Gary Hazen
Re: Easy way to do a "visibility status"-check on a 2d/3d-point?
on Nov 21, 2009 at 5:51:23 pm

Knoll Light Factory allows you to set the obscuration layer.

You might be able to use expressions to do the same thing. But you'd need a smart guy like Dan Ebberts to do the math. Check the expressions forum.

Return to posts index

Dan Ebberts
Re: Easy way to do a "visibility status"-check on a 2d/3d-point?
on Nov 22, 2009 at 12:13:35 am

It's tricky, but it can be done. You need to use toComp() to transfrom the 3D position of your source into view space, use fromCompToSurface() to transform that point onto the surface of each of the other layers in the comp, use sampleImage() to pick up the rgba for each of the other layers, and merge the alphas together (which is a tricky bit of math itself). That will tell you how much your point is obscured on the line between it and the camera. A project for a rainy afternoon perhaps.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved