Actually the credits of this nuke tip entirely goes to my colleague Zsolt Sebők, who had the idea, and did the research and experimentation with it, and kindly permitted me to present on this blog. Thanks Sebi!
So the as compositors in an animation house, we often find ourselves in a situation that we need to import geometry from 3d scene. For mattepaints, or for render error fixing etc. Sometimes they (3d guys) export it, but sometimes we have to open and export it ourselves, if want to get it in time. It's a painful and slow process, especially when the scene is big. Further problem when geometry is present in the lighting scene only as a standin, so we have to go further back in pipeline. I assume you know what I'm talking about.
The idea is, that we can generate fairly accurate geometry from positionpass and normalpass of the renders. As a primarily animation house we do mostly full cg animation, so we always have passes like world position and normal from arnold, and with that and a clever node positionToPoints, we can generate an accurate pointcloud. This is step one.
Nuke has this poisson mesh node, that can generate geometry from pointclouds. Probably it was designed to work with pointclouds from cameratracked scenes. But in our case we have the pointcloud from the passes, and is much more correct, than a pointcloud generated from matchmove can be. This is step two.
So the workflow is this: we make a pointcloud, that I'm sure everybody does with positiontopoints node, to clearly see the 3d scene, to help with inserting cards, tweaks etc. Then attach a poissonmesh node, and that's it. Be careful, there are several PositionToPoints node types. The one that has class (press i on the node) attribute PositionToPoints2, and loaded by PositionToPoints2.dll. We had an older version of that (PositionToPoints.dll), and that couldn't load the normal pass properly, and poissonmesh couldn't generate anything. Be careful to use unfiltered positionpass, otherwise you will get incorrect points at the edges.
We found the poissonmesh default settings are quite good, in terms of speed and quality. Maybe the size parameter would be better at 1. If you need more geo detail, increase depth a bit, but carefully, this makes much slower the process. The geo generated is much detailed where the pointcloud is present, the empty areas are approximated and rough. But usually good enough.
If not all parts of the scene needed, a good thing to stencil out the unneeded part from beauty, so nuke can handle much better (less geometry), and detail is not spent on stenciled parts.
After the geometry is generated, it can be used for mattepaints, projecting some image on that.
We have several ideas to improve this workflow, but that will be covered later. Hope you will find this tip useful!
Here are some example screenshots:
Needed passes: beauty, unfiltered worldposition, normal |
Generated pointcloud |
Generated geometry on top of the pointcloud |
Filtered (wrong) positionpass, points with incorrect position all over |
Cloud from side |
With geometry |
Quite good fit of the geometry |
Center part of igloo is masked, faster operation |