vpRenderRawVolume(3)
π vpRenderRawVolume(3) β the render-a-volume girlies π
Library Functions Manual Β· part of the VolPack bestie collection π«Ά
β¨ NAME β¨
vpRenderRawVolume, vpRenderClassifiedVolume β render a volume π
πΈ SYNOPSIS πΈ
#include <volpack.h>
vpResult
vpRenderRawVolume(vpc)
vpContext *vpc;
vpResult
vpRenderClassifiedVolume(vpc)
vpContext *vpc;
π ARGUMENTS π
vpcβ the VolPack context you got fromvpCreateContext. Your whole vibe lives in here bestie.
π¦ DESCRIPTION π¦
Okay so these two routines are the main characters β they render a volume using all the parameters chillin' in a rendering context.
vpRenderRawVolume renders the data in the current voxel array and stores the result in the current image array. If an octree is present in the context (see vpCreateMinMaxOctree(3)) then it gets used to accelerate rendering. β¨
vpRenderClassifiedVolume is literally identical in function, except it renders the current preclassified volume (see vpClassifyVolume(3)) instead of the voxel array, and the octree is not used. No octree, not invited, blocked. π
π which one do I use tho π
Use vpRenderClassifiedVolume when you're rendering the same volume multiple times with the same opacity transfer function. This rendering mode is the fastest, periodt. But the opacity transfer function must not change, because the voxel opacities must be fixed to compute a preclassified volume. No changing your mind mid-animation, bestie, that's the rules. π
Use vpRenderRawVolume when the volume data or the opacity transfer function changes in between renderings. If the volume data stays fixed then a min-max octree should be computed to accelerate rendering. Rendering is significantly faster with an octree than without β though ngl it's still slower than rendering with vpRenderClassifiedVolume.
π before you render, set up your context π
Before the rendering routines are called, the rendering context must be initialized to set:
- the volume parameters
- the classification parameters (
vpRenderRawVolumeonly) - the viewing parameters
- the shading and lighting parameters
- the image array
See VolPack(3) for a list of relevant functions. It's giving "checklist before you leave the house". β
π the one state variable you actually gotta touch π
There's one important state variable that should be adjusted before calling the rendering routines: the maximum opacity threshold.
This number specifies a threshold value for the opacity of an image pixel. If the opacity of the pixel reaches the threshold then no more voxels are composited into the pixel β it's done, it's had enough, it's going home. πͺ
The threshold should be a number slightly less than one (0.95 is a good value); numbers closer to 1.0 result in longer rendering times, but less error. So it's a whole tradeoff situation.
Change the value of the threshold by calling vpSetd with the VP_MAX_RAY_OPACITY option. The default value is 1.0.
π§ the intermediate image, aka the work buffer lore π§
There are two additional state variables that can be adjusted to set the size of an internal data structure. During rendering, a work buffer called the intermediate image is used to hold temporary results. The size of this data structure depends on the size of the volume and the current view transformation matrix.
Over the course of an animation sequence the intermediate image may have to be enlarged multiple times, resulting in many calls to the memory allocator. Normally the overhead of reallocating the data structure is negligible and can be ignored. But β and this is the glow-up β that overhead can be eliminated by specifying hints for the maximum size of the intermediate image. The data structure will then be allocated once, and will never be reallocated unless an even larger intermediate image is required. Iconic behavior fr fr. π
To set the size hints, call vpSeti with the VP_INT_WIDTH_HINT and VP_INT_HEIGHT_HINT state variable codes.
If the viewing transformation does not include any scaling, then the maximum possible size of each dimension of the intermediate image is twice the size of the largest dimension of the volume.
To get a more precise bound, the intermediate image size required for rendering a volume with the current viewing parameters can be found by calling vpGeti with the VP_INTERMEDIATE_WIDTH and VP_INTERMEDIATE_HEIGHT state variable codes. π
π ERRORS π
The normal return value is VP_OK. The following error return values are possible:
VPERROR_BAD_SHADERβ The shading lookup tables are sized incorrectly, or one of the voxel fields used to index the tables is invalid, or the number of material types is invalid.VPERROR_SINGULARβ One of the current view transformation matrices is singular.VPERROR_BAD_VOLUMEβ The volume size has not been set or is invalid, or there is no volume data.VPERROR_BAD_VOXELβ The voxel size or the voxel fields have not been specified or have been incorrectly specified.VPERROR_BAD_CLASSIFIERβ The opacity transfer function tables have invalid sizes or are associated with invalid voxel fields or have been incorrectly specified. (vpRenderRawVolumeonly)VPERROR_BAD_SHADOWβ The angle between the shadow light vector and the viewing direction is too large (must be less than 45 degrees). Either change the light direction or disable shadows (seevpSetShadowLookupShader).
π¨ bestie if you see VPERROR_BAD_SHADOW that light is at a truly unhinged angle, fix it or turn shadows off, no cap.
π₯ SEE ALSO π₯
That's the whole page, babe. Go render something gorgeous. π
VolPack Β· vpRenderRawVolume(3) β mwah, thanks for reading, ily, bye ππ¦β¨
π¦ 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