formZ SDK | 5.0 API Reference | Project | Modeling | Rendering | Shaders
Description
This function can only be called inside the pixel callback function when implementing a plugin or script shader, typically a reflection shader. It computes the color of a refracted ray through raytracing. A refracted ray usually occurs when shading a glass like material, when the ray enters or exits the transmissive surface. The first argument is the world point of the current pixel. This point can be retrieved by a call to (). The second argument is the direction of the ray. This is usually the refracted view direction. The third argument is the transmission factor. This is usually the parameter set up as a shader parameter by a call to fz_shdr_set_transmission_parm() in the set_parameters callback function. It helps () determine when to abort nested raytracing. The last argument returns the color calculated by the refracted ray.
Plugin Prototype
fzrt_int fz_shdr_raytrace_refracted(
wpt, | |
dir, | |
double | trns, |
col ) |
Parameters
wpt [Input]
The world point where the raytraced ray starts.
dir [Input]
The direction in which the raytrace starts.
trns [Input]
The transmission factor. It indicates, how much of the color to be computed by this function will be part of the final shaded color of a shading calculation.
col [Result]
The color calculated by the raytraced ray.
Returns
none
Availability
5.0.0.0
Plugin Example
fz_shdr_get_transmission_factor(&trns_factor);
if ( trns_factor > 0.0 )
{
fz_shdr_get_index_of_refraction(&eta);
fz_shdr_get_view_dir(&view_vec);
fz_shdr_get_world_shading_normal(&norm);
if ( fz_shdr_ray_refract(&view_vec,&norm,eta,&trns_vec) == TRUE )
{
fz_shdr_get_world_pnt(&world_pt);
fz_shdr_raytrace_refracted(&world_pt,&trns_vec,trns_factor,&trns_col);
trns_col *= trns_factor;
}
}
See Also
Function Set
Defined in