Blink Ray Marcher v2.0


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Owen Bulka
This project contains five gizmos that allow you to ray march/path trace a wide variety of shapes, including fractals, utilizing the GPU.
Requirements:
13.1, 13.0, 12.1, 12.0 or later
Linux
02 Sep 2022
83

BlinkScript Ray/Path Marcher for Nuke

 

nested_dielectrics_reduced.png

room_test_reformat.png

mandelbox

mandelbulb_trap_test_reduced.png

Setup

Simply download this project and add the following line to your init.py: nuke.pluginAddPath('/path/to/blink_raymarch/src/python'), replacing '/path/to' with the actual path to the repository. The gizmos will appear in the nodes menu under the 'SDF' group, and all callbacks and the FN_BLINK_INCLUDE_PATHS will be set up automatically. The most up to date version can always be downloaded from the linked github page.

Requirements

This project has been tested in Nuke 12.0v8, 12.1v5, 13.0v2, and 13.2v2. Note that after Nuke 12.0 the VRAM cache limits are determined by the same settings as the CPU cache limits in Edit->Preferences->Performance->Caching, so if the limits exceed what your GPU can handle, then the VRAM will continue to fill up until Nuke either crashes or falls back to the CPU, which is very slow for these nodes. For that reason you will want to have a GPU. The above examples were rendered using an NVIDIA GeForce GTX 980 Ti.

Gizmos

ray_march

This gizmo renders the scene using a ray marching algorithm, with support for:

  • global illumination
  • multiple importance sampled direct illumination
    • set the 'max light sampling bounces' to be > 0 to enable this
  • equi-angular sampling for participating media
    • includes volumetric caustics if you lower the 'light sampling bias' and increase the 'max light sampling bounces' knobs
    • increase the 'equi-angular samples' knob for clearer results when using an 'sdf_noise' node with 'scattering' enabled
  • adaptive sampling using a normalized variance AOV
    • plug a 'ray_march' node's output, or a previous render with different seeds, into the 'previous' input of another 'ray_march' node
    • set the minimum and maximum paths to trace, and the node will adaptively interpolate between the values
    • the first node in the chain will always trace the maximum paths
    • be sure to change the seed on each chained node
  • nested dielectrics
  • depth of field based on the camera input, simply check the 'enable dof' knob
  • hdr image based lighting

The alpha channel contains unique ids for each object that is hit on the first bounce.

You can input a standard nuke camera and the perspective projection, axes, and world space coordinates, will match that of Nuke's native scanline renderer, and general 3D system.

The AOV options are:

  • beauty
  • normal
  • world position
  • local position
  • depth
  • stats

The stats AOV gives you the average number of iterations, the average number of bounces, and the total number of paths traced per pixel in the r, g, and b channels, respectively.

sdf_material

This gizmo lets you set the surface properties of an object, and can be passed into an 'sdf_primitive' node in order to apply the surface material to the primitive.

The material properties include:

  • diffuse colour
  • specular
  • specular roughness
  • specular colour
  • transmission
  • transmission roughness
  • refractive index
  • extinction colour
  • extinction coefficient
  • scattering colour
  • scattering coefficient
  • emission
  • emission colour

sdf_noise

This gizmo allows you to vary the material properties of an 'sdf_material' node, or blend between them. It allows for a position seeded, turbulence or fBm noise, with all the properties of Nuke's built-in noise node, plus the additional ability to modify the black and white points, and lift. You can also invert the noise, and select which material properties will be affected by it. This node can be passed into a material, and it will affect that material and that material only. You can also pass it directly into the 'path_march' node's 'noise' input for use with the global scattering coefficient.

sdf_primitive

This gizmo lets you choose the shape, dimensions, and location of an object. It takes other sdf_primitives as inputs, and all nodes in the 'children' input will be positioned relative to it. The children will also interact with the shape according to your selection, allowing you to intersect, subtract, and blend the objects. You can also use any shape as a bounding volume of its children in order to improve performance.

There are also controls for:

  • elongating about the x, y, and z axes
  • mirroring the object across the x, y, and z axes
  • repeating the object on a grid both finitely and infinitely with no extra memory cost
  • hollowing out the objects, which can be used in combination with intersections

The current available shapes are:

  • sphere
  • ellipsoid
  • cut sphere
  • hollow sphere
  • death star
  • solid angle
  • rectangular prism
  • rectangular prism frame
  • rhombus
  • triangular prism
  • cylinder
  • infinite cylinder
  • plane
  • capsule
  • cone
  • infinite cone
  • capped cone
  • rounded cone
  • torus
  • capped torus
  • link
  • hexagonal prism
  • octahedron
  • mandelbulb
  • mandelbox

sdf_light

This gizmo allows you to light the scene with a few different light types, namely:

  • point
  • directional
  • ambient
  • ambient occlusion

You can choose the colour, intensity, and falloff of the light. You can also soften the shadows with a slider.

References

- https://iquilezles.org/articles/distfunctions/
- http://blog.hvidtfeldts.net/index.php/2011/09/distance-estimated-3d-fractals-v-the-mandelbulb-different-de-approximations/
- https://blog.demofox.org/2020/05/25/casual-shadertoy-path-tracing-1-basic-camera-diffuse-emissive/
- https://www.researchgate.net/publication/354065092_Multiple_Importance_Sampling_101
- https://www.arnoldrenderer.com/research/egsr2012_volume.pdf

MIT License Copyright (c) 2022 Owen Bulka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please login in order to download these files.

You have no rights to post comments

We have 2604 guests and 42 members online