formZ SDK | 5.0 API Reference | Project | Modeling | Rendering | Shaders

# fz_shdr_ray_reflect

Description

This function can only be called inside the pixel callback function when implementing a plugin or script shader. It computes the reflected ray off the surface where the current pixel is rendered. This function is typically called before a call to . Its first parameter is the direction of the incoming ray. For mirrored reflections, this is usually the current view direction. The second parameter is the surface normal direction at the current pixel. This normal should be retrieved by a call to (). The last parameter returns the reflected ray direction.

Plugin Prototype

void fz_shdr_ray_reflect(

fz_xyz_td * | vec_in,
fz_xyz_td * | norm_vec,
fz_xyz_td * | vec_out )

Parameters

vec_in [Input]

Direction of the incoming ray.

norm_vec [Input]

Direction of surface normal.

vec_out [Result]

Direction of the reflected ray.

Returns

none

Availability

5.0.0.0

Plugin Example

fz_shdr_get_mirror_factor(&mirr_factor); if ( mirr_factor > 0.0 ) { fz_shdr_get_world_pnt(&world_pt); fz_shdr_get_world_shading_normal(&norm); fz_shdr_get_view_dir(&view_vec); fz_shdr_ray_reflect(&view_vec,&norm,&mirr_vec); fz_shdr_raytrace_reflected(&world_pt,&mirr_vec,mirr_factor,&mirr_col); mirr_col *= mirr_factor; }

See Also

Function Set

fz_shdr_fset

Defined in

fz_rzne_shdr_api.h