1vpSetDepthCueing(3)        Library Functions Manual        vpSetDepthCueing(3)
2
3
4

NAME

6       vpSetDepthCueing - set depth cueing parameters
7

SYNOPSIS

9       #include <volpack.h>
10
11       vpResult
12       vpSetDepthCueing(vpc, front_factor, density)
13           vpContext *vpc;
14           double front_factor;
15           double density;
16

ARGUMENTS

18       vpc    VolPack context from vpCreateContext.
19
20       front_factor
21              Depth cueing factor at the front clipping plane.
22
23       density
24              Fog density.
25

DESCRIPTION

27       vpSetDepthCueing is used to set the parameters for depth cueing.  Depth
28       cueing is a simulated fog that makes objects  in  the  distance  appear
29       darker  than  foreground  objects.   Depth cueing is independent of the
30       shading method.  It can be used with lookup-table shading or  callback-
31       function shading.  Depth cueing is not stored in the shading lookup ta‐
32       ble; it is always applied to voxels at rendering time.
33
34       The front_factor argument is the transparency of the fog at  the  front
35       clipping  plane  (see  vpWindow(3)  or vpWindowPHIGS(3)).  It must be a
36       positive number and is usually less than 1.0 (although  larger  numbers
37       can be used to brighten the foreground).  The density argument controls
38       the "density" of the fog.  Increasing the  density  causes  objects  to
39       recede  into  darkness  over  a shorter distance.  The equation for the
40       transparency of the fog at a particular voxel is: T  =  front_factor  *
41       exp(-density  * depth) where depth is 0 at the front clipping plane and
42       1 at the back clipping plane.  Each voxel color component is multiplied
43       by the fog transparency during rendering.
44
45       By  default,  depth cueing is not enabled.  To enable it, call vpEnable
46       with the VP_DEPTH_CUE option.
47
48       Depth cueing is implemented using an internal lookup  table  (unrelated
49       to  the  shading  lookup table).  There are several VolPack state vari‐
50       ables that affect the depth cueing table, although they should not usu‐
51       ally be changed.  The table contains depth cueing factors as a function
52       of depth.  The table must contain  entries  for  depths  in  the  range
53       0.0-1.0,  and  possibly  for negative depths depending upon the current
54       viewing parameters (the reason for this is beyond the scope  of  a  man
55       page).   The  VP_DEPTH_CUE_QUANTIZATION  variable  (which can be set by
56       calling vpSetd) determines the depth difference  between  two  adjacent
57       entries in the depth cueing table.  For instance, the default quantiza‐
58       tion of 1/255 specifies that each entry in the table  represents  1/255
59       times  the distance between the front and back clipping planes.  Reduc‐
60       ing the quantization increases the size and accuracy of the depth  cue‐
61       ing table.
62
63       Normally  the  depth  cueing  table is resized and recomputed only when
64       necessary.  Recomputation may be required  if  the  viewpoint  changes,
65       increasing  the range of voxel depths that are encountered (recall that
66       there is no lower bound on the depth).  You can  use  vpGeti  with  the
67       VP_DEPTH_CUE_TABLE_SIZE  state  variable code to get the current number
68       of table entries.  You can  also  set  the  value  of  VP_DEPTH_CUE_TA‐
69       BLE_SIZE_HINT  (using  vpSeti)  to  suggest a size for the table.  This
70       might be desirable if you plan to compute an animation loop and want to
71       ensure  that  the  depth cueing table does not need to be recomputed in
72       the middle of the sequence.  However, since recomputing  the  table  is
73       relatively inexpensive, it should not be necessary to use this option.
74

STATE VARIABLES

76       Information  about the current depth cueing properties can be retrieved
77       with the following state variable codes (see vpGeti(3)):  VP_DEPTH_CUE,
78       VP_DEPTH_CUE_FRONT,    VP_DEPTH_CUE_DENSITY,   VP_DEPTH_CUE_TABLE_SIZE,
79       VP_DEPTH_CUE_SIZE_HINT, VP_DEPTH_CUE_QUANTIZATION.
80

ERRORS

82       The normal return value is VP_OK.  The following error return value  is
83       possible:
84
85       VPERROR_BAD_VALUE
86              The value of front_factor is not positive.
87

SEE ALSO

89       VolPack(3), vpCreateContext(3), vpSetLookupShader(3)
90
91
92
93VolPack                                                    vpSetDepthCueing(3)
Impressum