This BlinkScript Gizmo allows you to perform single-bounce raytracing, only requiring a camera, normals AOV, and HDRI.
Specular surfaces, as well as diffuse, and even transmissive, are supported. These surface properties can be a single constant value, or driven by input images to create materials as seen in the above turntable.
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.
- 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
- diffuse
- The diffuse colour of the surface represented by the normals pass if the diffuse "Use Input" is checked
- specular
- The specular colour of the surface represented by the normals pass if the specular "Use Input" is checked
- transmission
- The transmission colour of the surface represented by the normals pass if the transmission "Use Input" is checked
- specRoughness
- The specular roughness values of the surface represented by the normals pass if the specular roughness "Use Input" is checked
- transRoughness
- The transmission roughness values of the surface represented by the normals pass if the transmission roughness "Use Input" is checked
- 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.
- Diffuse Colour
- The diffuse colour of the surface if the diffuse "Use Input" knob is not checked
- Specular Colour
- The specular colour of the surface if the specular "Use Input" knob is not checked
- Transmission Colour
- The transmission colour of the surface if the transmission "Use Input" knob is not checked
- Specular Roughness
- The specular roughness of the surface if the specular roughness "Use Input" knob is not checked
- Transmission Roughness
- The transmission roughness of the surface if the transmission roughness "Use Input" knob is not checked
- Use Input
- These knobs toggle between the use of the corresponding knobs as a surface property, or the corresponding input
- If you use the knob, ("Use Input" false) the entire surface will have the same value, which can be good for testing
- If you use the input, ("Use Input" true) the surface property can be specified in an image, and therefore each pixel can take a different value
- These knobs toggle between the use of the corresponding knobs as a surface property, or the corresponding input
- Enable Precomputed Irradiance
- Use a precomputed irradiance for diffuse lighting. This will require only one 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.
- Output Irradiance
- Enable this to view the irradiance.
- 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
- Examples courtesy of Riley Gray
- HDRI from Greg Zaal at https://polyhaven.com/a/ninomaru_teien