vpSetDepthCueing(3)
β¨ vpSetDepthCueing β¨
okay bestie, welcome to the vpSetDepthCueing(3) page β it lives in the Library Functions Manual and it's literally just about making your volumetric fog look β¨correctβ¨. no cap.
πΈ NAME πΈ
vpSetDepthCueing β set depth cueing parameters π
π SYNOPSIS π
#include <volpack.h>
vpResult
vpSetDepthCueing(vpc, front_factor, density)
vpContext *vpc;
double front_factor;
double density;
π¦ ARGUMENTS π¦
vpcβ the VolPack context you got fromvpCreateContext. your whole vibe lives in here π«Άfront_factorβ the depth cueing factor right at the front clipping plane.densityβ the fog density. yes, actual fog. it's giving spooky forest π«οΈ
π DESCRIPTION π
so vpSetDepthCueing sets the parameters for depth cueing. and what even is depth cueing, you ask? it's a simulated fog that makes objects in the distance look darker than the foreground objects. main character foreground, mysterious background. iconic. π
the important thing: depth cueing is independent of the shading method. it works with lookup-table shading and callback-function shading. and it is not stored in the shading lookup table β it's always applied to voxels at rendering time. periodt.
the front_factor argument is the transparency of the fog at the front clipping plane (peep vpWindow(3) or vpWindowPHIGS(3) for that). it must be a positive number, and it's usually less than 1.0 β though larger numbers can be used to brighten the foreground, if that's the look you're going for.
the density argument controls the "density" of the fog. crank the density and objects recede into darkness over a shorter distance. the equation for the transparency of the fog at a particular voxel is:
T = front_factor * exp(-density * depth)
where depth is 0 at the front clipping plane and 1 at the back clipping plane. each voxel color component is multiplied by the fog transparency during rendering. math but make it fashion π
by default, depth cueing is not enabled. to enable it, call vpEnable with the VP_DEPTH_CUE option. don't forget this part, bestie, or you'll be staring at a non-foggy render like π
depth cueing is implemented using an internal lookup table (unrelated to the shading lookup table). there are several VolPack state variables that affect the depth cueing table, although they should not usually be changed. the table contains depth cueing factors as a function of depth. the table must contain entries for depths in the range0.0-1.0, and possibly for negative depths depending upon the current viewing parameters (the reason for this is beyond the scope of a man page β iykyk, and honestly, same).
the VP_DEPTH_CUE_QUANTIZATION variable (which can be set by calling vpSetd) determines the depth difference between two adjacent entries in the depth cueing table. for instance, the default quantization of 1/255 specifies that each entry in the table represents 1/255 times the distance between the front and back clipping planes. reducing the quantization increases the size and the accuracy of the depth cueing table. bigger table, better glow-up β¨
normally the depth cueing table is resized and recomputed only when necessary. recomputation may be required if the viewpoint changes, increasing the range of voxel depths that are encountered (recall that there is no lower bound on the depth β yeah, wild). you can use vpGeti with the VP_DEPTH_CUE_TABLE_SIZE state variable code to get the current number of table entries. you can also set the value of VP_DEPTH_CUE_TABLE_SIZE_HINT (using vpSeti) to suggest a size for the table. this might be desirable if you plan to compute an animation loop and want to make sure the depth cueing table does not need to be recomputed in the middle of the sequence. however β and this is the plot twist β since recomputing the table is relatively inexpensive, it should not be necessary to use this option. so like, you can, but you probably don't gotta π«Ά
π STATE VARIABLES π
info about the current depth cueing properties can be retrieved with the following state variable codes (see vpGeti(3)):
VP_DEPTH_CUEVP_DEPTH_CUE_FRONTVP_DEPTH_CUE_DENSITYVP_DEPTH_CUE_TABLE_SIZEVP_DEPTH_CUE_SIZE_HINTVP_DEPTH_CUE_QUANTIZATION
π ERRORS π
the normal return value is VP_OK. the following error return value is possible:
VPERROR_BAD_VALUEβ the value offront_factoris not positive. (bestie. it has to be positive. i'm begging π)
π₯ SEE ALSO π₯
VolPack(3), vpCreateContext(3), vpSetLookupShader(3)
and that's the whole page, no notes π
this lil' beauty ships with VolPack, and it's filed under vpSetDepthCueing(3). go forth and fog responsibly, bestie ππ¦πΈ
π¦ where this page comes from
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- Copyright (c) 1995-2008, Stanford University
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms