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

fz_shdr_raytrace_reflected

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 reflected ray through raytracing. 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 reflected view direction. The third argument is the mirror factor. This is usually the parameter set up as a shader parameter by a call to fz_shdr_set_mirror_parm() in the set_parameters callback function. It helps () determine when to abort nested raytracing. The last argument returns the color calculated by the reflected ray.

Plugin Prototype

fzrt_int fz_shdr_raytrace_reflected(

fz_xyz_td *

wpt,

fz_xyz_td *

dir,

double

mirr,

fz_rgb_float_td *

col )

Parameters

wpt [Input]

The world point where the raytraced ray starts.

dir [Input]

The direction in which the raytrace starts.

mirr [Input]

The mirror 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_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

fz_shdr_ray_reflect

Function Set

fz_shdr_fset


Defined in

fz_rzne_shdr_api.h