formZ SDK | 5.0 API Reference | Project | Modeling | Rendering | Shaders
Description
This is a simple utility function to create a random
wiggly curve based on a x,y coordinate input value.
If plotted as a graph each input value yields a value between
0.0 and 1.0, that, creates a smooth wiggly curve that progresses
more or less horizontally, but without recognizable repetitive patterns.
This function is similar to fz_shdr_noise_2d, but also uses
the passes parameter to determine how wiggly the curve becomes.
can be used to create
random surface patterns from 2d texture space coordinates.
Plugin Prototype
double fz_shdr_turbulance_2d(
fz_xy_td * | xy, |
fzrt_int | passes, |
type, | |
fzrt_int | nimpulses ) |
Parameters
xy [Input]
The input value
passes [Input]
The number of passes. The higher this value the curlier the curve becomes.
Range: 1 <= passes <= 10
type [Input]
The turbulence type
nimpulses [Input]
The number of impulses if type is FZ_SHDR_TURB_TYPE_BEST. The higher the value, the more random the pattern. Higher values also cause this function to execute slower. A value of 3 is a good default.
Range: 1 <= nimpulses <= 10
Returns
turbulence value in the range 0.0 to 1.0
Availability
5.0.0.0
Plugin Example
The example below creates a random pattern of black and white spots :
fz_shdr_get_tspace_st(&st);
val = fz_shdr_turbulance_2d(&st,3,FZ_SHDR_TURB_TYPE_BETTER,0);
if ( val < 0.5 ) col = black;
else col = white;
See Also
Function Set
Defined in