When it comes to optimizing your nuke scripts (working files) there is always room for improvement. What i tend to do more and more is using STMaps for all kind of things.
What i want to talk about today is projecting STMaps on geometry.
You can easily create an STMap with an expression node.
Have a look at my blog post "useful nuke expressions" for more information.
Projections are always useful to track in paint patches or roto masks.
By projecting the STMap and then warping your paintpatch or roto using the STMap node you gain a lot of advantages:
1. You can project the stmap and prerender the result to speed up processing time. This way your heavy geometry and projection not always get recalculated.
2. You are able to project multiple images / masks without shuffling them in other channels, just by using multiple STMap nodes.
3. With my gizmo "STMapRefFrame" you are able to change the reference frame of STMap to whatever frame you want. So you can project images / masks from different frames just using the one projection.
You can insert it before you pipe the stmap in the STMap node to set a new reference frame. Your input image will not change on this frame and will get warped accordingly on the others.
I realized that v1.0 caused a difference in the warp before and after using the gizmo -> this introduced sliding
I reworked the gizmo completly, and introduced 2 different precision modes:
1. The standart mode is 'low precision' which is the same then in version 1.0
This mode just substracts the warp on the new reference frame from the stmap.
2. The new mode is 'high precision'. This should work without introducing sliding in the warp but is much slower.
It uses an reverse stmap to warp the warp on the reference frame with the movement of the stmap.
It uses an position to points node to create the reverse stmap which mades it slow.
(This approach comes from the gizmo 'in_InverseSTMap' by Luca Mignardi.)
This was the initial version.
Get it on nukepedia:
Copy gizmo from pastebin:
Place the 'STMapRefFrame.gizmo' in your .nuke folder or any other user-defined plugin paths. Reload your plugins inside of nuke.
Tested with Nuke 10 and newer versions, but it could also work in older ones.
Feel free to comment for any questions and suggestions.