STMap_BBox

Today I’m releasing STMap_BBox, a C++ plugin for Foundry Nuke. It does the same thing as Nuke’s native STMap node, but with one additional calculation for also warping the Bounding box.

Download the plugin from my Github:
https://github.com/CreativeLyons/STMap_BBox-public/releases/latest

Instructions on installation are in the README.md file in the download, and are also briefly mentioned in the video.


Lens Distortion Workflow


This plugin is mainly to help make the STMap node more useful in the STMap Lens Distortion workflow.

All plates have lens distortion, and it’s essential in compositing to undistort the plate, and to redistort any element to match the plate distortion. We are constantly jumping between undistorted and redisorted states depending on the task: paint outs, roto, CG, 2D elements, tracking, projections, etc.

It’s fair to say that lens distortion is one of the most common things we do in our nuke scripts.

Most Tracking software, like 3D Equalizer, Syntheyes, even Nuke itself, can export a Lens distortion plugin or node to do the actual lens distortion. They also have the ability to export a Lens Distortion UV map.

A UV map is just a utility image with data that tells Nuke where to warp the image to on each pixel. Using a UV map with the STMap node yields an identical result to using the actual lens distortion node itself. You’d need to save 2 images to disk, an Undistort map, and a Redistort map. In most cases these are static, but sometimes there is an animated lens distortion map needed (full-framerange) because of lens breathing or rack focus.

Why use an STMap workflow over just using the actual lens distortion node?

There could be a few reasons:

  1. You might not have the lens distortion plugin installed. These Tracking softwares ship with their own plugins, specially designed to work with the data that the software is exporting. If you don’t have the plugin installed, you won’t be able to reproduce the distortion. But with the exported UV map / STMap workflow, you can.
  2. Easy to share. This UV map is an image format, usually 32 bit exr for uncompressed data storage. This makes a UV map more universal than say a .nk file, or a plugin file, specific to any software. In fact it’s a software agnostic way of reproducing the same distortion, with the same UV map, anywhere.
  3. Easy to swap out. It can be much easier to swap out or update one single source of true, rather than finding and swapping all the Lens Distortion nodes everywhere in your nuke script.

I’d like to focus on the last point, because this really is what makes this STMap Lens Distortion powerful, especially when paired with a tool like Adrian Pueyo’s Stamps, a hidden input system for Nuke.

When using a template, or just using another shot’s nuke script as a base, you need to swap out all the lens distortions for the correct distortion for that unique shot. Instead of manually needing find and replace each Lens Distortion node everywhere in your script. Hoping and praying that you didn’t miss any (we’ve all had it happen).

The UV map / STMap workflow allows use to have 1 source of truth for our lens distortion, and makes swapping out the old Lens Distortion for a new Lens Distortion as easy as swapping out that map. Every lens distortion is updated instantly.

Pairing this with a template workflow, and checking on “auto-reconnect” on the stamp children. You can actually save a template that will automatically sync and connect to your redistort or undistort maps in your nuke script when the template is brought in. This saves precious time and always ensures you didn’t forget to lens distort, and that you are using the shot’s very own distortion maps.

What’s the catch?

Unfortunately, Nuke’s native STMap node only distorts the Image channels, not the Bounding Box of the image. In fact, because warping the image while keeping the original bounding box would probably make it go out of bounds (stretchy pixels) nuke defaults to just using whatever the `stmap` input BBox is. This is a safe bet, because the image will never warp outside of the UV map image (because that image is telling it where to warp to) so there is no risk of the BBox being too small, and it also eliminates the need to do any extra bounding box calculation.

Because all redistort and undistort maps on plate distortion are the roughly size of the full plate format, or bigger in the case of large undistort with overscan, it means that even if your src input BBox is small, it will replace the BBox with the full format after the distortion warp.

Have a look at the difference in Bounding Box size after using the Lens Distortion node (left) and after using the equivalent STMap workflow (right).

The problem with discarding the input Bounding Box and making it the full frame format is that this creates a compounding effect on later calculations. One of the things nuke does best is optimize for only calculating what it needs to inside of that Bounding Box. If the BBox is 400×400 pixels, then nuke is only computing those 400×400 pixels on your heavy node. If you replace that with a 4k full format bounding box, even though the input area needed is really only 400×400, Nuke now has to calculate the full 3840×2160 worth of pixels.

That specific scenario would be 52x more pixels to calculate, a whopping 5,000% increase… yikes.

Since undistorting and redistorting is happening dozens of times in nuke scripts, you can imagine the effect that tossing away a small bounding box for the full format can have on the entire nuke script.

If we put a Defocus node with a very large value, 400 for example, you will see the Viewer scanline crawling to calculate the full format, every single pixel. Whereas with that same Defocus node, on a smaller area BBox input, it can calculate nearly instantly.


STMap_BBox

Preserving the tight Bounding Box after the distortion is exactly what STMap_BBox was made to solve.

I could not use a blinkscript node because Blinkscript nodes do not touch the BBox, instead I needed to Recreate the STMap node, and add in the additional BBox calculation.

How it works:

The STMap_BBox node samples samples the 4 corners of the source BBox, as well as several points along the edges for irregular shaped warps where bowing of the center of the edge may go wider than the corners.

It then uses the UV Map input to calculate where those points end up after the warp. It then adjusts the BBox to cover the max warp along each edge and draws a final resolved BBox, encompassing the entire warp area. There is also a padding of +2 pixels for safety.


Additional Knobs to know

The STMap BBox has the identical settings to Nuke’s native STMap node, but with a few extra settings for BBox control.

  • Adjust BBox – Adds additional padding to the BBox if needed
  • Intersect Checkbox – Enables the additional BBox calculation. Disabling will skip the BBox calculation, essentially making this Node back into the native STMap node in nuke.
  • Limit BBox to – Allows you to choose the maximum size the BBox is allowed to grow until.

Here is a visualization of the different options for Limiting the Max BBox size to (click to view full size):

  • Union BBox – (Default) Combined maximum of src and stmap input BBoxes
  • STMap BBox – stmap input BBox
  • Src BBox – src input BBox
  • Format – the format
  • Overscan – the format + an Overscan Scale amount, controlled by the Overscan Scale slider

The Overscan Scale knob is default to 1.2, which is the same as if you were to take a Transform node and scale the image up by 1.2 from it’s center. This is useful for undistort.

The Overscan setting is most useful if you have a massive rotoshape, whole bounding box is way bigger than the format or stmap input and you wish to limit it to the format + some overscan padding relative to the format size.


Limitations

The best use-case for the STMap_BBox is static lens distortion warping.

Nuke is able to cache the static frame UVMap and use that to calculate the warp of the input BBox on each frame. It is fast, efficient, and stable.

Where the node runs into trouble is actively changing, high frequency, large distance warps, that are changing every frame.

For my tests, I used an animating noise pattern to heavily distort the image on each frame.

The node runs into trouble because Nuke has to “find” the points on along the BBox each frame, and the larger the distance of the warp, the more time it takes to search and find where the points have gone. This can eat up Nuke’s memory and even cause a crash.

If you need to do a warp like this, I would use the native STMap node that never bothers with this calculation or simply uncheck the “intersect” option in the STMap_BBox to skip the BBox calculation.

I would stick to Lens Distortion scenarios. Animated lens distortion maps (full framerange) should also be fine to use.

It’s more about the large-distance warping and changing every frame that seems to eat up RAM. Lens Distortion warps usually have a pretty limited warp radius and thus the node is easily able to find where the point has warped to by looking at a smaller radius instead of searching the entire format.


Difference between C++ Plugins and Gizmos or Groups

Please remember, this is a C++ Plugin Node, not a Gizmo, and not a Group. In order to use this tool, you need to have this plugin installed.

This makes it fundamentally different from a Group, or a Gizmo, which you could always export to Group if sharing with someone who does not have the Gizmo installed. You cannot export this to a Group, because it is an actual Node in nuke.

If another colleague, or the render farm, does not have this tool installed, then it will error, the same as a missing gizmo.

Luckily, the Image result of the STMap_BBox is identical to that of the native STMap node. So in a worst case scenario, you can always swap it out for a regular STMap and still get the same result, or write a python script to replace all STMap_BBox nodes with STMap nodes.

OS and Nuke Version dependencies

Nuke C++ plugins are compiled plugins. Meaning it turned readable human code into machine code. Compilers convert the code into the C++ plugin file.

However, each OS (Mac, Linux, Windows) converts C++ into a different filetype.

And every Nuke Minor version, Nuke 16.0 vs Nuke 16.1 for example, is slightly different and requires a new compile. Internal modules and commands may have moved or been renamed between Nuke versions, and the compiler bakes those paths into the plugin. Meaning using the plugin compiled for Nuke15.v1 with Nuke 16.0 will not work and will error out if the wrong plugin is loaded.

As a result, I created some auto-loader python code, which will correctly identify which plugin to load based on OS and Nuke version. If it cannot find the right OS or Nuke version, then the auto-loader will skip the load, ensuring that Nuke still starts safely.

You do not need to do anything, this is happening under the hood on Nuke start and ensures that the same package can be used anywhere and that the install is minimum, just pointing Nuke to the STMap_BBox folder.

I am currently supporting Mac and Linux, every Nuke Minor version from 15.0+ and will continue to update with each Nuke Minor version.

I am hoping to get my hands on a windows setup to compile on Windows machines as well. If there is enough demand, please reach out to me or create an issue on Github with Windows request and I can try and support it ASAP.


Download

Head to the latest Release page:
https://github.com/CreativeLyons/STMap_BBox-public/releases/latest

Download the STMap_BBox .zip in the Assets:


Install

Have a look at the README.md file that comes in the .zip for install instructions, but I’ll list the same steps below:

The easiest way to install would be to:

1. Download and unzip the .zip folder from the Release page

    2. Drag and Drop the STMap_BBox folder into your ~/.nuke/ folder

    3. Mac Users will need to unlock permissions so Mac can allows use of the C++ plugin. It’s a classic Mac permissions block since this is some C++ code from Github. Once the STMap_BBox folder is in your .nuke folder, open a terminal window and run this command:

    xattr -cr ~/.nuke/STMap_BBox

    If you installed it somewhere else, you can replace that last path with where ever you have put the folder. You can also simply drag a folder into the terminal window and it will enter the folder path for you.

    4. Add this line to ~/.nuke/init.py (create the file if missing):

    nuke.pluginAddPath("./STMap_BBox")

    Alternatively, point to wherever on the server you placed the STMap_BBox folder:

    nuke.pluginAddPath("/Replace/With/Path/To/Your/STMap_BBox")

    5. Restart Nuke. Find the node under Nodes → Transform → STMap_BBox, or type STMap_BBox in the Tab search.


    Thanks for trying the tool, I hope that it optimizes your lens distortion workflows.

    If you have any issues or requests, you can create a github issue here:

    https://github.com/CreativeLyons/STMap_BBox-public/issues

    Precomp Switcher v1.0

    I’m excited to release Precomp Switcher v1.0, a Nuke plugin that speeds up your precomp workflow.

    Features:

    • A quick panel to create your precomp setup
    • A color-coded Backdrop shows the precomp state at a glance:
    • White – Bypass
    • Blue – Rendering
    • Red – Precomped
    • Toggle between Precomped and Bypass simply by disabling the Switch node.
    • User Guide for everyday Artists & Developer Guide for how to hook it up with pipeline.
    • Optional Feature for Localizing your precomps, for folks working with large files over a network.

    Why use it?

    • Consistency. Every precomp in every script looks and behaves the same.
    • Readability. Tile color and label tell you at a glance whether a precomp is live, mid-render, or rendered.
    • Speed. One hotkey to build, one to render, one to read back and flip/toggle.
    • Pipeline-friendly. If your studio has its own render command, custom Write Node, custom Read Node or read-from-write tool, a TD can configure this tool to use those hooks to their own pipeline commands, instead of native Nuke ones.

    Hotkeys

    • Shift+W to create the Write, Switch, and Backdrop precomp setup
    • F7 to render
    • Alt+R to read back and toggle

    Links

    Github Repo:
    https://github.com/CreativeLyons/PrecompSwitcher

    Latest Release:
    https://github.com/CreativeLyons/PrecompSwitcher/releases/latest

    Nuke Survival Toolkit Release v2.2.0

    Every once in a while, you take on an ambitious project, bite off more than you can chew, and learn a lot along the way… 😅

    I’m excited to release Nuke Survival Toolkit v2.2.0, now featuring a brand-new Online Wiki, replacing the previous Google Docs setup. Each tool now has its own dedicated page with embedded videos and images, along with a fully functional search bar.

    For folks working in internet-restricted environments, there’s also a downloadable Offline Wiki (~70MB). It mirrors the online version (minus video embeds), so you can browse everything locally without internet access. The PDF documentation is now generated directly from the wiki, ensuring it always stays in sync.

    Converting the Google Docs to a full wiki, packaging an efficient offline version, and maintaining a dynamic PDF pipeline was… a challenge. But it is now a well oiled system that is easy to update. This process also gave me a deeper appreciation for the effort behind maintaining high-quality documentation, credits, references, and educational resources. Kudos to all you Wiki warriors out there.

    Hope the new wiki helps you find tools faster or discover ones you didn’t know were there.


    New Documentation System
    – Live Online Wiki (replacing the previous Google Docs)
    – Dedicated page for each tool
    – Embedded videos, GIFs, images, and links
    – Full search functionality for quickly finding tools
    – Downloadable Offline Wiki (~70MB) for offline use (no video embeds)
    – PDF documentation generated directly from the wiki (always in sync)
    – Updated NST menu documentation launcher
    – Auto mode: Online Wiki → Offline Wiki → PDF

    What else is new since v2.1.0?
    – 27 new tools added
    – 44 tool updates, including a Nuke 13+ python2 to python3 sweep
    – Nuke 16 & PySide 6 compatibility for all tools needing upgrade
    – New CardToTrack v9 release supported (works on Nuke 16)
    – 11 targeted issue fixes & cleanup: ie. improved Windows path handling

    Link to the new NST Release page:
    https://github.com/CreativeLyons/NukeSurvivalToolkit_publicRelease/releases/tag/v2.2.0

    Link to the New Online Wiki Documentation:
    https://creativelyons.github.io/NukeSurvivalToolkit_Wiki/

    Link to both Github Repos:
    NST: https://github.com/CreativeLyons/NukeSurvivalToolkit_publicRelease
    NST Wiki: https://github.com/CreativeLyons/NukeSurvivalToolkit_Wiki

    CG Compositing Series – 2.3 Material AOVs – Direct, Indirect, SSS


    Direct, Indirect, SSS (intermediate) passes

    In this tutorial, we move down the levels of complexity into the Intermediate category and explore breaking apart diffuse, specular further into Direct Lighting, Indirect Lighting, and SubSurface Scattering


    What is Direct Lighting?

    • Direct Lighting is when the Light Source directly illuminates a surface.  This could be considered the “first bounce” or the first time the light ray is hitting a surface.
    https://en.wikipedia.org/wiki/Global_illumination

    What is Indirect Lighting?

    • Indirect Lighting is all subsequent bounces of the Light.  This can be known as “Bounce Lighting”.  Light is often diffused throughout the scene, and also will pick up some of the surface colors.
    https://en.wikipedia.org/wiki/Global_illumination

    Direct and Indirect Passes as rendered / calculated separately and combined to equal the beauty render. Direct is only the “first bounce” or whatever is directly in view of a light source. Indirect is all bounces after the first hit (excluding the first bounce).

    https://sinmantyx.wordpress.com/2015/03/18/perfect-clamp-1/

    Direct and Indirect Lighting in the real world is used to describe a harsh lightsource, directly hitting a room or object and casting harsh shadows, verses indirect or “bounce lighting” which the light is aimed at a wall or ceiling or bounce card, and diffused throughout the scene, creating a more ambient lit environment.

    https://www.olamled.com/direct-lighting-vs-indirect-lighting-which-is-better/

    Raytracing – Direct Lighting

    https://developer.nvidia.com/discover/ray-tracing
    • Ray tracing is a render calculation used to find Direct Lighting, shadows, and specular highlights.
    • Instead of calculating from the Light Source outwards and every direction in the scene, it saves time by going from the Render Camera backwards, only needing to calculate light rays hitting the camera, and necessary for the creating the final image.
    • It starts from a pixel on the final render and follows the light path until it reflects off or through a surface/material. It then asks “Am I directly illuminated by a light source?” and if so follows the path back to the light source, and determines the distance, intensity, and color of light hitting the surface.
    • If the area is not hit by direct light, it renders as black. This calculation ends after the “first bounce”.
    https://www.dualshockers.com/xbox-one-exclusive-quantum-breaks-wip-screenshots-show-advanced-effects-and-comparisons/

    Global Illumination “GI” – Indirect Lighting

    https://www.scratchapixel.com/lessons/3d-basic-rendering/global-illumination-path-tracing/introduction-global-illumination-path-tracing.html

    • Global Illumination or “GI” involves various techniques to calculate the indirect lighting that occurs when light bounces around in a scene.
    • This process helps to subtly illuminate shadowed areas and contributes to the overall color and intensity of the scene, especially around areas that are hit by direct lighting.
    • There are often many number of bounces allowed, depending on render time and settings. Each bounce inherits color from objects and materials and further distributes light into the scene.
    • The result is a more realistic and natural-looking shot, as it mimics the complex ways light interacts in the real world.

    I mention this amazing Raytracing video from Josh’s Channel that breaks down how raytracing is working in the renderer with amazing visuals. The video itself is amazing, and entertaining. I highly recommend watching the whole video if you want to know about state of the art raytracing techniques.

    The section I clipped from Josh’s video is between 1:24 and 2:14


    Direct + Indirect = Total Lighting

    https://www.dualshockers.com/xbox-one-exclusive-quantum-breaks-wip-screenshots-show-advanced-effects-and-comparisons/
    https://www.dualshockers.com/xbox-one-exclusive-quantum-breaks-wip-screenshots-show-advanced-effects-and-comparisons/

    Image Property of DreamWorks – SIGGRAPH 2010

    Image Property of DreamWorks – SIGGRAPH 2010

    Real Time Raytracing / Global Illumination – RTX Graphics

    Real Time Global Illumination, is becoming the new normal in Real Time Renderers such as Unreal Engine and Unity. More powerful Graphics cards are being upgraded to handle these immense calculations, such as Nvidia’s RTX 3090 or 4090 series graphics cards. These are allowing for real time bounce lighting and reflections, instead of traditionally baked lighting in environments. This all adds significant realism to the scenes and games, and shows just how important this process is to photo realism.


    How can we use Direct & Indirect Passes in Compositing?

    1.) Contrast / Color Correction

    direct / indirect pass decontrast
    • Individual control of the mids/lows and highlights. Gives more flexibility over the color correction in order to increase or decrease contrast and better match CG to plate.

    2.) Filters and FX

    • Adding glow filters to Direct Lighting pass to “punch” the lighting and adding some realistic camera lens fx.  Using direct or indirect lighting passes to drive other FX and filters.

    3.) Denoising CG

    • Indirect passes (and Sub Surface Scattering) are very expensive renders, and often arrive with some unwanted render noise and chattering.  Instead of applying denoise techniques to the whole beauty render, applying denoise to only necessary passes can help preserve details and improve final quality of your renders in comp.

    CG Denoising Techniques in Nuke

    1.) Nuke’s Denoiser

    Nuke Denoise Node

    We can simply use Nuke’s built in denoiser, it is the easiest to test and doesn’t do a bad job after some settings adjustments. No plugin or external tool required

    2.) Neat Video Denoise Plugin

    https://www.neatvideo.com/
    Neat Video is the best denoiser on the market. It is fairly affordable, and chances are your studio already has a license. It can be a bit heavy, I would recommend pre-rendering the results instead of leaving them live in your comp script.

    3.) Motion Vector Denoise

    This technique involves using the Motion Vector Utility pass to distort the previous frame and next frame’s pixels, back into the position of the current frame. Usually you see a 3 frame average, or 5 frame average, (current frame, +2 frames ahead, -2 frames before). 

    It’s also common to use a TemporalMedian Node to help smooth out noise chattering over pixels that are not changing that much frame to frame.

    It’s important to note that we should always try to minimise artifacting and quality loss by isolating degrain techniques to only the problematic render passes, and not every layer or the beauty overall. Typically most of the problematic CG noise is occurring on the Indirect and SubSurface Scattering Passes.

    MotionVector Denoise Technique

    Some Great tools for Motion Vector Denoising:

    Vector Median:

    https://www.nukepedia.com/gizmos/filter/vectormedian

    Deflicker Velocity:

    https://www.nukepedia.com/gizmos/time/deflicker-with-velocity-pass

    I do believe more tools could be made using these techniques and shared with the community. If you want to have a go at using this technique to come up with different tools that reduce grainy CG while minimizing artifacting, I am sure the Nuke community would be grateful!


    Downloads:

    If you haven’t downloaded the FruitBowl Renders already yet, you can do so now:

    You can Choose to either download all 3 FruitBowls at once:
    FruitBowl_All_Renders_Redshift_Arnold_Octane.zip (1.61 GB)

    Or Each FruitBowl Render Individually for faster downloads:

    FruitBowl_Redshift_Render.zip (569.1 MB)

    FruitBowl_Arnold_Render.zip (562.8 MB)

    FruitBowl_Octane_Render.zip (515.4 MB)

    The project files and the Renders are separate downloads, so if you have already downloaded 1.1 What and Why files or the Fruitbowl Renders, there are a couple ways to combine them to work.

    1. Either add the .nk script to the previous package (in the folder above SourceImages, with the other .nk scripts)
    2. Or simply drop the Render files into the SourceImages folder of the new 1.2 project folder

    Project Files for this Video:

    Along with the fruitbowl renders above, here are the nuke script and project files from this video, so you can follow along:

    Nuke Project File:
    CG_Compositing_Series_MaterialAOVs_Intermediate_DirectAndIndirect.nk


    Blender Cube Room Diorama zip ( 3 renders ~ 70MB each, zip file total 204.4MB)

    original cube diorama blender files from blender demo file site:
    https://www.blender.org/download/demo-files/


    Cornell Box noisy Render zip (1.55GB) exr img seq

    Special thanks to Valentin Nicolini for providing the cornell box render

    Please note the render is using ACES colorspace, so you’ll need to set your nuke OCIO settings to ACES to view this render correctly.


    Vray Room – Can be downloaded from this website, look for “download example scene” (36.6MB):

    https://www.chaos.com/blog/how-to-use-cryptomatte-render-elements-in-v-ray-for-sketchup


    Vray Teapots can be downloaded from this website ~35MB:

    https://www.lucamignardi.com/2-5d-relighting-nuke/


    The Foundry spheres examples can be downloaded here:

    https://learn.foundry.com/nuke/content/reference_guide/toolsets_nodes/toolsets_nodes.html


    Since I am using Stamps in the script, all renders can be swapped out at the top of the script where the “SourceImages” Backdrop is, and the rest of the script will get populated correctly


    Finally here is a PDF version of my slideshow in case you would like to save for future research or review:


    Research links:

    https://www.pluralsight.com/blog/film-games/understanding-global-illumination

    https://en.wikipedia.org/wiki/Global_illumination

    https://www.ledyilighting.com/direct-lighting-vs-indirect-lighting/

    https://manual.reallusion.com/iClone_7/ENU/Content/iClone_7/Pro_7.4/27_GI/GI_Basic_Intro_and_Benefits.htm

    https://sinmantyx.wordpress.com/2015/03/18/perfect-clamp-1/

    https://blogs.nvidia.com/blog/direct-indirect-lighting/

    https://lightingdistinctions.com/direct-light-vs-indirect-light-how-to-make-the-most-of-both/

    https://3dheven.com/what-is-global-illumination-and-how-does-it-differ-from-other-rendering-techniques/

    https://cg.informatik.uni-freiburg.de/course_notes/graphics2_09_pathTracing.pdf


    Thank you for all your patience, I’m hoping to publish more tutorials in this series soon.
    Best,
    -Tony

    VFX Nomads Podcast: Episode 001


    Following the well received VFX Community Nuke webinar hosted by the Foundry a couple months ago, link hereJosh Parks, Tony Lyons, and Adrián Pueyo wanted to do more. So we decided to start recording more of our conversations.

    We’re excited to introduce the VFX Nomads Podcast

    Along side us is Senior Compositor/Compositing Supervisor and good friend, Gautama Murcho, who shares his wealth of knowledge, offering insights into his experiences in the VFX Industry.

    The podcast is also on Spotify if you prefer!

    Please Subscribe if you’d like to have new episodes on your radar. Feel free to post comments, feedback, or questions for us to talk about in the future. We hope you enjoy the first episode! 

    Why Join the VFX Community? Foundry YouTube Live Panel with Josh Parks and Adrian Pueyo

    I recently had the pleasure of teaming up with Josh Parks and Adrian Pueyo in a Foundry Live Panel event on YouTube Live. We talk about advice for people starting in the industry, getting into teaching, how to keep learning, and the importance of networking and community.

    Josh, Adrian, and I are friends and former colleagues. I couldn’t be more proud and excited to see them evolve in their careers and see their various contributions to the VFX Compositing Community over the years. It was an honor to talk alongside them in what felt like a typical chat we might have if we all met up in person over lunch.


    Back in December we decided to create a space on LinkedIn to be a place for folks to share cool nuke and compositing posts. The LinkedIn news feed can be a little bit of a fire hose of information, and if you don’t save something, it can quickly disappear into the ether. If you’d like to be part of the nuke community there, for articles, tutorials, news, and questions, we’d be happy to have you.

    Foundry Nuke Compositors LinkedIn Group

    I had an absolute blast speaking alongside Adrian and Josh, and in my opinion, it went by too fast! I hope you enjoy the talk and maybe get a little inspiration out of it. I really hope to chat with them again in the future.

    If you’re interested in checking out Josh or Adrian’s websites and courses, here are some links:

    Josh Parks:
    https://www.compositingpro.com/
    https://www.nukecompositingtutorials.com/

    Check out Josh’s newsletter, Training Courses, and Masterclass series

    Adrian Pueyo:
    https://adrianpueyo.com/

    Adrian just released a brand new Python Course tailored for nuke compositors on his new training platform. Check out his courses page for more info.

    CG Compositing Series – 2.2 Material AOVs (Bonus) – Cross Polarization Photography


    Download the PDF here ^


    Cross Polarization Photography

    In this Bonus video on Material AOVs, I cover Cross Polarization photography, which is a technique that allows us to separate diffuse and specular components of everyday objects. I go into detail about the lighting concepts that allows this separation to occur, and how it’s used to gather reference and textures to recreate objects in 3D.


    Electromagnetic Spectrum

    • Visible Light is a section of the Electromagnetic Spectrum
    • Light / Color is represented in 2D as a Sine Wave with a specific frequency

    3D Light Wave Representation

    • The 2D representation looks a bit different in 3D space, since the light waves could be oriented in any and all directions along it’s forward axis
    • A light beam with randomly oriented Light Waves is referred to as an Unpolarized Light

    Linear Polarization of Light

    Linear Polarization isolates one specific angle of the light wavelength, only allowing a portion of the light waves that were oriented in the that direction, through the filter


    Cross Polarization of Light

    • Cross Polarization uses 2 Polarizers that are perpendicular to each other, effectively eliminating the light wave passing through.
    • The first polarizer isolates the light wave to only one orientation
    • The second polarizer, if parallel to the first, continues to allow the polarized light through, but as it becomes more perpendicular, the light gets dimmer, and eventually blocked entirely


    Polarization Upon Reflection

    • When unpolarized light hits a reflective surface (with a refractive index different than the surrounding medium, such as glass, snow, or water) the specular reflection is polarized or partially polarized to the angle perpendicular to the plane of incidence. (along the surface)
    • How polarized the Reflection depends on many factors; angle of incidence, material type, etc.

    Brewster’s Angle

    • At a specific angle, the specular reflection is completely polarized to the angle perpendicular to the plane of incidence. 
    • This angle is known as Brewster’s Angle.

    Unpolarized Diffuse Component

    • Only the Specular Reflection has the effect of the Brewster’s Angle Polarization 
    • The Diffuse Component is Unpolarized, because they are newly emitted photons from excited atoms
    • This phenomenon only happens when the light is reflected off dielectric materials such as water or glass.
    • When reflection occurs on a metallic surface, no Brewster Angle nor refracted light exist

    Polarized Specular Reflections

    • Placing a Linear Polarizer filter in front of the observer will Cross Polarize some Specular Reflections if angled correctly.  It blocks the polarized reflection light wave from shining through it
    • This is how Polarized Sunglasses are able to eliminate harsh glares and reflections from dielectric surfaces such as glass, water, snow, etc.


    Cross Polarized Photography

    • If you polarize the light source, the Specular Reflection is also polarized (because it’s a mirror reflection of the light wave).
    • The Diffuse Component is unpolarized light because it is newly created lightwaves oriented randomly.  Adding a second polarizer on the Camera, means we can block the Specular Component entirely depending on the angle of the Polarizers.  When the 2 polarizers are parallel, we see Specular + Diffuse , and when they are perpendicular we will see only Diffuse.

    • The Parallel Polarized image gives use the Specular and Partial Diffuse (only Diffuse Component of that orientation)
    • The Cross Polarized image, negates the Specular, and only shows the other half of the Diffuse Component
    • To isolate the Specular Component, take Parallel Polarized image (Specular + Partial Diffuse) and minus the Cross Polarized image (Partial Diffuse).  The Diffuse Components cancel out, and all that is left is the Specular Component

    • This Cross Polarization Photography allows CG Artists to collect photogrammetry data of everyday objects, and allows  them to recreate these objects in 3D with accurate Diffuse and Specular Maps for Physically Based Rendering
    • What seems just like theoretical Diffuse/Specular Render Pass separation in CG is actually a lighting phenomenon that can be separated into Diffuse and Specular Components in the real world

    Notice that Metallic Materials have no real Diffuse Color to them, They show up as completely black in the Cross Polarized result.  Metals are entirely surface level Specular Reflections


    • Occasionally, the Diffuse Components of the Parallel Polarized and Cross Polarized Images are slightly different, (brighter or a shift in color for example)
    • In this case, when we minus the Cross Polarized result from the Parallel Polarized result, we are left with leftover color information or artifacts.  The Specular Component can be desaturated to compensate for those color artifacts
    • Remember that in Dielectric Materials the Specular Component is the same color as the light source, but Metals can sometimes tint the Specular color depending on the type of Metal

    Light Stage: Cross Polarization

    • The light stage used in films is capturing evenly lit, cross polarized textures of various facial expressions.
    • This helps separate Diffuse and Specular and aids in tracking features of the face

    References:

    Here are some great websites that go into more detail about polarizations:

    Reflection and Polarization of light in machine vision – Toshiba Teli Corporation

    FilmicWorlds – How to Split Specular and Diffuse in Real Images

    Polarization Explained: The Sony Polarized Sensor

    Youtube – Cross Polarization Tutorial: Removing Specular Highlights and Reflections – Classy Dog Studios

    Youtube – Cross Polarisation Explained by Grzegorz Baran

    Youtube – The Key to Cleaner 3D Scans: Cross-Polarization – William Faucher

    PetaPixel – Cross Polarization: What It Is and Why It Matters

    optometryzone – How do Polarised glasses work?

    Youtube – ScholarSwing – 16 – Class 12 – Physics – Wave Optics – Polarisation

    Youtube – Khan Academy Polarization of light, linear and circular | Light waves | Physics

    Youtube – xmtutor – What is Polarisation?

    Youtube – xmtutor – Third Polariser

    The Light Stages and Their Applications to Photoreal Digital Actors – PDF

    Light Stages https://vgl.ict.usc.edu/

    CG Compositing Series – 2.1 Material AOVs – Diffuse, Specular, Emission

    Material AOVs

    In this post we are going to be focusing in on the Material AOVs Category.

    Levels of Complexity

    There are different levels of complexity to rebuilding Material AOVs into the beauty, and it all depends on how much flexibility and control you want with the cost of complexity and speed.


    Simple

    • Diffuse
    • Specular
    • Emission
    • Other – Refraction / True Reflection

    Intermediate

    • Diffuse
      • Direct Diffuse
      • Indirect Diffuse
      • Sub Surface Scattering
    • Specular
      • Direct Specular
      • Indirect Specular
      • Reflection
      • Coat
      • Sheen
    • Emission
    • Other – Refraction / True Reflection

    Complex

    • Diffuse
      • Direct Diffuse
      • Indirect Diffuse
      • Sub Surface Scattering
        • Raw Diffuse
        • Albedo / Color / Texture
    • Specular
      • Direct Specular
      • Indirect Specular
      • Reflection
      • Coat
      • Sheen
        • Raw Specular
        • Albedo / Filter / Texture
    • Emission
    • Other – Refraction / True Reflection

    Diffuse, Specular, and Emission are the Foundational Categories, and the complexities are subdivisions of the Diffuse and Specular Categories

    So let’s first focus on the Simple category of Diffuse, Specular, and Emission and really break those down and understand them fully. This will make the future subdivisions easier, familiarise us with terms and concepts, and help us have a grounded foundation of knowledge for what we are adjusting when using these passes.


    The full presentation from the video can be downloaded here in pdf format, for those who want to keep or study it offline:

    Adjectives of Specular, Diffuse, and Emission

    Specular

    • Reflection
    • Mirror
    • Shiny
    • Glossy
    • Wet
    • Metallic
    • Highlights
    • Pings
    • Crisp
    • Sharp
    • Polished

    Diffuse

    • Soft
    • Flat
    • Ambient
    • Natural
    • Rough
    • Earthy
    • Organic
    • Matte
    • Weathered
    • Dull

    Emission

    • Bright
    • Radiant
    • Luminescent
    • Glowing
    • Self-Illuminating
    • Incandescent
    • Electric
    • Beaming
    • Shining
    • Luminous
    • Illuminated

    Emission

    • Emission is any object, material, or texture that is actively emitting light into the scene
    • This includes any Lights, Super-heated metals, or Elemental FX like fire/ sparks / lightning / magic etc
    • Neon Lights, Screens, Monitors are all examples of real life Emission objects

    Diffuse vs Specular

    Specular – Surface Level Reflections

    Diffuse – Light passes through surface and interacts with the material at a molecular level, Scattering and Absorption allow certain colors to re-exit and scatter into scene

    Let’s talk about Specular first andSurface level Reflections


    Specular

    Law of Reflection

    • The angles of incidence is equal to the angle of reflection

    Smooth Surface – Specular Reflections

    • Light Beam = a bundle of parallel light rays
    • Light Beam remains parallel on incidence and parallel on reflection

    Planar Mirror and Virtual Image

    • An Image created by planar specular reflection that does not actually exist as a physical object is referred to as a Virtual Image.
    • The Virtual Image appears to be located “behind” the mirror
    • Virtual Image distance =  Object to Mirror + Mirror to Observer.
    • Speculum is the Latin word for “mirror”, which is where “Specular” derives from

    The people are witnessing a virtual image of themselves looking back, that is double the distance from them to the mirror. The light travels from them -> to the mirror, and then from the mirror -> back to their eye

    Notice the reflected virtual image of the chess piece is in focus, even though the real piece (in the foreground) is out of focus. The camera lens is respecting the mirror’s virtual image distance, even though the mirror itself is out of focus.

    Here you can see a ground plane mirror appearing to invert the tree in it’s virtual image


    Rough Surface – Diffused Reflection

    • The uneven surface causes the Incidence Rays to hit at different angles
    • The outgoing reflection rays scatter in different directions

    Here you see some examples of different CG materials along the Roughness / Glossiness spectrum


    Wet Surface Reflections

    When a surface is wet, the water fills the gaps and flattens the surface and causes more a specular reflection


    Microscopic Surface Details

    In these slides and examples we are discussing surfaces at a microscopic level. You might think a piece of paper looks smooth, but under a microscope it has quite a bit of roughness to it, which is what makes it so evenly lit and diffuse.


    Metallic vs Dielectric Surfaces

    The diffuse and specular terms describe two distinct effects going on.  The Light interacts with materials differently depending on if the material is a metal, or a non-metal (Dielectric)

    Dielectric – Absorbs and Scatters light

    Metallic – Does not Absorb light. Only Reflects


    Dielectric (Non-Metal)

    • Light penetrates the surface level and the molecules of the material absorb and scatter the light within
    • The light photons excite the atoms they hit below the surface. Some of the light is absorbed, and this energy is converted to heat. Then new light rays (photons) are emitted from the excited atoms. Those might excite nearby atoms or exit the surface as new photons. These new photons are same color as our material.
    • The Base Color Texture (Albedo Map) – determines the color of the diffusely scattered photons from excited atoms.  It’s the color that is scattered back out and not absorbed by the material

    Metallic

    • Does not Allow light to penetrate the surface and does not Absorb light. They only Reflect light on the surface
    • Metals can be thought of as positively charged ions suspended in a “sea of electrons” or “electron gas”.  Attractions hold electrons near the ions, but not so tightly as to impede the electrons flow.  This explains many of the properties of metals, like conductivity of heat and electricity
    • The incoming photon does not excite the atoms, but bounces directly off the electron gas
    • The Base Color (Albedo) is used to describe the color tint of the specular reflection
    “Electron Gas” Model

    Notice the Specular Reflections are tinted a certain color depending on the metal type:

    On Dielectric Plastic balls, the material color changes, but notice the specular highlights are the same color, maintaining the color of the light or surrounding environment.

    Comparison of a Metallic vs Dielectric Material in CG


    Chrome Sphere and Diffuse Ball

    Used as a reference to see what something 100% Smooth and Metal (Specular) and 100% Rough and Dielectric (Diffuse) looks like in the scene.

    Resources:

    DAIWTONG824@OUTLOOK.COM

    10" 50/50 Chrome and Grey VFX Ball


    Diffuse

    The diffuse component includes light that penetrates the surface and interacts with the materials molecules. This happens in different ways in the real world

    Transmission

    • Light passing through the material / surface
    • Can be thought of as “transparency”

    Refraction

    • when light changes angles as it goes through different materials or mediums

    Absorption

    • When certain wavelength colors of light get absorbed by the material

    Scattering

    • when light is dispersed in many directions when it comes into contact with small particles or structures in the material

    Simplified Diffuse Calculation

    When the distance that light travels beneath the surface is insignificant and negligible, the calculation can be simplified by the renderer and just calculated at the surface point where the light hits. It uses the Base Color Texture (Albedo) as the Diffuse Color that will scatter. 


    Sub Surface Scattering

    When the distance the light travels beneath the surface of the material is significant, the interior scattering must be calculated. This is referred to as Sub Surface Scattering (SSS)


    Physically Based Rendering Terminology

    Albedo

    • Base Color Texture Map
    • On Dielectrics (non-metal) refers to color of material
    • On Metals, refers to the color tint of the specular reflection
    • Texture map is without highlights, shadows, or ambient occlusion

    Metalness Map

    • What area is metallic or not. (will use Albedo Color differently). Usually Black or White

    Roughness (Glossiness) Map

    • How blurry or how sharp the reflection will be

    Real life objects often have a diffuse and a specular component

    Diffuse describes the color of the billard balls, but the specular highlights are all the same color (reflecting the color of the light above the table)


    Iridescence

    • There is also Iridescent materials that change specular color depending on viewing angle.
    • Iridescence is a kind of structural coloration due to wave interference of light in microstructures or thin films.

    Nuke – Simple Material AOV setup

    We can break our fruit bowl render into the 3 simple components, Diffuse, Specular, and Emission. They layers look like this:

    You can download the nuke script shown in the Tutorial. I created the mini setups for the 3 different types of renderers, Arnold, RedShift, and Octane. Dividing the Beauty render up into their 3 Diffuse, Specular, Emission Components, and Recombining them.

    Download nuke script project file


    If you haven’t downloaded the FruitBowl Renders already yet, you can do so now:

    You can Choose to either download all 3 FruitBowls at once:
    FruitBowl_All_Renders_Redshift_Arnold_Octane.zip (1.61 GB)

    Or Each FruitBowl Render Individually for faster downloads:

    FruitBowl_Redshift_Render.zip (569.1 MB)

    FruitBowl_Arnold_Render.zip (562.8 MB)

    FruitBowl_Octane_Render.zip (515.4 MB)

    The project files and the Renders are separate downloads, so if you have already downloaded 1.1 What and Why files or the Fruitbowl Renders, there are a couple ways to combine them to work.

    1. Either add the .nk script to the previous package (in the folder above SourceImages, with the other .nk scripts)
    2. Or simply drop the Render files into the SourceImages folder of the new 1.2 project folder

    This will help the Read nodes auto-reconnect to the sourceImages for you.


    Recap

    • Emission / Illumination materials emit light
    • Specular and Diffuse can be separated by Surface Level Reflections and below surface Material Interactions
    • Each individual light ray follows the Law of Reflection.
    • The smoother a surface is, the more mirror-like the specular reflection will be.
    • The roughness of a surface will cause the reflected rays to scatter, and reflection to be blurred.
    • Metallic materials do not allow light to enter the surface.  They only reflect light
    • Dielectric materials allow light to enter the surface.  Light rays are refracted, absorbed, scattered by the materials molecules. Certain color wavelengths re-exit the surface in random directions, which is what we perceive as the materials color
    • Albedo – Base Color Texture. On Dielectrics – color of material | On Metals – color tint of the specular reflection.
    • Sub Surface Scattering is when light below the surface travels a significant distance before re-exiting
    • Iridescent materials tint the color of the specular reflection depending on viewing angle.

    References, Resources, Credits

    Firstly, Thanks to Pexels for providing such a good resource for stock reference images

    I did a hell of a lot of research on this topic before creating the video, I really encourage you to dig a little further and explore the topics more using these great resources:


    Naty Hoffman

    Youtube – 2015 Siggraph Presentation – Naty Hoffman – Physics and Math of Shading | SIGGRAPH Courses

    2015 Siggraph Presentation – Naty Hoffman PDF Paper:


    Khan Academy

    Video – Specular and diffuse reflection

    Video – Specular and diffuse reflection 2

    Video – Virtual Mirror


    Scientific websites:

    Website – The Physics Classroom – Specular vs Diffuse Reflection

    Youtube – The Physics Classroom – Specular vs Diffuse Reflection

    Website – Olympus LS – Interactive Explanation of Diffuse and Specular

    Youtube – Specular vs. Diffuse Reflection, Incident and Reflected Angles | Geometric Optics | Doc Physics

    Website – Erika Jame Site – Reflection of Light

    Youtube – Specular vs Diffuse Reflection | Physics with Professor Matt Anderson | M27-05

    Youtube – Physics with Professor Matt Anderson | Physics with Professor Matt Anderson

    Youtube – Reflection of Light Explained Clearly – MooMooMath and Science


    CGI Blog Posts

    Master of Light – Vector Perez Mindmap

    Website – CG Learn – Physically Based Shading

    Website – PBR Texture Conversion – Marmoset

    Website – Basic Theory of Physically-Based Rendering – Marmoset

    Website – JORGEN HDRI Explained

    Website – THE PBR GUIDE – PART 1 – Adobe Substance 3D

    Website – Material physics in context of PBR texturing – HandlesPixels

    Website – PHYSICALLY BASED RENDERING ENCYCLOPEDIA

    Website – Tutorial: Blender – Quixel/Substance – Sketchfab: A Proper PBR Workflow

    Website – Omniverse MDL Materials

    Website – What is an Albedo Map and How to use it ? by Alex Glawion

    Website – to buy chrome sphere and diffuse balls – VFX Super Store

    Wesbite – Physics Stack Exchange – Why don’t dielectric materials have coloured reflections like conductors?


    As always thank you for watching, hope you learned something. More videos to come.

    The Foundry Nuke: Gizmo Creation – Tips and Tricks

    Hi everyone,

    The Foundry has recently published a video I created for them earlier this year, Gizmo Creation: Tips and Tricks. Let me know if you found them useful, hopefully there will be more parts in the future. Thanks!

    I will just grab the great description from the video the Foundry has provided:

    Gizmos are user-created super-tools in Nuke, which are an easy way to package up parts of your node graph into a single group – or Gizmo – so that it can be shared across projects, teams, and Nuke Scripts.

    In this video, Tony Lyons gives an insight into how he creates Gizmos in Nuke.

    He starts with the User Knob Interface and how it’s been revamped, making Gizmo creation more straightforward and faster than ever before.

    Tony then looks at how we can elevate the flexibility and versatility of our Gizmos by adding multiple inputs and a switch node so you can switch between inputs easily.

    He also touches on how parameters from nodes within your Gizmos can be added to the Gizmo itself, allowing you to adjust things from the node graph without needing to dive into your tools to find a specific knob tweak.

    Want to know more about Gizmos? Check out

    https://learn.foundry.com/course/1023…
    https://learn.foundry.com/course/6585…

    Want to see more of Tony Lyons? Check out https://www.creativelyons.com/

    Interested in Nuke? Try it for free here! https://www.foundry.com/products/nuke…

    Chapters 0:00
    Introduction 0:31
    User Knob Editing Toolbar 1:29
    Linking Parameters Between Nodes 3:27
    Changing Knob Properties 4:28
    Speed Up Gizmo Creation 5:13
    Customising Input Names 8:01
    Changing the Default Input 10:50
    Switching Between Multiple Inputs 14:52
    Adding Mix and Mask Options 20:13
    Adding Channel Options

    About Us: We are the creators of industry-standard visual effects, computer graphics and 3D design software for the Digital Design, Media and Entertainment industries. Since 1996, Foundry has strived to bring artists and studios the best tools for their workflows so they can battle industry constraints whilst staying creative. Subscribe to our channel and get the latest news, tutorials, webinars and updates from the Foundry team.

    Keying Template Demo with VFX for Filmmakers


    I was recently on VFXforFilmmakers channel doing a keying demo using my advanced keying template. Matt has kindly filmed some 4K ACES blackmagic footage for all of you to practice on, and we’ve included this nuke script, original footage, pre-renders and final render in the work files for you to play around and dive into.

    It’s a great resource and practical case of how I would use the techniques and templates that I developed in the series. By no means the only way to keep, but hopefully you will find many parts interesting and valuable.

    The FREE working files can be downloaded from Matt’s website VFXforFilm.com

    https://www.vfxforfilm.com/online-store/Spit-Ballin-Episode-1-Keying-in-Nuke-p300452414