N_RayReflect v1.0
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Owen Bulka
This gizmo allows you to reflect, diffuse, and refract rays using a normals AOV, a camera, and an HDRI, with physically correct rays.
Requirements:
13.1, 13.0, 12.2, 12.1, 12.0, 11.3 or later
Linux, Mac, Windows
13.1, 13.0, 12.2, 12.1, 12.0, 11.3 or later
Linux, Mac, Windows


Setup
Simply clone/download this repo and add the following line to your init.py
: nuke.pluginAddPath('/path/to/normal_ray_reflect/src/python')
, replacing '/path/to
' with the actual path to the repository. The gizmo will be available as 'N_RayReflect' the next time you launch Nuke. There is an example in the examples/
directory; simply insert a normal pass to get started.
Alternatively just copy paste the gizmo at src/gizmos/N_RayReflect.gizmo
into your Nuke script.
Inputs
- hdri
- The HDRI image that will be seen in reflections/lighting
- camera
- The camera to shoot rays out of
- normals
- The normals pass that will be used to reflect, refract, and diffuse the rays
- surface
- The surface properties at each pixel location
- R is specular
- G is specular roughness
- B is transmission
- A is transmission roughness
- The diffuse contribution is 1 - specular - transmission
- specular + transmission should not be greater than 1 for physical accuracy
- The surface properties at each pixel location
Knobs
- Normals
- The channels to use as the normals pass
- Ray Samples
- The number of samples to use per pixel
- Incident Refractive Index
- The refractive index of the incoming ray medium
- Refracted Refractive Index
- The refractive index of the outgoing ray medium
- HDRI Offset Angle
- Rotate the HDRI by this amount
- Enable Precomputed Irradiance
- Use a precomputed irradiance for diffuse lighting
- This will require only one Ray Sample rather than many in order to converge
- Irradiance Blur Size
- Blur the HDRI by this amount before using it to compute the irradiance
- This can help reduce artifacts caused by small, bright, light sources without increasing the 'Irradiance Samples'
- Irradiance Samples
- The number of samples in the horizontal direction that will be used to compute the irradiance of a hemisphere of the HDRI
- Half this many samples will be used in the vertical direction
- The number of samples in the horizontal direction that will be used to compute the irradiance of a hemisphere of the HDRI
- Output Irradiance
- Enable this to view the irradiance.
Limitations
- There are no secondary reflections for any material
- The transmissive objects are treated as shells
- They have no back wall so rays are not refracted or reflected off the back of the shape
- If the rays are meant to enter and exit the object the final refracted direction, and therefore the final colour will not be physically accurate
- The transmissive objects are treated as shells
References
- Most of the code was repurposed from https://github.com/obulka/blink_raymarch
- Makes use of http://www.nukepedia.com/gizmos/3d/dummycam
- Thanks to Riley Gray for the idea and testing
- HDRI used in examples from Greg Zaal - https://polyhaven.com/a/aft_lounge
MIT License
Copyright (c) 2022 obulka
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.