"Visible through camera" expression?

   13486   11   2
User Avatar
Member
166 posts
Joined: Oct. 2008
Offline
Is there a function or expression to determine if a point is visible through a given camera?

Or at least if it is within a geometry (that way you could parent a cone ore similar to the camera and use that approach).

One way to solve that would be to make the “cone geometry” a volume and scatter points inside which transfers an “inside attribute” to the points. But there's got to be a less computational intense way?
User Avatar
Member
8595 posts
Joined: July 2007
Offline
you can use group geometry SOP with bounding object to create group from points inside the object
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8595 posts
Joined: July 2007
Offline
but easier and faster solution would be

append UVtexture SOP to your points
set it to Perspective From Camera and choose your camera
the UVs will be created

now every point that has uv in range 0,0 - 1,1 is visible by that camera
points behind the camera will have uv 0,0,0 so you may want to filter them out

Attachments:
filter_points_in_camera.hipnc (79.4 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
166 posts
Joined: Oct. 2008
Offline
Thank you very much. Those will do just perfect!
User Avatar
Member
1532 posts
Joined: July 2005
Offline
uv projection from the camera is a great trick!

however – why is there ALWAYS a however? :wink:

If your camera is animated you will most likely be clipping different points over different parts of your animation, which will complicate matters if you wish to use deformation blur.

A good way around this is to drag your entire scene into pops, and group all points which fall into this 0-1 uv range, using preserve groups.

This way, you will capture every point that has gone through your camera's frustrum. Motion blur happiness will ensue.

Cheers,

G
User Avatar
Member
166 posts
Joined: Oct. 2008
Offline
keyframe
uv projection from the camera is a great trick!

however – why is there ALWAYS a however? :wink:

If your camera is animated you will most likely be clipping different points over different parts of your animation, which will complicate matters if you wish to use deformation blur.

A good way around this is to drag your entire scene into pops, and group all points which fall into this 0-1 uv range, using preserve groups.

This way, you will capture every point that has gone through your camera's frustrum. Motion blur happiness will ensue.

Cheers,

G

Yeah, those darn however's…
I had some issues with the motion blur in the beginning when switching from low poly to high poly gemetry on the fly using a custom level of detail as the point count changed upon the switch, This however I solved by putting my Trail SOP before the Copy Sop so that it was calculated per instance instead of the whole thing.

This introduced my to another problem. That my instanced geometry wouldn't get any blur from its translation. Which I solved by activating the “Use Template Point Attributes” on my Copy SOP and adding v to the instanced geometry. And so far I can tell it's all working just fine now.

I'm not sure but I think that that approach might solve the problem as well.
User Avatar
Member
166 posts
Joined: Oct. 2008
Offline
Houdini is a very unique software which actually makes problem solving entertaining at most times.
User Avatar
Member
8595 posts
Joined: July 2007
Offline
you do not have to delete those points as in example, just use the created group for copy sop or whatever (this way pointcount/$PT will stay the same)
EDIT: $PT will not be the same for group filtered op e.g copy SOP, sorry for confusion

you can also introduce some tolerance so you will include points slightly outside the camera view (like in range to )
to prevent appearing and disappearig objects as the point just enter/leave the camera space (because obj is bigger than the point it needs to be there even before the camera sees the point)

however i am not sure what Mblur issue is keyframe talking about, i should probably read the previous thread
Edited by - July 3, 2009 10:32:26
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
166 posts
Joined: Oct. 2008
Offline
tamte
you do not have to delete those points as in example, just use the created group for copy sop or whatever (this way pointcount/$PT will stay the same)
Precisely, the Template Group on the Copy SOP is perfect for this.

tamte
you can introduce some tolerance so you will include points slightly outside the camera view (like in range to )
to prevent appearing and disappearig objects as the point just enter/leave the camera space (because obj is bigger than the point it needs to be there even before the camera sees the point)

To bad this thread was more of a hypothetical question as I'm almost finished with everything I would have needed this for so I probably won't use it other than to test it out. It's quite a neat workflow which definitely will save a loooot of render time in some occasions.

tamte
however i am not sure what Mblur issue is keyframe talking about, i should probably read the previous thread

The thing is that if the motion blur is calculated on all the geometry after the Copy SOP, and the topology changes, a given point number may travel a great distance to a completely other copy instance, thus resulting in extreme motion blur (I'll post a pic of a quite cool example). But when calculating the motion blur per instance with it's own set of point numbers it's not as sensitive and will not travel such a long way upon topology change.

Attachments:
birdplosion.jpg (78.0 KB)

User Avatar
Member
1532 posts
Joined: July 2005
Offline
To bad this thread was more of a hypothetical question as I'm almost finished with everything I would have needed this for so I probably won't use it other than to test it out. It's quite a neat workflow which definitely will save a loooot of render time in some occasions.

Yes, and No – as usual.

One must be careful making the assumption that if it isn't in the frustrum it isn't contributing to lighting calculations.

And object can be outside the camera view, and still be visible in reflections, or cast shadows into the scene.

G

ps: It's also important to acknowledge the distinction between velocity blur and deformation blur (which I was refering to in my earlier posting) and the distinct workflows that each one requires. On the subject of deformation blur, another thing to keep in mind is that it's only critical to deformation MB that point count is maintained on the interval. ie: camera renders 3 segment frame centered blur at 0.2 shutter will sample the scene at $F-0.1, $F, and $F+0.1 – if you ensure that you are only changing your point count outside that interval, you should be laughing. Someone should write a complete tutorial, or a video or something. :wink:
User Avatar
Member
166 posts
Joined: Oct. 2008
Offline
keyframe
Yes, and No – as usual.

One must be careful making the assumption that if it isn't in the frustrum it isn't contributing to lighting calculations.

And object can be outside the camera view, and still be visible in reflections, or cast shadows into the scene.

Yes that is very true. But in my scenes where I only rendered birds without them casting any shadows on anything at all and having no reflections (they are basically a silhouette in the finished shot), this approach would have been ideal. Since the majority of my render times consists of building up geometry.
User Avatar
Member
8595 posts
Joined: July 2007
Offline
you can allways use very low poly geo for points not visible to camera for shadows/refl/refr if you need them
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links