sj_trace
sj_trace is an Arnold shader letting you trace several types of ray in several directions.
In the standard tracing shaders, the tracing direction (for instance for reflections or refractions) is computed internally
by the shader.
Also, the starting point of the ray is alway the current hit point.
sj_trace instead exposes the type, origin and direction of the ray to be traced.
For instance, you can decide to trace a refraction ray along the reflected direction, or along a custom-defined one,
and also to shift the origin of such a ray.
So, it's to be used in particular cases, such as when you want to shift the reflection direction a little bit,
without having to move the reflected object, or, for instance, to check for the thickness of the hit object before
tracing it refractive.
Download
Get the shaders pack from here
Installation
The spdl and the dll/so files should be copied under the SItoA addon directory, or any other workgroup.
If using another workgroup, you will have to set the shaders search path to point to the dll/so directory in the rendering options.
The spdl files must be copied under SItoA/Application/spdl (or under the Application/spdl directory of your workgroup).
Parameters
Type: type of ray to be traced. Options are Probe, Eye, Reflection, Refraction, Environment, None.
On Hit Override: if On, and if the ray hit something, On Hit color is returned instead of the traced color.
This is also the color returned for hitting Probe rays.
On No Hit Override: if On, and if the ray did not hit something, On No Hit color is returned instead of
the traced color. This is also the color returned for not hitting Probe rays.
Origin: the origin of the ray. You can use the Current Point or a Custom Origin.
Direction: the direction of the ray. Options are
- Current Direction: the direction of the incoming ray is used.
- Reflection: the specular reflected direction.
- Glossy Reflection: a glossy reflected direction. The magnitude of the glossiness is defined by Gloss.
- Refraction: the refracted direction, according to Index Of Refraction.
- Glossy Refraction: a glossy refracted direction, depending on both Index Of Refraction and Gloss.
- Custom: if on, Custom Direction is used.
Trace backfacing: forces tracing even if the current normal direction backfaces the computed tracing direction.
Example
In this scene, we shift the reflection of the sphere over the grid by 2 units along X.
We take the current intersection point, add it a (2,0,0) vector, and plug the result into the custom origin port the sj_trace.