diff options
author | Matt Ebb <matt@mke3.net> | 2008-12-13 08:41:34 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2008-12-13 08:41:34 +0300 |
commit | 92f5c719aedf79db7e45d3b887146a559321981e (patch) | |
tree | 877e8a5c91f19a17dcce8cc5d14f2dda00ef6e80 /source/blender/makesdna | |
parent | aef61a7000c279a96f1bb0e1fedf7da2574292fd (diff) |
* Volume Rendering: Voxel data
This commit introduces a new texture ('Voxel Data'), used to load up saved voxel
data sets for rendering, contributed by Raúl 'farsthary' Fernández Hernández
with some additional tweaks. Thanks, Raúl!
The texture works similar to the existing point density texture, currently it
only provides intensity information, which can then be mapped (for example) to
density in a volume material. This is an early version, intended to read the
voxel format saved by Raúl's command line simulators, in future revisions
there's potential for making a more full-featured 'Blender voxel file format',
and also for supporting other formats too.
Note: Due to some subtleties in Raúl's existing released simulators, in order
to load them correctly the voxel data texture, you'll need to raise the
'resolution' value by 2. So if you baked out the simulation at resolution 50,
enter 52 for the resolution in the texture panel. This can possibly be fixed in
the simulator later on.
Right now, the way the texture is mapped is just in the space 0,0,0 <-> 1,1,1
and it can appear rotated 90 degrees incorrectly. This will be tackled, for now,
probably the easiest way to map it is with and empty, using Map Input -> Object.
Smoke test: http://www.vimeo.com/2449270
One more note, trilinear interpolation seems a bit slow at the moment, we'll
look into this.
For curiosity, while testing/debugging this, I made a script that exports a mesh
to voxel data. Here's a test of grogan (www.kajimba.com) converted to voxels,
rendered as a volume: http://www.vimeo.com/2512028
The script is available here: http://mke3.net/projects/bpython/export_object_voxeldata.py
* Another smaller thing, brought back early ray termination (was disabled
previously for debugging) and made it user configurable. It now appears as a new
value in the volume material: 'Depth Cutoff'. For some background info on what
this does, check:
http://farsthary.wordpress.com/2008/12/11/cutting-down-render-times/
* Also some disabled work-in-progess code for light cache
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_material_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_texture_types.h | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index f332537e9a8..5172f6a970c 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -69,6 +69,8 @@ typedef struct Material { short vol_stepsize_type; short vol_precache_resolution; float vol_stepsize, vol_shade_stepsize; + float vol_depth_cutoff; + float vpad; float vol_density_scale; float vol_absorption, vol_scattering; float vol_absorption_col[3]; diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index b4fcb5efe40..e90df908c2b 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -154,7 +154,7 @@ typedef struct PointDensity { short noise_depth; short noise_influence; short noise_basis; - short pdpad3[3]; + short pdpad3[3]; float noise_fac; float speed_scale; @@ -162,6 +162,18 @@ typedef struct PointDensity { } PointDensity; +typedef struct VoxelData { + int resolX, resolY, resolZ; + int interp_type; + + float int_multiplier; + float vxpad; + + char source_path[240]; + float *dataset; + +} VoxelData; + typedef struct Tex { ID id; @@ -209,6 +221,7 @@ typedef struct Tex { struct EnvMap *env; struct PreviewImage * preview; struct PointDensity *pd; + struct VoxelData *vd; char use_nodes; char pad[7]; @@ -250,6 +263,7 @@ typedef struct TexMapping { #define TEX_DISTNOISE 13 /* predicting ocean texture for 14 */ #define TEX_POINTDENSITY 15 +#define TEX_VOXELDATA 16 /* musgrave stype */ #define TEX_MFRACTAL 0 @@ -465,5 +479,13 @@ typedef struct TexMapping { #define POINT_DATA_VEL 1 #define POINT_DATA_LIFE 2 +/******************** Voxel Data *****************************/ +#define TEX_VD_CUBIC 0 +#define TEX_VD_PARALLELOGRAM 1 + +#define TEX_VD_NEARESTNEIGHBOR 0 +#define TEX_VD_LINEAR 1 +#define TEX_VD_TRICUBIC 2 + #endif |